Re: Display cmd within shell

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

 




> On Jun 11, 2018, at 4:02 PM, Gordon Messmer <gordon.messmer@xxxxxxxxx> 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.
> _______________________________________________

It’s an option of the builtin set command.  

set …
… When  options  are  specified,  they set or unset shell attributes. ….
-v      Print shell input lines as they are read.
-x      After expanding each simple command, for command, case  command, select command, or arithmetic for command, display the expanded value

Alternatively:
set -o option-name
     verbose Same as -v.
     xtrace  Same as -x.

See the bash man page for all set command options (and loads of other info).

Note that:
* using + rather than - causes these options to be turned off. 
* the options can be specified when invoking the shell.  For example in Bruce’s script, we could use:

#!/bin/sh -v
OR
#!/bin/sh -x
OR
#!/bin/sh -xv
etc

Bev in TX



_______________________________________________
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/OKKYJTSTUGZLO5QCMQEDNN2UUQKKF6NY/



[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