Re: Display cmd within shell

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 11 Jun 2018 at 09:41, bruce <badouglas@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx/message/M6Z4Y72AVAVLEV2O46JE6LS7CPPTLCSI/
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux