Re: stupid bash tricks (how to loop on the command line)

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

 



jbest@xxxxxxxxxxxxx wrote:
----- Original Message -----
From: aragonx@xxxxxxxxxx
Date: Thursday, November 8, 2007 11:45
Subject: stupid bash tricks (how to loop on the command line)
To: fedora-list@xxxxxxxxxx

  
Okay, I saw a neat trick at work the other day.  A coworker 
somehow got
the shell to do looping without creating a file.  I believe 
he was using
csh to do so and I was wondering if I could do the same thing in 
bash. 
Basically I would like to be able to do a while loop to execute 
a df
command.

Any ideas?


    

almost any shell command sequence can be executed on the command line... consider the following..
while true; do df; sleep 3; done;

just a matter of separating the command elements with ;'s 
  
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

    

  
Actually, if you just want to loop some command, you can use the command watch as well.
Like so:

watch -n3 df

Saves writing/typing bash-scripts :)
-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux