09-17-2012
Could you please post your full script please?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am new to unix. Is their a way to pass the output of the line below to a variable var1.
ls -1t | head -1.
I am trying something like var1=ls -1t | head -1, but I get error.
Situation is: I get file everyday through FTP in my unix box. I have to write a script that picks up first... (1 Reply)
Discussion started by: rkumar28
1 Replies
2. Shell Programming and Scripting
I fairly new to SED. I have tried many different variations of this line of code and even breaking it down into its components and running them separately.
They work individually without variables but when I place the $todbname variable it will either inserts the text "connect to $todbname"... (3 Replies)
Discussion started by: edewerth
3 Replies
3. Shell Programming and Scripting
hi,
dataParse(){
line="$@"
name="cat /etc/passwd | grep "$line": | cut -f6 -d':'"
eval $name > sam.txt 2>&1
sudo -u $line sed -n 's/data-1/&/p' $name/test.xml >> sam1.txt
}
Here i getting the homedir of the accounts and is set in
name variable.which returns "/home/raju" which i... (3 Replies)
Discussion started by: sachin.tendulka
3 Replies
4. Shell Programming and Scripting
Hi,
I have a situation where I have to specify a different value to an awk command, I beleive i have the gist of this done, however I am not able to get this correct. Here is what I have so far
echo $id
065859555
This value occurs in a "pipe" delimited file in postition 8. Hence I would... (1 Reply)
Discussion started by: jerardfjay
1 Replies
5. Shell Programming and Scripting
Hi guys,
I wanted to pass a variable to the sed command which tells which line to be deleted.
a=2;
echo $a;
sed '$ad' c.out
it is throwing an error.
sed: 0602-403 "$a"d is not a recognized function.
I even tried "$a" and \$a.. but it is of no use.
Can you please correct me... (6 Replies)
Discussion started by: mac4rfree
6 Replies
6. UNIX for Dummies Questions & Answers
I need to set up a strange system through which an arbitrary command is sent to a number of different servers (well, actually, VPS accounts). We have a command "vpass" that "passes" a command from the root level to resident VPS accounts. Suppose I wanted each VPS to do some trivial thing, like... (3 Replies)
Discussion started by: treesloth
3 Replies
7. Shell Programming and Scripting
Hello All,
I am trying to embed variable in sed command to fetch a portion of record between two pattern.
This command is not working ...any suggestion on this how to place the variable in sed command to find a portion .
I am using Sun OS (Solaris).
Thanks
JM (1 Reply)
Discussion started by: jambesh
1 Replies
8. Shell Programming and Scripting
Can we pass perl variable to shell commands. If yes, please give some example. (2 Replies)
Discussion started by: Anjan1
2 Replies
9. Shell Programming and Scripting
Hi all,
I have a file looks like
AAAA 111
BBBB 222
CCCC 333
need to pass variable value like var1=AAAA and var2=111
to another command for three times with next values.
stuck over here
cat file | while read line
do
export var1=`awk '{print $1}'`
echo $var1
export var2=`cat file... (3 Replies)
Discussion started by: rakeshtomar82
3 Replies
10. UNIX for Advanced & Expert Users
Hi,
As the process of log cleanup, Im using the below command
find $DIR -mtime +3 -type f -exec gzip {} \;
The problem is I want to pass +3 as variable in my unix shell.
I have defined ZPDATE=+3 in my properties file and calling this property file in my script.
If i try the... (6 Replies)
Discussion started by: Deena1984
6 Replies
LEARN ABOUT XFREE86
pidof
PIDOF(8) Linux System Administrator's Manual PIDOF(8)
NAME
pidof -- find the process ID of a running program.
SYNOPSIS
pidof [-s] [-c] [-n] [-x] [-o omitpid[,omitpid..]] [-o omitpid[,omitpid..]..] program [program..]
DESCRIPTION
Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. This program is on some systems
used in run-level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in
/etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead.
OPTIONS
-s Single shot - this instructs the program to only return one pid.
-c Only return process ids that are running with the same root directory. This option is ignored for non-root users, as they will be
unable to check the current root directory of processes they do not own.
-n Avoid stat(2) system function call on all binaries which are located on network based file systems like NFS. Instead of using this
option the the variable PIDOF_NETFS may be set and exported.
-x Scripts too - this causes the program to also return process id's of shells running the named scripts.
-o omitpid
Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof pro-
gram, in other words the calling shell or shell script.
EXIT STATUS
0 At least one program was found with the requested name.
1 No program was found with the requested name.
NOTES
pidof is actually the same program as killall5; the program behaves according to the name under which it is called.
When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that
it returns pids of running programs that happen to have the same name as the program you're after but are actually other programs. Note
that that the executable name of running processes is calculated with readlink(2), so symbolic links to executables will also match.
SEE ALSO
shutdown(8), init(8), halt(8), reboot(8), killall5(8)
AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl
01 Sep 1998 PIDOF(8)