Echo out running commands | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Unix/Linux Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Echo out running commands

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-12-2013
ronron5477 ronron5477 is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 12 March 2013, 9:47 AM EDT
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Wrench Echo out running commands

Is there any way in a script to print out the commands being ran? In DOS script, there is the "@echo on" and "@echo off".

so I have a script like this:

Code:
#!/bin/ksh

echo "hello there.  moving files."
<turn on echoing here>
cp thisfile.txt thatfile.txt
cp whatfile.prop whyfile.prop
<turn off echoing here>
echo "Done"

So basically, I want to print out the copy lines so the user sees what's going on.
Sponsored Links
    #2  
Old Unix and Linux 03-12-2013
rbatte1 rbatte1 is offline Forum Staff  
Moderator
 
Join Date: Jun 2007
Last Activity: 27 March 2015, 12:34 PM EDT
Location: Lancashire, UK
Posts: 2,164
Thanks: 706
Thanked 386 Times in 345 Posts
To turn on tracing
Code:
set -x

To turn off tracing
Code:
set +x


Is this all you are after?




Robin
Liverpool/Blackburn
UK
The Following User Says Thank You to rbatte1 For This Useful Post:
ronron5477 (03-12-2013)
Sponsored Links
    #3  
Old Unix and Linux 03-12-2013
ronron5477 ronron5477 is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 12 March 2013, 9:47 AM EDT
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
EXCELLENT! That's what I needed. Thank you!
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
echo and grep commands Sundown Shell Programming and Scripting 2 02-10-2012 12:25 AM
Having a hard time with the sed/echo commands? arcelivez UNIX for Dummies Questions & Answers 8 03-13-2011 12:58 PM
Advice using cut & echo combination commands dc18 Shell Programming and Scripting 6 07-27-2010 09:52 PM
SSH, Remote Commands and echo, oh my! Wrathe Shell Programming and Scripting 12 07-22-2009 08:29 PM
Running two commands in one line rdns UNIX for Dummies Questions & Answers 4 04-27-2009 11:04 AM



All times are GMT -4. The time now is 02:49 PM.