Computing.Net > Forums > Unix > Redirection of output in variable

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Redirection of output in variable

Reply to Message Icon

Name: jbeaudoi
Date: March 31, 2005 at 19:42:16 Pacific
OS: Win XP
CPU/Ram: 1024
Comment:

Is it possible to redirect STDOUT to a var ?
Like :
cat FILE > var

Thanks.

Regards,

Jean-Philippe Beaudoin



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: April 1, 2005 at 08:47:22 Pacific
Reply:

You are redirecting STDOUT, but the example above creates another file called var.

If you want to set the contents of a file to a varible, do something like this:

#!/bin/ksh

var=$(cat -s FILE)
echo $var



0

Response Number 2
Name: jbeaudoi
Date: April 3, 2005 at 23:30:48 Pacific
Reply:

Thanks again Nails !
Worked a treat.

Regards,

Jean-Philippe Beaudoin


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Page Count in UNIX help with awk



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Redirection of output in variable

Redirecting the output of a PL/SQL www.computing.net/answers/unix/redirecting-the-output-of-a-plsql-/8224.html

Usage of sed in unix www.computing.net/answers/unix/usage-of-sed-in-unix/8424.html

fraction of seconds in unix www.computing.net/answers/unix/fraction-of-seconds-in-unix/3608.html