Thanks, Bill.
I am constantly amazed at the knowledge displayed on this list.
Following is one of my recent questions, and the response Bill Jonas wrote:
My question was:
> > Is there an efficient syntax to string commands so I could do a 'diff'
> > on these two listings (without listing each to a file to compare files)
> > to see what the two additional files are?
Bill answered:
> With bash and some others:
>
> diff <(ls -a ~) <(ls -A ~)
>
> The <() syntax is called "command substitution". It basically gives a
> filehandle on the output of the command you have inside. You can think
> of it as similar to a pipe, except it's for commands that don't accept
> data on their standard input. For fun, you can try "file -s <(df -h)"
> (or any other command instead of df) and note the results. (Results may
> differ on different distributions, but "fd" is short for "file
> descriptor".)
===================================
The following may be of interest to someone:
Solutions like this one Bill provided are valuable to save for
future reference. This is how I save and recall solutions like this:
Over the last 20+ years, I have saved hundreds of solutions that
I have learned (and continue to learn) in a file on my system named
"commands" ... with each solution summarized on a single line.
A long time ago, a friend helped me to construct a little shell script
utility that gives me quick access to recall solutions like this ...
(as well as for dozens of additional uses for this utility).
Originally, I had called this utility 'zip' but since someone else
came along and created the compression utility using that name,
I changed the name to 'jig' or just 'j' ...
It can be invoked in various ways, just by typing: j filename
or in a specific application by giving it its own unique name:
In this case, this is how it works:
On the command line, I just type the word "commands"
and the following prompt appears:
commands >>>
At this point, a variety of options are available, all of which
are invoked by a single hot-key. If I need a reminder of what
function each key invokes, I can just press <ENTER> and a
one-line list of a few of the basic options is displayed.
One option is to "select" and for this, I just hit the "s" key.
In response, I see:
Select what?
The prompt waits for my input. I can then type any word
or string of words that seems appropriate (this invokes 'grep').
In this case, I might enter the word: compare
with the following result:
diff <(ls -a ~) <(ls -A ~) <E> compare the difference between two file lists
Here are just a few of the other one-liners in my commands list:
The <E> indicates press <ENTER> and separates the command
from the very brief summary description. Some of these commands
call other shell scripts that perform various functions.
cdrecord -scanbus <E> Displays CDR device information
cdrecord -v speed=2 dev=0,0 filename.iso <E> To burn a live distro.
more /var/log/messages <E> Displays system info details
grep ttyS /var/log/dmesg <E> Test to see if serial port is working
gcc filename.c <E> compile c program
jfind filename <E> To slocate a file in /home/joe/mydata only
lynx www.website.com <E> text only browser of named website
wget www.website.com <E> copies website html file to current folder
xpdf filename.pdf <E> pdf file viewer
jview file <E> open named file with .htm suffix w konqueror
pdf2htm file.pdf <E> converts a .pdf suffix file to .html suffix
chkconfig --list <E> Ck system config to see what services running
flush.khist <E> clears konqueror location toolbar history
... and the list goes on ... and on ... and on ... ;))
While I have been content using this by popping open a terminal
emulator window to invoke this utility on the command line, I hope
to eventually develop a way of invoking this from a desktop or
start-line icon.
Joe@Actionline.com
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss