Hi,
I am new to unix and using linux 7.2. I would like to create a script that would make it easyer for me to run my java programms. At the moment I have to type java [path to my program]myJavaprogram
I am trying to write a script that will allow me to type something like this "myscript myJavaprogram" or maybe "myscript -myJavaprogram.
This is what I got so far
#!/bin/sh
# Print the current working directory.
java `pwd` #end of runjava file
How do I read an argument that I would like to pass?
ie %runjava Test
And the command passed to the shell would be "java [directory]Test"
Inside a shell script you can read the arguments passed to your shell program by $1, $2, $3 .......
for e.g if your script file name is myscript and if you want to pass an argument to it like (myscript arg1) then inside myscript you can refer the arg1 by $1.
I'm running .kshrc and want to script or alias the following:
ls -alF <i>regex</i> | more
I have not found how to pass an argument inside an alias
(e.g. alias dir='ls -alF $1 | more' does NOT work).
The following script 'dir' works:
#!/bin/ksh
ls -alF $1 | more
however, if I pass it an expression like '*.eva' it will only ls the first filename with the .eva extension (not ls all of the files with the .eva extension).
_Anyone_ who's read this far already has my sincere appreciation! If you can point me to man pages to help me solve this problem I'd appreciate it even more!