|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to save and execute terminal commands in shell?
I frequently use some commands, which I want to save in some file say Code:
myregularshell.sh these are the commands I use, I tried saving and executing, but couldn't get the preview of execution, and result is also not coming if I copy same commands and paste it on terminal result is coming Code:
cd go somewhere echo "I am here $PWD" sudo su source /etc/profile sh operation.sh arguments echo "Operation over" find /mypath/path iname "*.abc" -delete echo "old files deleted" mv -i *.xyz /mypath/path echo "new files moved " Is there any way to save as shell script and execute ? |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Preview of execution can be done using "set", Please add this line into you script Code:
set -vx |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
no, if I logout from root then I could see from Code:
set -vx , but if I logout from root I will get permission denied error |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell: How to execute commands from another file? | Alkali | Shell Programming and Scripting | 3 | 03-03-2012 06:07 PM |
| Shell script to execute commands in individual users' home directories | rupa_lahiri | Shell Programming and Scripting | 1 | 11-03-2009 07:48 AM |
| execute shell commands with in sftp | tommy1 | Shell Programming and Scripting | 5 | 02-17-2009 07:13 PM |
| Can BASH execute commands on a remote server when the commands are embedded in shell | bash_in_my_head | Shell Programming and Scripting | 1 | 12-04-2008 12:51 AM |
| how to execute shell commands in awk script? | RishiPahuja | Shell Programming and Scripting | 1 | 09-02-2005 09:37 AM |
|
|