Strange thing with 'cut' in a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Strange thing with 'cut' in a script
# 1  
Old 04-02-2009
Question Strange thing with 'cut' in a script

When I run the script I have just created, I get a strange scenario around the following code:
echo "Check for duplicate UID's, each user should have a unique user ID (UID)"
echo "IF a UID is displayed fix or document why it is required!"
echo "Press enter to continue!"
read a
cut -d: -f3 /etc/passwd | sort -n | uniq -d
echo
echo "Verify current directory (.) does not exist in root's PATH!"

after going through most of the script and using the 'read a' as a pausing mechanism, when I hit enter at the above point instead of getting the correct value returned from the cut line, it just sits at a cursor, and hangs; it just adds a line for everytime you hit return. Now if I take the 'read a ' out at this point and just let it run right through the string works as it is supposed to. Can anyone see why it would behave in this fashion?
# 2  
Old 04-02-2009
Very strange! It's almost as if your tty settings aren't correct and return is being seen as a line feed only. Try running the script with the -x option to echo what's going on or even truss it.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using :<<cut / cut to comment out block of bash script

I am using : << cut / cut to comment out block of code. Works fine on few lines of script, then it gives me this cryptic error when I try to comment out about 80 lines. The "warning " is at last line of script. done < results 169 echo "END read all positioning parameters" 170... (8 Replies)
Discussion started by: annacreek
8 Replies

2. Shell Programming and Scripting

Strange Script behaviour with Grep

Here is my script LOGDATE=`date '+%Y-%m-%d %k:%M' | cut -c1-15` echo $LOGDATE echo "grep '$LOGDATE' /tmp/logs/vel.log >10min_log" grep '$LOGDATE' /tmp/logs/vel.log>10min_log grep '$LOGDATE' /tmp/logs/vel.logHere is the output of the script -rw-r--r-- 1 wluser wluser 0 May 3... (7 Replies)
Discussion started by: mohtashims
7 Replies

3. Windows & DOS: Issues & Discussions

Strange thing: arp and windows

A strange situation: i have configured a piranha lvs router(two load balancer and two real servers), the virtual ip is 192.168.3.252. Linux and windows clients are on a different subnet (192.168.3.0) and i use route route add -net 192.168.3.0/24 dev eth0on linux for /F "tokens=2 delims=:"... (3 Replies)
Discussion started by: Linusolaradm1
3 Replies

4. Solaris

Strange thing with solaris ls on nfs shared directory

I shared from linux server a dir with nfs3,solaris mount ok,and can tar files,but if i do ls or cp.. on mnt i have mount the nfs share root@solaris: mnt $ touch 2 root@solaris: mnt $ ls -lh ls: can't read ACL on .: Permission denied root@solaris: mnt $ ls 1.tar 2 root@solaris: mnt $ cp... (4 Replies)
Discussion started by: Linusolaradm1
4 Replies

5. Shell Programming and Scripting

Strange "cut" command's behaviour

Hi, Suppose if I have a file having data like this: $ cat file.txt A B C D And, if I do a cut operation like this: $ cut -d" " -f2 file.txt The output is A C D This is the same for even if we try to get the field 3 with -f3 (assume line 2 has 3 fields : C E F). The above... (1 Reply)
Discussion started by: royalibrahim
1 Replies

6. Shell Programming and Scripting

Expect script strange behaviour

Hi people, I'm having some strange behaviour with an 'expect' script. spawn csession blah expect "Username: " send "userblah\r" expect "Password: " send "passwordblah\r" interact When I execute the script as root it runs perfectly. However, when executed as any other... (0 Replies)
Discussion started by: GarciasMuffin
0 Replies

7. Shell Programming and Scripting

shell script which will delete every thing under a directory except a single sub dire

write a shell script which will delete every thing under a directory except a single sub directory (2 Replies)
Discussion started by: alokjyotibal
2 Replies

8. Shell Programming and Scripting

Strange behaviour from script in crontab

Apologies if this has been mentioned elsewhere, my search skills may be lacking somewhat today. I have a script that does the following (as a test): find . -name "*.txt" -exec file {} \; >>$sFullFilePath Now, the variable is set up up correctly in the script too. When I run the script... (1 Reply)
Discussion started by: PilotGoose
1 Replies

9. Shell Programming and Scripting

Perl script strange problem

Hi All, I have one strange problem in perl script. Bellow is the contents of the script i am trying to write: #!/usr/local/bin/perl my $module_list = ''; my @running_module; my $count=0; my $flag=0; my $ccprojecthome=$ENV{CCPROJECTHOME}; @module_list = `cat... (2 Replies)
Discussion started by: vaibhav
2 Replies
Login or Register to Ask a Question