Horje
Run shell script with typescript Code Example
Run shell script with typescript
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!




Shell

Related
lavastore js Code Example lavastore js Code Example
cmd install mrjob Code Example cmd install mrjob Code Example
sed all except last Code Example sed all except last Code Example
There is no application installed for “shared library” files Code Example There is no application installed for “shared library” files Code Example
check if string starts with powershell Code Example check if string starts with powershell Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11