The Script File Command

A script file is equivalent to a batch file where you can list all the commands you want to execute sequentially.

Before using the file, ensure that you have populated it with the commands you want to use. Assume that the content of the script file, script.txt is

'ls

pwd

history'

The following code snippet shows the usage of the command:
ssh -p2222 admin@localhost scriptmode < script.txt
Output

ls
TEA

pwd
/
history
0 ls
1 pwd
2 history