Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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!
Comment

PREVIOUS NEXT
Code Example
Shell :: git delete last commit in remote 
Shell :: Update in fedora before installs 
Shell :: change ip address 
Shell :: mac docker-compose 
Shell :: update inkscape to new version 
Shell :: shell iterate over lines in variable 
Shell :: create new users and add them in group in linux 
Shell :: ocoaPods not installed or not in valid state. 
Shell :: how to install msfconsole in ubuntu 
Shell :: django view sql behind migration 
Shell :: bash array append 
Shell :: git config --list 
Shell :: docker.credentials.errors.StoreError: Credentials store docker-credential-desktop.exe exited with "" 
Shell :: how to compare files in terminal 
Shell :: maximize and minimize buttons missing ubuntu 
Shell :: update Yarn globally for macOS users 
Shell :: how to count number of running processes in windows 
Shell :: convert windows file to unix 
Shell :: custom jenkins dockerfile 
Shell :: oh my zsh 
Shell :: docker dir log linux 
Shell :: bash floating point variables 
Shell :: Save changes in a new branch git 
Shell :: kali linux download 
Shell :: linux remove environment variable 
Shell :: copy files from local to host ssh 
Shell :: shell xargs 
Shell :: how to format pendrive on ubuntu 
Shell :: create github ssh key 
Shell :: add remote github 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =