I have a very stupid/simple problem, but for some reason I cannot figure out...and I need your help!
I am writting a bash scrip that should be executed using "my_script X Y Z T" where X Y Z and T can be any string, but there can be any number of arguments.
I want my script to do a list from these inputs:
Using the above script, I got:
./myfile.1 ./myfile.2 ./myfile.3 ./myfile.4
instead of:
./myfile.X ./myfile.Y ./myfile.Z ./myfile.T
I will try that right now. However, there is one more thing: in reality I want to skip the first argument. I know I can use a "if" condition so that if $i == 1, then I do nothing.
Is there a nicer way to force the "for" loop to start with i=2 ?
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
1) The script is executed in the Korn shell.
2) Name the shell script file is asg6s.
3) The asg6s file is... (7 Replies)
Here is my script:
#!/bin/ksh
usage ()
{
echo " Usage: $0 <opt1> <opt2> <opt3> <opt4>"
}
if ; then
usage
exit;
fi
prog -a $1 -b $2 -c $3 -d $4 2>&1 | tee -a ~/$1.log
I want argument 4 to be optional, so if there's no argument for opt4, that it doesn't... (8 Replies)
The following bash script does not work because the java/groovy code always thinks there are four arguments even if there are only 1 or 2. As you can see from my hideous backslashes, I am using cygwin bash on windows.
export... (1 Reply)
This is what I have:
#!/bin/bash
#ascript.sh
WORD1=`tail -n +$1 /home/gscn/word1.txt | head -1`
sed -e "s/WORD1/$WORD1/g" < /home/gscn/configtmp > /home/gscn/config
WORD2=`tail -n +$1 /home/gscn/word2.txt | head -1`
sed -e "s/WORD2/$WORD2/g" < /home/gscn/config2tmp >... (4 Replies)
I have no idea what the following means. The teacher is too advanced for me to understand fully. We literally went from running a few commands over the last few months to starting shell scripting. I am not a programmer, I am more hardware oriented. I wish I knew what this question was asking... (3 Replies)
hi,
i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
In the make file
update updateq:
-------------------
----------
i want the makefile to display some messages when user gives "make update", but totally quite wehn user enters "make updateq". Can u tell me how to read these argument in makefile.
$1 doesnt work:( (3 Replies)
Hi everybody, i want to make an argument at echo command that takes a alpharithmetic and returns it reversed. How this can be done? plus what makefile changes are needed (0 Replies)