Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read lines from script and add "echo" to it 3

Status
Not open for further replies.

TSch

Technical User
Jul 12, 2001
557
DE
Hi folks,

I'd like to create a little script that reads the lines from another script, changes them and writes them into a new file.

Something like that:

Sourcefile
----------
read input
find / -name $input
uname -a

Destination file is supposed to look like this:
-----------------------------------------------
echo "read input"
read input
echo "find / -name $input"
find / -name $input
echo "uname -a"
uname -a


Okay, maybe this is not the most elegant way to accomplish what I want, but it is the only way I can think of right now.

The goal is to change a script to echo the line that is being executed so that I can see where it hangs. I have a script that won't finish but is not giving me any errors and it's got way too many lines to change them all manually.

Any ideas what i could do here ?

Regards
Thomas
 
Run the script with [tt]ksh -v /path/to/script[/tt], and you'll accomplish the same...


HTH,

p5wizard
 
sometimes [tt]ksh -x[/tt] helps also

Or add

[tt]set -x
set -v[/tt]

in the beginning of your script...



HTH,

p5wizard
 
And for set -x
add:
export PS4='${LINENO}:'
to see the line number that is executed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top