Newbee lost in unix land


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Newbee lost in unix land
# 1  
Old 05-12-2008
Newbee lost in unix land

I am writing a shell script and I am calling wc -l. I need to assign the results of this call to a varaible and it's not working the way I think it should:

xx= wc -l $1

What am I doing wrong?


Thanx
# 2  
Old 05-12-2008
Well, if you want the results of this call to be assigned to the variable, you shoud use the "command substitution" operator, which is the backquote " ` ". Note that it's not " ' ".
Also, when assigning values to variables, you should use "=" without spaces before and after.
So, it would be:
Code:
xx=`wc -l $1`

Have fun!
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help needed - Newbee here

I am very new to shell scripting. please help me in this scenario. when we run the script, It should ask user to enter the input (for example, ticket number like below) B1234567 B2345678 C1245782 . 2. Once user enter the input or,paste the input, the script should check each and every... (1 Reply)
Discussion started by: Padmanabhan
1 Replies

2. Virtualization and Cloud Computing

No Brave Bot Hunters in CEP Land?

Tim Bass 12-18-2008 03:43 AM In August of this year, we issued the challenge,* The Bot Hunter: An Event Processing Challenge (Bot or Not). Not surprisingly, none of the “self-described CEP vendors” with grand claims of CEP greatness, responded.* Real-time detection of threats and opportunities,... (0 Replies)
Discussion started by: Linux Bot
0 Replies

3. HP-UX

Lost both Unix Admin's ....need help

Hi all, I know nothing about unix. Both of our unix guys left for greener pastures. I have been given the task of tring to get 10,000 accounts on a hp ux system into active directory. The accounts don't need to be moved, but they need to be in active directory for a couple of applications. Even if... (0 Replies)
Discussion started by: Bob D
0 Replies

4. UNIX for Dummies Questions & Answers

Unix Newbee :-)

Hi , i have jus started learning basics of unix .I have few queries : 1) what is meant by unix box server? 2) what is the difference between unix and linux (is it jus x-windows graphical system or is there anything more than that?) 3) Can i get any free download of unix so that i cud... (7 Replies)
Discussion started by: vivekshankar
7 Replies

5. UNIX for Dummies Questions & Answers

Connection Lost from Unix Server....

This morning I was working by Xwindow to my unix server (hp-ux, 11 version), without any problem but this afteernoon, the connections was refused, and triying to connect using telnet, sometimes I can establish the connection and refuses me in a minute, the error message that appears is "your... (1 Reply)
Discussion started by: fvicente
1 Replies

6. UNIX for Dummies Questions & Answers

newbee - copy data from UNIX to Linux

I have to setup a new server (linux) and I have to copy the data from the old unix system to the new one. Can I access the unix data in dos? Please help. I know little about linux and unix (3 Replies)
Discussion started by: steven5046
3 Replies
Login or Register to Ask a Question