Hello
Before I get to my question let me explain the situation. I am writing a ksh script to startup several instances of an application. That is done by executing another ksh script (let's call it startApp) with some arguments. Now, startApp writes some information to stdout that I don't want... (3 Replies)
Hi All,
I need some info.
Could you please tell me how to use the variable of a parent shell in the subshell. Also can we modify the variable in the subshell ? If yes, will the modified variable visible in the parent shell
I am using two prg.
a.sh
#!/usr/bin/ksh
temp_var="abhishek"... (3 Replies)
I have a shell script which is invoked by passing an argument. The outer shell script calls another subshell and I want the argument passed down to flow down to the subshell.
E.g
Invoking a shell ======>> abc_refresh.ksh NM
Below is the content of abc_refresh.ksh
Value1=$1... (7 Replies)
I am calling a script from with another script and reading its output one line at a time (using <childscript> | while read line) in the parent script. If the output exceeds a predefined number of lines I want to kill the child shell from within the parent shell.
I decided to print the process ID... (2 Replies)
Hello,
I've a little problem with one of my ksh scripts and I manage to narrow it to the script here:
#!/bin/ksh
writeLog()
{
paramHandle="unknown"
OPTIND=1
while getopts :i: option $*
do
case $option in
i) paramHandle=${OPTARG} ;;
esac
done
echo... (2 Replies)
Hi All,
I would like to improve my bash scripting skill and found a problem which I do not understand. Task is to search and print files in directory (and subdirecories) which contains its own name. Files can have spaces in name.
This one works fine for files in main directory, but not for... (4 Replies)
People,
Here is my code
while read ln
do
xyz=$(echo $ln/$val1*100-100|bc -l|xargs printf "%1.0f\n")
if && ; then
iam="YELLOW"
fi
done <<< "$(grep "^" $TMPOUT)"
where $TMPOUT is a flat file which contains a set of values.
Whilst executing the above, I get an error... (4 Replies)
Hi,
the getopts doesnt seem to be working in the subshell of the ksh. when I echo $@ and $* from the subshell it shows nothing. even when I am capturing the parameters from the outer shell and passing while invoking the file then I am still not getting it properly.
the below code is in the... (9 Replies)
Hello,
I am firing off some scripts from a main script,
cd B/
./EV_B_m0-m200_hex1.sh &
./EV_B_m0-m200_hex2.sh &
wait
...more
It would be useful to put a bit of time between the two to clean up the output to the terminal.
I think this would work,
cd B/
... (4 Replies)
Discussion started by: LMHmedchem
4 Replies
LEARN ABOUT ULTRIX
escape
escape(1) Mail Avenger 0.8.3 escape(1)NAME
escape - escape shell special characters in a string
SYNOPSIS
escape string
DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result.
EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string:
$ var='; echo gotcha!'
$ eval echo hi $var
hi
gotcha!
$
Using escape, one can avoid executing the contents of $var:
$ eval echo hi `escape "$var"`
hi ; echo gotcha!
$
A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For
example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient:
#!/bin/sh
formail -x to -x cc -x resent-to -x resent-cc
| fgrep "$1" > /dev/null
&& exit 0
echo "<$1>.. address does not accept blind carbon copies"
exit 100
To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt
script:
bodytest reject_bcc `escape "$RECIPIENT"`
SEE ALSO avenger(1),
The Mail Avenger home page: <http://www.mailavenger.org/>.
BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells.
AUTHOR
David Mazieres
Mail Avenger 0.8.3 2012-04-05 escape(1)