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 files placed in subdirectories:
So I tried to add basename in subshell and it is not working as I expected. There is no result. Path is printed like before.
When I changed basename to dirname to check what happens, I got:
So, why basename and dirname act like this? Thank you for any help on this
The profile of the user is empty. Then before I run the script I want I run a parameter file that populates the variables for oracle.
ORACLE_HOME
ORACLE_BASE
ORACLE_SID
PATH
etc ...
But it seems that these variables are not making it to the shell I am in because when I do an echo on... (6 Replies)
Hi,
can anyone let me know how to interpret the below third line in the following code.
Gone through the man pages of "basename", but no go.
for f in *.foo;
do
base=`basename $f .foo`
mv $f $base.bar
done
Thanks. (2 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)
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)
Hi All,
I am trying to create a shell script which runs on my linux machine.
The requirement is so that,
ade createview xyz -> this steps creates a view
ade useview xyz -> we are entering inside the view
ade begintrans -> begin a transaction
My script has following code :
lets say... (2 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)