This works from the command line, but not in a shell script (csh/sh)

There may be several reasons why your command line shell commands are not working in a script. The most likely reason is that the shell which is started when you login and acts as the default command line is csh, but the default shell for executing shell scripts is sh. If you simply add the line #!/bin/csh to the top of a shell script, then it will be executed by csh instead.

Another reason why your shell script may not execute is that it may not have the execute file permission set. Shell scripts must be made executable before they can be run by a shell.

The command

	chmod +x script_name  
will accomplish this.

Last Update: 1/12/94 JGW