On Mon, 11 Jun 2018 at 09:41, bruce <badoug...@gmail.com> wrote:

> Hi.
>
> Running a centos/fed box, and trying to craft a simple shell test to
> run a bunch of commands where the command is displayed as well as the
> output
>
> Ie. The following cmd might return 10 (the num of the files if the cmd
> is run from the cmdline.
>
> ls -al /cloud_nfs_parse/austincc*__parse.dat | wc -l
> 10
>
> However I can't seem to figure out how to run the cmd from within a
> shell script where I can display the "cmd" as well as the result.
>
> #!/bin/sh
>
> ##
> #cp.sh
> #
> # run as a test from the nfs /cloud_nfs_parse to gen the num of parse.dat
> files
> #    from the bn crawl
> #
> #
>
> #-- 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 )
> exit
>
>
> Thoughts/comments??
>

The "ls" output is really just the command-line after shell
expansion has been done.  Is this  what you want?

$ cat t3.sh && ./t3.sh
#! /bin/sh
set -v
ls -al ? | wc -l


ls -al ? | wc -l
3

-- 
George N. White III
_______________________________________________
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/M6Z4Y72AVAVLEV2O46JE6LS7CPPTLCSI/

Reply via email to