Making script show command (e.g. copy) being executed and variable substitution?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Making script show command (e.g. copy) being executed and variable substitution?
# 1  
Old 05-24-2010
Making script show command (e.g. copy) being executed and variable substitution?

When script is running you only see when some of the commands are not successfull.
Is there a way to see which command are executed and to show the substitution of variables as every line is executed ?
gr0124
# 2  
Old 05-24-2010
Code:
set -x

for each level of the process, including each function() within the script...alternately, you could also echo script pre-interpolation via
Code:
set -v

assuming ksh or bash...
# 3  
Old 05-24-2010
Actually, assuming a posix-compliant shell. set -x and set -v are both standardized Smilie
# 4  
Old 05-24-2010
Use the -v option of the cp command when copying files.
Code:
-v    Cause cp to be verbose, showing files as they are copied.

Check in the man pages if the commands you use also support this option or a similar one.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with making the output of a command a variable

I'm writing a script that goes something like this: #!/bin/bash zenity --list --checklist --title="Choose Packages to Install" --width="1000" --height="400" \ --column="Select" --column="Package Name" --column="Description" \ GIMP=$( " " GIMP "GIMP is a free and open source photo editor." ... (1 Reply)
Discussion started by: Defunct_Lizard
1 Replies

2. UNIX for Dummies Questions & Answers

Set Command to output a log of every command executed in the script

Hi Guys, I like to output every command executed in the script to a file. I have tried set -x which does the same. But it is not giving the logs of the child script which is being called from my script. Is there any parameters in the Set command or someother way where i can see the log... (2 Replies)
Discussion started by: mac4rfree
2 Replies

3. UNIX for Dummies Questions & Answers

Variable substitution to show up in ps and jobs.

when creating a for loop (or any other parameter) then using that paramter in a background command execution I only see the parameter name, not the value. I have tried eval and exec and a host of other options to try to get the text of the parameter showing, so i know what step is left... e.g.... (3 Replies)
Discussion started by: OoozyFoot
3 Replies

4. Shell Programming and Scripting

Making a script to copy files not seen before (using md5sum)

Hello, I would like to make a script that searches through a SRC folder and copies only files it's never seen before to a DEST folder. SRC = /user/.phonesync/photos-backup DST = /usr/.phonesync/photos-new So basically, I'd start with a: md5sum /user/.phonesync/photos-backup/* >... (29 Replies)
Discussion started by: nbsparks
29 Replies

5. UNIX for Dummies Questions & Answers

Variable inside command substitution

Hello people. Part of my script: SUBSETID=`echo $PMFILE |sed 's/pmresult_//' | sed 's/_*//'` MAPFILE=`find /huawei/cell /huawei/nodeb /huawei/rnc -name 'mapping_$SUBSETID.txt' |grep -v backup` Unfortunatelly variable $SUBSETID in the MAPFILE declaration will not return the... (3 Replies)
Discussion started by: drbiloukos
3 Replies

6. Shell Programming and Scripting

[Solved] Command Substitution and Variable Expansion within a Case

Hello All, I don't write scripts very often, and in this case I am stumped, although it may be a bug in the version of bash I have to use (it's not my system). I want to extract a specific string snippet from a block of text (coming from a log file) that is dependent on a bunch of other... (1 Reply)
Discussion started by: jaimielives
1 Replies

7. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

8. Shell Programming and Scripting

How to use variable with command substitution in variable

For example I have variable like below echo $OUTPUT /some/path/`uname -n` when I try to use the variable OUTPUT like below cd $OUTPUT or cd ${OUTPUT} I am getting bad substituion error message $ cd $OUTPUT ksh: cd: bad substitution $ cd ${OUTPUT} ksh: cd: bad substitution ... (1 Reply)
Discussion started by: rajukv
1 Replies

9. UNIX for Dummies Questions & Answers

sed insert command and variable expansion/command substitution

I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename? #!/bin/bash filename=`echo $0` /usr/bin/sed '/#include/ { i\ the filename is `$filename` }' $1 exit 0 (8 Replies)
Discussion started by: glev2005
8 Replies

10. Solaris

Can history commands show what time command executed

On Solaris 8 and 10 is there a way history command can show what time a particular command was executed. Pls reply. Thanks (2 Replies)
Discussion started by: Tirmazi
2 Replies
Login or Register to Ask a Question