CSH missing - problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CSH missing - problem
# 1  
Old 10-24-2011
CSH missing - problem

Hi all,

i need help with this code

Code:
set login = (`cut -d ":" -f1 /etc/passwd.2001`)
set group = (`cut -d ":" -f4 /etc/passwd.2001`)
set name = (`cut -d ":" -f5 /etc/passwd.2001 | cut -d ":" -f1`)

set i = 1

while ($#login > 0)
    set pom = `last $login[1] | wc -l`
    if ($pom < 3) then
        echo "Output: '$login[1] $group[i] $name[i]'"
        i ++
    endif
    shift login
end

when i run this i get a message
Code:
Missing -.

Any idea what is wrong? Im using C shell.
Thanks.
# 2  
Old 10-24-2011
Code:
...
echo "Output: '$login[1] $group[$i] $name[$i]'"
...
@ i = $i + 1
...

--ahamed

Last edited by ahamed101; 10-24-2011 at 10:55 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Csh variable calling problem

First post on here. So I use csh shells for my research (physics... not a CS person). I am trying to rerun the same scripts, but there are ~10 files that have similar variables that I have to change for each different configuration, so I would like one central file for the variables I change that... (3 Replies)
Discussion started by: sabrepride
3 Replies

2. UNIX for Dummies Questions & Answers

Problem with simple csh scripting

I found my answer... (2 Replies)
Discussion started by: sjung9442
2 Replies

3. Shell Programming and Scripting

Execution problem with csh script

Hi All, I have a small issue with my csh script which I am using to FTP a file. What I know is...there are two commands to execute script.. 'sh <file>' & '\<file>'. When I execute my script with command 'sh <file>', it gives me syntax error while it runs successfully with command '\<file>'. I am... (3 Replies)
Discussion started by: ndd
3 Replies

4. Shell Programming and Scripting

csh array missing some elements

I'm having a problem with this bit of my script. '/tmp/data' contains the output of 'ls -l', and I'm assigning a couple of the columns to an array. The problem is that it line starts on the third line of 'ls -l' rather than the first one. @ count = 7 set line = `cat /tmp/data` while ($count... (1 Reply)
Discussion started by: tkirk
1 Replies

5. Shell Programming and Scripting

Missing ] error in csh script

The below script gives error: Missing ] #!/bin/csh set MAX=15 set PATTERN='dtsession' set NUM=`ps -eaf | grep -c $PATTERN` echo "No of dtsession = "$NUM if then echo 'Quota exceeded permissible limit' echo 'sending mail...............' mail hiten.r.chauhan@gmail.com<<EOF ... (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies

6. Shell Programming and Scripting

Problem with endsw in csh

I am getting an error and can't figure out the problem breaksw: endsw not found. Problem has been solved now (0 Replies)
Discussion started by: kristinu
0 Replies

7. Shell Programming and Scripting

${name${i}} problem in CSH

Hello all, I tried the following commands in the cshell, but failed. ~Cshell %set i=2 ~Cshell %set fields${i}= ( ad dd dd ) ~Cshell %echo $fields${i} fields: Undefined variable. ~Cshell %echo ${fields${i}} Missing }. And i can see the $fields2 is already set as a local variable... (0 Replies)
Discussion started by: tpltp
0 Replies

8. Shell Programming and Scripting

Problem with csh script

Hi All, I have the following script. #!/bin/csh # # createDATfile.sh # cd /export/home/fastserv/bin source /export/home/fastserv/bin/dbenv.sh echo `date` >> /export/home/fastserv/bin/log.txt echo "%INF% Starting send of current FASTSERVICE batch" >>... (4 Replies)
Discussion started by: rahulrathod
4 Replies

9. Shell Programming and Scripting

csh problem with while

Hello this my first post, so i hope you help me echo -n "Choose which square you want to hit of PL2 grid " set pl2_square = $< set i = 1 while ($i <= 6) if ($pl2_square == $pl2_ships) then $pl2_ships = x echo "" echo "" echo "PL1 has hitted a square of PL2" echo... (5 Replies)
Discussion started by: amaj1407
5 Replies

10. Shell Programming and Scripting

Problem accessing csh ?? (Newbie)

Hi All, Just recently started using a program in Unix for a client. I was sent a script to use but for some reason it's not working. The person who created the script first suggested I may need to edit the first line of the script so that it has the correct path for the csh file: #!/bin/csh -f... (3 Replies)
Discussion started by: gmalt
3 Replies
Login or Register to Ask a Question