Execute script de shell com o datilografado
1. Install dependencies
If you haven’t already, download and install node.
After node is installed, install both TypeScript and ts-node globally using npm:
npm install typescript ts-node -g
2. Write your shell script in TypeScript
Create a new .ts file with a shebang as its first line that points to ts-node:
#!/usr/bin/env ts-node
console.log('Hello from TypeScript!');
3. Make your script runnable
After saving your TypeScript file, you’ll need to update its permissions to allow it to be executed:
> chmod u+x your-shell-script.ts
4. Run your TypeScript file
You can now run the script as you would any other command-line utility:
> ./your-shell-script.ts
result
> ./my-shell-script
Hello from TypeScript!
Encouraging Eel