Script issues


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script issues
# 1  
Old 08-18-2011
Script issues

Code:
#!/bin/bash

glist=`cat /etc/group | cut -d ":" -f1,4`
ulist=`cat /etc/passwd | cut -d ":" -f1,6`

for i in $glist
do
 echo "$glist"

done

for i in $ulist
do
 echo "$ulist"

done

chkgrp=`cat /etc/group | cut -d ":" -f1`
for a in chkgrp
do
if ["$a" =="$1"]
 then
 echo "group exist"

i manged to get the script running and now i`m getting this error massage. "-bash: ./600: line 24: syntax error: unexpected end of file"

Moderator's Comments:
Mod Comment Please use code tags, thanks.

Last edited by zaxxon; 08-18-2011 at 05:16 AM.. Reason: code tags
# 2  
Old 08-18-2011
"If" condition needs to be closed with "fi". try this
Code:
if ["$a" =="$1"]
then
echo "group exist"
fi

# 3  
Old 08-18-2011
thanks but i`m still getting the same error.
# 4  
Old 08-18-2011
Put set -x in second line after #!/bin/bash and post the complete output, thanks. Use code tags, thanks.

Last edited by zaxxon; 08-18-2011 at 05:39 AM.. Reason: typo
# 5  
Old 08-18-2011
Quote:
Originally Posted by mduduzi
thanks but i`m still getting the same error.
You would need spaces left around square brackets..
Code:
if [ "$a" == "$1" ]
then
        echo "group exist"
fi

This User Gave Thanks to michaelrozar17 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issues with Expect Script

Hi, does the expect script tries to match for everyline on the screen irrespective of the prompts??? spawn ./Inst.sh expect "path? (Y/N)" send "Y\r" expect "folder path" send "$DIR1\r" expect "path? (Y/N)" send "Y\r" expect "folder path2" send "$DIR2\r" After the installer... (11 Replies)
Discussion started by: premseth
11 Replies

2. Programming

Python Script Issues

Gents, This is a follow up to my previous post: https://www.unix.com/shell-programming-scripting/217521-python-newbie-question-regex.html Here the latest function that I am having issues with: def find_all_flvs(url): soup = BeautifulSoup(urllib2.urlopen(url)) flvs = for... (2 Replies)
Discussion started by: metallica1973
2 Replies

3. Shell Programming and Scripting

Issues running an awk script

Hi, I have an awk script(test.awk) as below which I am trying to execute through the following command and I am getting error as follows. Request your valid inputs on where I am going wrong. Thanks. :/usr/chandra# awk -f test.awk input.txt syntax error The source line is 1. The error... (18 Replies)
Discussion started by: adept
18 Replies

4. Shell Programming and Scripting

Bash Script issues

So what i am trying to do is write a script that takes in any number of scrambeled words and unscrambles them. I have already addressed the issues of partial matches, exits silently if there are no matches, and finds words regardless of case that they were input. but while trying to get it so... (3 Replies)
Discussion started by: alindner
3 Replies

5. Shell Programming and Scripting

Bash script issues

Hi. The below part of my bash script kicks out the following error message: $ ./extract_eod_report_stats_new.sh 2010-04-23 ./extract_eod_report_stats_new.sh: line 204: syntax error near unexpected token `(' ./extract_eod_report_stats_new.sh: line 204: `TRANSACTIONS_RECEIVED_TOP=`grep... (6 Replies)
Discussion started by: Peter.Lovell
6 Replies

6. UNIX for Dummies Questions & Answers

Issues with cronjob : Script using sendmail

Hi All, I am new to unix. I have created a cron job, that sends mail using sendmail utility. Am facing a unique problem while making a cron job for this script. In the script I append a file to my mail using 'cat' command. cat $report >> $mailMsg & this $mailMsg is used as mail... (7 Replies)
Discussion started by: anshulporwal
7 Replies

7. Shell Programming and Scripting

Script Help - Syntax Issues

I have the last portion of an Open Step ping server shell script that is giving me issues that I need to adapt to Ubuntu 8.10 Client flavor of Unix. Can someone see what is wrong with the following: # if there are servers that just went down or came back up, notify # with high importance if ;... (3 Replies)
Discussion started by: gbxfan
3 Replies

8. Shell Programming and Scripting

Telnet Script Issues

HI All Some body wrote to me this Telnet Script : #!/opt/perl/bin/perl $ip = $ARGV; die ("IP must be passed as an argument. $!\n") unless defined($ip); use Net::Telnet (); $handle = new Net::Telnet (Timeout => 10, Prompt => '/.*(#|>|\))\s*$/'); $handle->open("$ip");... (10 Replies)
Discussion started by: Darknight
10 Replies

9. UNIX for Dummies Questions & Answers

shell script programming issues

I'm having trouble running this script. I'm new to Unix so be kind please. #!/bin/sh # Test to make sure only a single parameter is passed from the # command line. if then echo "Usage: AC.sh <directory>" exit fi # Is the parameter a directory test if then echo... (3 Replies)
Discussion started by: FSUdude08
3 Replies

10. Shell Programming and Scripting

SFTP / UNZIP script issues

Hi everyone, i'm having a little trouble wih my first shell script ever. So the point of that script is to: -Archive Zip files in a directory -Remove txt files from that directory -connect through sftp and a rsa key to a remote server -download a couple of files -unzip downloaded files ... (0 Replies)
Discussion started by: Peanutz
0 Replies
Login or Register to Ask a Question