![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| after grep i want to redirect it to some variable | mail2sant | Shell Programming and Scripting | 2 | 04-07-2008 09:26 AM |
| redirect input from file? | bjornrud | UNIX for Dummies Questions & Answers | 1 | 03-09-2008 02:37 AM |
| Redirect to variable | MrAd | UNIX for Dummies Questions & Answers | 2 | 05-07-2007 04:18 PM |
| Redirect Output In Variable | ZINGARO | UNIX for Dummies Questions & Answers | 1 | 08-02-2006 06:56 AM |
| can you redirect multiple files for input? | Matrix_Prime | UNIX for Dummies Questions & Answers | 4 | 02-27-2005 07:07 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
please help: how to redirect input into a variable
I'm trying to write a simple script program (C shell). I have a problem redirecting input into a variable. Say I have a variable called J, and there is file called result which contains just some number, say 5. Which command should I use to assign J value 5 from the file result. I tried the following commands:
set J = $<result set J = $<cat result set J < result and neither of these works. Please advise if you know the right commands, thanks ![]() |
|
||||
|
You could use the following:
set J=`cat in.txt` echo $J I tried this with only one line in the file "in.txt", so I do not know how this works when you have multiple lines. BTW the ` is not a single quote, but something that only looks like it. On my key board I find this character next to my "p" key. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|