Hi guys here i'm again with more question
The code below try to find an user and write everything about him if exist, so my problem appear on line of test, where the program test if the user has secondary groups related. The rest it's clear
Moderator's Comments:
Please view this code tag video for how to use code tags when posting code and data.
You don't need to run ID 5 times to get 5 different pieces of data from it. Run it once, get all the data from it the first time.
You are using single quotes, which take their contents literally, where you need backticks, which run their contents. But you don't even need that statement.
You don't need to do \( all the time, just use quotes. Variables will expand inside double-quotes, even, so you don't need to end the quotes to use a variable.
Whenever you're doing if [ `... | wc -l` -gt somevalue ] to check something, you've probably missed a simpler way. Here, since I've overwritten the $1 ... arguments, I use the special "$#" variable, the number of arguments instead.
Last edited by Corona688; 09-04-2012 at 02:13 PM..
@Newer
Also please refrain from naming all your threads "Help with commands" as this will not help much when people browse or search for topics. Be a tad more inventive and descriptive. I have altered your thread's subject. Thanks.
I'm calling the following if-else from nawk. But I keep getting an error at the "else". I've tried putting more brackets and ; but still I get complaints about the "else".
Any ideas ?
Thanks,
wbrunc
BEGIN { FS = "," ; OFS = "," }
{ if ( $8 ~ /A/ && $9 == B )
$1="4/29/2013" ;
$2="J.Doe"... (2 Replies)
Dears ,
kindly I wanna do test for one KSH script to know how is it working , the problem that I'm facing is whenever put "sh -x ./my_script.sh"
the output seems very long & although I tried to to redirect it to files as it shown , but it failed :eek: :-
sh -x ./my_script.sh >... (2 Replies)
Using korn shell. I am reading a file line by line. If a record has a carriage return (octal 015) then I append the second record to the first record. Not all records have a carriage return. I have the unix shell script working with grep, but when my file has +100,000 records it runs slow. I would... (3 Replies)
Hi,
I have following K script, that is in rc0.d directory to be run on shutdown. It's linked using the 'ln' command to init.d.Can anyone tell me as to why it's not running, or if i have incorrect syntax?I get:
"test: argument expected
type=uname -p
+ "
When running it with sh -x
... (8 Replies)
This is the code:
while test 1 -eq 1
do
read a
$a
if test $a = stop
then
break
fi
done
I read a command on every loop an execute it.
I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test.
For example echo hello.
Now the... (1 Reply)
Hi
what's the correct way of writing if
1)if "$time_diff" -gt 5
then
echo "killing hung process \n"
fi
2)if test $time_diff -gt 5
then
echo "killing hung process \n"
fi
where -time_diff=$(($Sam - $current_min))
and current_min=`date +%M`
infact both are giving Syntax... (1 Reply)
Hi All,
can some one figure out the syntax issue here. How to overcome this?
#!/bin/sh
$ HFR_MAIL=NO
$ PRP_MAIL=NO
$ MC_MAIL=NO
$ if && && ]; then
> echo "NO "
> else
> echo "YES"
> fi
test: unknown operator NO
$ if && && ]; then
> echo "NO"
> else
> echo "YES"
>... (4 Replies)
dear friends,
I have a large size file containg two fields data
like this
*** ****
122 222
***** *****
***** *****
232 233
i have file like this.
i want to remove blank lines from file .
i think awk is servive this problem
i wrote a awk command but the error is... (3 Replies)
Hi I have the following script and have problem debugging the problems. The function of this script is to make sure the entire file is being received (the filesize of a data is not changing after 20 seconds) and start moving the file to another directory. This script should be started every 30mins.... (5 Replies)