answersLogoWhite

0


Best Answer

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

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the command to execute a shell script?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you execute a shell script if you do not have read permission for the file containing the script?

No, the shell needs both execute and read permissions to run the script.


What is a command in Unix?

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.


What are the two ways you can execute a shell script when you do not have execute access permission for the file containing the script?

To 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


How do you execute shell script under Linux?

Eithersh shellscript.shor./shellscript.sh


How do you compile and run shell script of factorial?

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.


Which command in unix is used to run the script immediately?

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.


What is the Purpose of exit command in Shell of Unix?

The 'exit' command allows you to stop a running shell script at any point and to return a "status" value back to whomever called the shell script. This is a very common practice with shell scripts; sometimes you want to stop the script before it gets to the end of the shell script (for various logic reasons). The 'exit' command also allows you to give a status that any other calling process can use to determine if the shell script ended successfully or not.


What is the procedure of execute a script in shell in ubantu?

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.


How do you write a shell script which counts the last 10 lines present in a given file?

You don't need a shell script to do this - just use the 'tail' command.


What is the purpose of using echo command?

The echo command echoes out any of the command line arguments given to it. It is commonly used in shell scripts to echo what portions of the shell script are doing.


What line is necessary at the beginning of a script to tell the OS what to use to run the script?

The special line at the beginning of the script is only necessary if you want the script to be run by a certain command interpreter that is different from your logon shell or because you don't know what environment the user of the shell might be running in. It is a special comment line that looks like: #!/command-name such as: #!/usr/bin/ksh which causes the ksh interpreter to be used for the rest of the shell script.


What is the trap command on Unix for?

The trap command is used in a shell script to intercept certain types of software signals; usually it is used to do a "graceful" cleanup when the shell program is interrupted.