Wiki User
∙ 2012-10-15 22:40:48No, the shell needs both execute and read permissions to run the script.
Wiki User
∙ 2012-10-15 22:40:48To do this you will need at least read permission; if you don't have that then you will not be able to execute the script at all. One way is to copy the script to your directory and add the execute permission. The second way is to call the correct shell interpreter program directly, as in: ksh /some/file/shell
If the shell script is readable and executable then to execute it just type the name of the shell script file. Otherwise, you can explicity call a shell interpreter to run the file as a shell script, i.e., ksh myfile
Eithersh shellscript.shor./shellscript.sh
Shell scripts are not compiled; they are interpreted (and therefore do not need to be compiled). Just type in the name of the shell script and any parameters it needs to execute.
For any Unix or Linux based operating system, make the text file readable and executable and then invoke (call) it by the file name, which will execute the script.
A shell script is a file containing a set of commands to be executed (run) by the shell in sequence as it reads the file.
A shell script is nothing more than a readable and executable ASCII text file. In this file you put all of the commands that you want to execute, in sequence. The name of the file can be anything you like. Any text editor (VI, VIM, pico, etc) can create a shell script file In addition, shell script files have the ability to detect logic, and are programmable. Just think about what tasks you want to perform and their order, and put it into a file, and there you have a shell script.
Essentially, a command in Unix is a program that you execute for a certain purpose. It could be anything, from a shell script, to copying or deleting files, etc.
As long as the script file is readable and executable, just type the name of the script and it will execute immediately. Otherwise, you can call the shell interpreter and have it run it immediately such as: bash ./thefile where ./thefile is the script you want to run. Or, substitute the shell interpreter you wish to use instead of bash, such as sh, ksh, tcsh, csh, etc.
If you are asking about a shell script, just create a text file with the commands you want to execute inside it. Then, make the file executable and readable and you have a shell script file. A shell program is more complicated; you need to support the user features that most users would expect a shell program or shell interpreter to do. I would suggest studying the source code of a current shell program to see how to go about implementing one of your own.
# SS29 # Script to delete all lines containing the word 'unix' from files supplied as arguments # Usage: SS29 file1 file2 file3 ... if [$# -lt 2] then echo Insufficient arguments exit fi for file do grep -v unix $file>/temp/$file cp /temp/$file $file done
Make sure it is readable and executable (permissions). Then, just type in the name of the shell file to execute it.