![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DB Solo 3.0 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-26-2008 04:00 PM |
| DB Solo 3.0 Beta 1 (Default branch) | iBot | Software Releases - RSS News | 0 | 01-22-2008 09:10 PM |
| script works on command line, not in cron job | JackTheTripper | UNIX for Dummies Questions & Answers | 7 | 06-27-2007 02:51 AM |
| works from cmd-line but not in script | OFFSIHR | Shell Programming and Scripting | 4 | 10-18-2006 09:41 AM |
| Appending line with sed works on Linux but not on Solaris | nir_s | Shell Programming and Scripting | 4 | 08-11-2005 04:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Line works in solo but not in program?
Now I am just getting frustrated and confused... if anyone has some advice on how this anomoly is occurring I would greatly appreciate it. Code:
cat helpme.txt | awk 'NR<5{printf("%-20s %-20d %-20d %-20.1f\n","hello",$1,$2,$3)}' | sort -rk4
This line works fine in solo - reads the three fields from helpme.txt and adds a first field "hello" before the others on output... seems simple enough and it works fine on its own on the command line. In a small program it doesn't work... Code:
#!/bin/sh
echo "Please enter the file you want compressed: \c"; read filename
echo File: $filename
# check to see file exists and is readable with -r
if [ -r $filename ]
then
echo gzip | gzip -f $filename; gunzip -l $filename.gz > $filename.txt; gunzip $filename
gzip -f rose.bmp; gunzip -l rose.bmp.gz >> $filename.txt; gunzip rose.bmp.gz
cat helpme.txt | awk 'NR<5{printf("%-20s %-20d %-20d %-20.1f\n","hello",$1,$2,$3)}' | sort -rk4
else
echo sorry the file does not exist or is not readable
fi
So at this point I am thinking magic? And yes with only the three fields in the short program it does work fine. |
|
||||
|
The default is csh and the program runs sh - c shell and bourne shell
I'm beginning to wonder if I've somehow done something to my shell - one can change shell behaviour? Its just I use vpn to access the uni UNIX account and today I saw the same code operate correctly on the same UNIX environment while not in my account. Does this make sense to anyone? |
|
|||||
|
You mean same code doesn't work when you come thru VPN with same account, and it works with same account when you are directly connected to your network?
If code works with one account and doesn't work with other account, check login files for your csh, good luck. |
|
||||
|
sorry i meant the code works on the sys admin computer on the same unix system at the uni... but isn't working on my account.
I think I need to get them to set up a new account for me which works correctly. Thanks for the help. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|