The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-17-2002
artur80 artur80 is offline
Registered User
  
 

Join Date: Nov 2002
Posts: 2
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
  #2 (permalink)  
Old 11-17-2002
mntamago mntamago is offline
Registered User
  
 

Join Date: Mar 2002
Location: Japan
Posts: 8
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.
  #3 (permalink)  
Old 11-17-2002
artur80 artur80 is offline
Registered User
  
 

Join Date: Nov 2002
Posts: 2
Lightbulb

Thanks a bunch, worked like a charm!
Art
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0