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

Re: Using terminal output as input



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/14/09 15:55, Dotan Cohen wrote:
> I am using a Debian-based distro (Ubuntu). Often I need to use the
> output of one terminal command as the input for another. A classic
> example is the  which command:
> $ which firefox
> /usr/bin/firefox
> $
> 
> Now, I would like to use that output as input, to start firefox. Other
> than manually typing it in, is there a way for the user to use the
> output directly?

As well as all the other answers, you could pipe the output to bash.
This will work with any command where the command you want to run is the
only output displayed.

$ which firefox | bash


> Another example is when the OS lets the user know that she needs to
> install a program and gives her the command to install it:
> $ ekiga
> The program 'ekiga' is currently not installed.  You can install it by typing:
> sudo apt-get install ekiga
> bash: ekiga: command not found
> $
> 
> In contrast to the "which" example, the text that the user needs is
> buried in the output. Is there a way to use it anyway, without
> retyping (and without using the mouse, which I often do not have).
> Thanks!
> 
- -- 
Many thanks
Harry Rickards

- -----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT/GCM/GCS/GCC/GIT/GM d? s: a? C++++ UL++++ P- L+++ E--- W+++ N o K+
w--- O- M- V- PS+  PE Y+ PGP++ t 5 X R tv-- b+++ DI D---- G e* h! !r y?
- ------END GEEK CODE BLOCK------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkoMO9EACgkQ1kZz3mRu0GrfKwCfS7dYeOjRBNErbbgKDBFinLwe
IYwAoJguSFX/h5ZJzE5mWDIs2OfQVWqu
=UDyI
-----END PGP SIGNATURE-----


Reply to: