Shell script shortcuts

You can run a shell script from a shortcut. The Target text box in your shortcut should use the following, which also works from the cmd.exe command prompt:

ksh -l script

The script argument is the absolute path, in Interix format, to the shell script. For example, if you have a script called quotes in D:\stocks, the path would be /dev/fs/D/stocks/quotes.

Important

The script must also be executable. To make a script executable in an Interix shell, type the following:

chmod a+x script

Unless a script is interactive, it will appear and disappear too quickly for you to read. If you want to read the output of a script, add a wait-for-input block to the end of the script, as illustrated in the following example:

echo Type "exit" to leave.
while read input
do
   if [ "$input" = "exit" ]
   then
	exit
   fi
echo Type "exit" to leave.
done

The Interix subsystem supports the #! notation for specifying the command interpreter that will execute the script. The following example, which should be the very first line of a script, tells the Interix subsystem to use the Korn shell to interpret the script.

#!/bin/ksh