Search Results

Search: Posts Made By: hadarot
10,958
Posted By hadarot
If the filename is as specified above, then ...
If the filename is as specified above, then
pid=`cat /tmp/script.PID` Then use $pid to access the PID. E.g., to kill the process, do kill $pid

But if your system's ps command supports formatted...
1,694
Posted By hadarot
That's right. One of the differences between...
That's right. One of the differences between C-shells and Bourne-shells is that in Bourne derived shells, if you start quoted text while entering a command (i.e., with a ' or "), a newline does not...
3,822
Posted By hadarot
Not probably -- certainly.
Not probably -- certainly.
7,818
Posted By hadarot
Here is a pretty good thread if you are...
Here is a pretty good thread if you are interestsed in he syntax of here documents and how the shell treats things in a here doc: https://www.unix.com/showthread.php?p=80897#post80897

However, I...
2,442
Posted By hadarot
What may be your problem is that you are...
What may be your problem is that you are redirecting your output to $ctrl, but have not defined the ctrl varaible at all prior to this. Maybe you should edit all the redirection statments to have...
39,144
Posted By hadarot
try this. much simpler and to the point: ps -eo...
try this. much simpler and to the point: ps -eo comm,pid | awk '$1 == "keepalive" { print $2 }'
1,774
Posted By hadarot
history of test command as [
Does anyone know which came first for the test syntax: test <expr> or [ <expr> ]? My vague understanding is that test was the initial way to do it. But if so, when was the [ syntax introdcued?...
11,687
Posted By hadarot
...and by the way, if you do want to set a...
...and by the way, if you do want to set a variable with a value from a subprocess, check out the thread at https://www.unix.com/showthread.php?t=20755
91,130
Posted By hadarot
VAR=${VAR:=default_value} if VAR is already...
VAR=${VAR:=default_value}

if VAR is already set (and not null), will be reset with its own value; else will be set to "default_value". In your case, you can put 0 for this value.
Another less...
37,093
Posted By hadarot
If you want to do only a couple things with the...
If you want to do only a couple things with the output, filter you source file in a pipeline: grep -v '^[[:space:]]*#' /path/to/your/file | your_commands if you want do extensive stuff with your...
11,687
Posted By hadarot
Though maybe not so pertinent to your particular...
Though maybe not so pertinent to your particular problem at hand, but I think the basic principle you need to grasp here is that of command subsitution, implemented in the Bourne shell with backtics,...
6,312
Posted By hadarot
exactly... the same for comm...
exactly...

the same for

comm <<$VAR_NAME
a
b
$VAR_NAME

You can't end the here doc with the value of this supopsed variable -- it just a label, '$VAR_NAME'
6,312
Posted By hadarot
For every Bourne-derived shell I know of,...
For every Bourne-derived shell I know of, concerning the redirection constructs, >, <, >>, and <<, the name supplied after the redirection operator undergoes variable/command/arithmetic/filename...
2,140
Posted By hadarot
Well, generally speaking, if you want to run as a...
Well, generally speaking, if you want to run as a command as another user, you don't use su, but sudo. Read it's man page--pretty easy to use. But you will be prompted for the user's password...
399,388
Posted By hadarot
does your script have any "read" statements? is...
does your script have any "read" statements? is there any reason why the script's stdin or stdout would need to be connected to a terminal?
10,076
Posted By hadarot
Got It!
This is pretty cool: The following procedure allows you to write a script that sends some "normal" output, ie, to the terminal, but other output to its calling program, so that the caller can recieve...
28,072
Posted By hadarot
Dude, don't worry about it. You probably can code...
Dude, don't worry about it. You probably can code better than many of us here... :)
But "Bourne shell" is just a name for the orignal version of the Unix comand intrenpreter, written at AT&T Bell...
10,076
Posted By hadarot
Getting value of variable set in subprocess script
I am writing a shell script that executes another script by fetching it over the network and piping its contents into sh (ftp -o - $script | sh; or wget -O - |sh). Since this bypasses putting the...
Forum: BSD 08-08-2005
8,671
Posted By hadarot
Indeed, here is a snippet OpenBSD's code (@...
Indeed, here is a snippet OpenBSD's code (@ http://www.openbsd.org/cgi-bin/cvsweb/src/bin/ksh/main.c):
Forum: BSD 08-08-2005
8,671
Posted By hadarot
That's not what I was after. But I did find this...
That's not what I was after. But I did find this in OpenBSD's sh man page:


So it indeed does function like bash, insofar that OpenBSD's modified version of pdksh checks if it has been invoked as...
Forum: BSD 08-07-2005
8,671
Posted By hadarot
OpenBSD sh and ksh differences?
Hi,

I am running OpenBSD 3.7, my first attempt with this OS. I noticed that both /bin/sh and /bin/ksh are both really the pdksh. Yet each has its own manpage. I was wondering what are the...
9,490
Posted By hadarot
how about: #!/bin/sh while read line do ...
how about:

#!/bin/sh
while read line
do
grep "$line" /path/to/file2 >> file3
done < /path/to/file1
3,327
Posted By hadarot
This discussion will be seem clearer afer...
This discussion will be seem clearer afer examining the final code offered--which is very short. But to gain some knowledge and understanding, which is always importnat...
The read command works by...
4,079
Posted By hadarot
Well, if you really want to know, write up an awk...
Well, if you really want to know, write up an awk script that will count the number of instances of certain keywords (such as ps, echo, sed) is a user's scripts. Then you can distribute this script...
14,236
Posted By hadarot
If the modification times of the files don't...
If the modification times of the files don't necesarilly match the "dates" coded in the filenames, then you have to be a bit more creative. If this is part of a big project that you want automated,...
Showing results 1 to 25 of 31

 
All times are GMT -4. The time now is 02:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy