On 11Jun2018 14:02, Gordon Messmer <gordon.mess...@gmail.com> wrote:
On 06/11/2018 05:40 AM, bruce wrote:
#-- this doesn't quite work.. as it generates the complete "ls...
output" but it does display the cmd and the resulting num of the ls
files..
(set -x; ls -al /cloud_nfs_parse/austincc*__parse.dat | wc -l )

Bash doesn't have a mode in which it echos a command before expansion and substitution occur, as far as I know.  The command you're seeing, with the wildcard expanded, is the command that bash is actually executing.

The shell has long had a -v option which echoes commands as they are read. Note that this is in the parse step, so:

- you see the command before expansion
- you see whole compond commands _once_ as they are encountered, not as they are executed

Personally I like "set -x". I've even got a tiny line script called "set-x" which goes:

 #!/bin/sh
 set -x
 exec "$@"

and many scripts which do variants on:

 trace=
 [ -t 2 ] && trace=set-x   # at least during development
 ...
 $trace important command here ...
 ...

For proper utility scripts I tend to add a -x option to explicitly turn it on, and -n to set it to "eecho", another tiny script which goes:

 #!/bin/sh
 echo "$*" >&2

which gets you do-nothing tracing mode, 90% of what a -n needs.

Cheers,
Cameron Simpson <c...@cskk.id.au>
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org/message/3ZWMWDL4QPE2VND66IPMGAZ45NPPTFHX/

Reply via email to