LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-14-2007, 09:30 AM   #1
johnpaulodonnell
Member
 
Registered: Jun 2006
Location: Galway
Distribution: Suse 10.1
Posts: 114

Rep: Reputation: 15
tcsh read command?


Hi.

I'm writing a shell script using tcsh - I have no choice in the matter; I'm utilising GMT (Generic Mapping Tools) which only runs from csh/tcsh.

In bash the read command is simple.

I'm having a bit of difficulty with it's counterpart in tcsh...

What I'm tring to do is to assign the number of lines in a file to a variable var
Code:
@ var = (wc -l file | awk '{print $1}' )
the @ is the set equivalent for numerical characters

but tcsh doesn't like this...

so I try the long way around:

Code:
wc -l file | awk '{print $1}' > temp.file
**READ** var < temp.file
- but I don't know the tcsh read syntax. It's something like $< but that's all I can get...

Would appreciate any help
 
Old 06-16-2007, 02:55 AM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie stretch
Posts: 1,595

Rep: Reputation: 97
Hya,

I am having great difficulty understanding what you want. Can you describe what you want? Posting error message you get might be also helpful, but only when I know what you want to do.

Happy Penguns!
 
Old 07-13-2007, 08:53 AM   #3
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy jessie stretch
Posts: 1,595

Rep: Reputation: 97
Hi,

Is this what you want?
Code:
foreach a ("`wc -l *`")
@ b = `echo $a | tr -s ' ' | cut -f 1 -d ' '`
end
or
Code:
foreach a (`wc -l * | tr -s ' ' cut -f 2 -d ' '`)
@ b = a
end
Happy Penguins!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ESC+/ to search command history in tcsh wycolorado Linux - Newbie 1 06-30-2006 05:20 AM
ESC+/ to search command history in tcsh wycolorado Linux - General 0 06-28-2006 07:43 PM
Read command. unreal128 Linux - Software 2 09-30-2005 01:44 PM
"at" command under tcsh on RHE 3.0 dudleyp Linux - Software 0 11-18-2003 02:42 AM
Question about read command thepryme Linux - Newbie 1 10-22-2003 02:38 PM


All times are GMT -5. The time now is 06:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration