Not sure if I understood your requirements correctly, but this should do the job:
You could use ksh or bash as well to execute the commands. Supplying it the -x option would eliminate the need for the tee step.
For lines that simple -- no evaluation, natural splitting on spaces -- I don't think you need to feed it into sh. The shell's own natural splitting should take care of it once you have it.
Not sure if I understood your requirements correctly, but this should do the job:
You could use ksh or bash as well to execute the commands. Supplying it the -x option would eliminate the need for the tee step.
Thank you. Brilliant solution, unfortunately sed in ksh does not know the -r option. How could that sed command look instead? I'm trying now quite a while without success.
In principle you can use any process which output are code-lines and pipe that in ksh (or any other shell i know, for that matter):
Notice, however, that there are certain things to be aware of:
First, your lines have to observe the line-length limit the system is compiled with. This is always the case but when writing lines of code you notice extraordinary long lines more easily than when you generate them.
This will eventually break for either the line "var="$var $iCnt" being too long, the number of maximum arguments being exceeded or the maximum commandline length being exceeded. Which of these events will happen first and at which value of some-big-number depends on your system, the version, etc..
Another possible problem is possible multiple interpretations of your commandline by a shell. Consider a try to execute a command on several selected hosts:
In this form it would work, because the commandline will not change with several shells interpreting it, but how about a command which should receive several parameters, some of them containing spaces:
This will work on the commandline, but in your script-constructing script you would have to do:
Thank you. Brilliant solution, unfortunately sed in ksh does not know the -r option. How could that sed command look instead? I'm trying now quite a while without success.
Hello,
I have standard loop
while read -r info; do
command $info
done < info
in info text file I have multiple commands each on line that I want to execute. When I used them in console they worked, but not with this loop.
This is one of the commands in info file:
grep... (4 Replies)
What is the correct syntax to pipe or run three awk commands? Basically, using the output of the first awk as input in the second. Then using the output of the second awk in the third. Thank you :).
awk 'FNR==NR {E; next }$3 in E {print $3, $5}' panel_genes.txt RefSeqGene.txt > update.txt |... (3 Replies)
works fine.
echo "Deleting CHOPOne Coreaccess from LAUA..."
$ORACLE_HOME/bin/sqlplus username/password@servername << !
delete from usergrpdtl where username='acker';
commit;
!
but not working with "if statement" even $TMPDIR/adlogin.log exists and greater than 0.
if
then
... (9 Replies)
Hi
I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email.
For example
-------
Script ABC
-------
a.ksh
b.ksh
c.ksh
I need to call all three scripts execute them and... (2 Replies)
Are there any documents available for checking the execution time taken by ksh commands?
My requirement is to fine tune a set of shell scripts having lot of "echos" and "date"s.
Is there a better replacement for the below code?.
echo "ABC process started on `date`"
some code..
echo... (12 Replies)
Hi,
I am wondering how I can check the return value of all commands in a pipe such as
gzip -dc file.gz | sort -u > output.txt
If I run this sequence in bash and check $?, I get the return status from sort. But I want to know if the initial gzip failed.
Similarly for longer pipe chains,... (6 Replies)
I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
It would be helpful if someone could help me out here. The problem I have been having is that I cannot run some commands which are valid - whenever I try to run the command I get the message "command not found". Now, if I run the same command as root it executes. These commands do not have to be... (5 Replies)
I am trying to get various portions of strings in my script, but am getting a substitution error. I followed the syntax that was described when I goggled this, but I can't get anything to work.
#! /bin/ksh/
hello="adklafk;afak"
#hello=${hello:3}
hello=${$hello:3}
happy="hey"
echo... (1 Reply)
I have a few scripts that i would like to make into GUI's. Are there scripting commands to make GUI's if so where can i get the list of commands and what they do or if anyone has an example of it. Anything will help, thanks (1 Reply)