Walt Mankowski on 23 Dec 2009 08:52:54 -0800 |
On Wed, Dec 23, 2009 at 07:52:25AM -0500, Matt Mossholder wrote: > On Wed, Dec 23, 2009 at 7:45 AM, Casey Bralla <MailList@nerdworld.org>wrote: > > > I've written a bash script and I find that the commands don't normally echo > > to > > the screen, so I can't follow along with the script. > > > > for example: > > > > #!/bin/bash > > cp file1 file2 > > mkdir /directory1 > > cd /directory1 > > rm * > > cd .. > > > > > > > > > > > > > > I'd like to know when the script is copying files, and when it is erasing > > files. > > > > I could add echo statements, but it would be much simpler if the actual > > bash > > commands simply echoed to the screen. > > > > Is there a simple way to do this? > > > > > > TIA JP! > > > > > Add "-x" after your bash command-line at the top of the script. This will > make it echo each statement as it is run. You can also use "set -x" and "set +x" to turn echoing on and off in the middle of your script. Walt Attachment:
signature.asc ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|