Assuming that you're using a POSIX-conforming shell (such as ash, bash, date, ksh, or zsh), you just need to put your commands in a file with a little bit of shell script boilerplate, parameterize the part(s) of the command that need to be supplied on the command-line when you invoke your script, add some error checking to be sure that the needed command-line arguments are present when your script is invoked, make the script executable, and put it in a directory where the people who need to execute your script will be able to find it.
I prefer the Korn shell, so I will use it for this example, but the code supplied here will work with any POSIX-conforming shell if there is some reason why you don't like the Korn shell. First place the following text in a file named whatever name you want to use when you invoke this script. (I'll assume that you named it makejar in the following directions.) Note that you must use an editor that uses the <newline> character as the line terminator (not the DOS <carriage-return><newline> character pair) when you create this file:
Then make the file executable:
Assuming that this command is for your personal use, move it into your bin directory (creating it if it doesn't already exist):
Then, assuming that $HOME/bin is in your PATH environment variable, you can execute your script just by typing its name and the parameters you want to pass to it just as you would with any other command you give to your shell:
or:
for security purpose I want to encrypt my shell script program.please give me some idea immediately. I have already try SHC in my server but after using SHC server hang problem is occured.
kindly provide me solution for that.
akm (3 Replies)
hi
i have file extentioned with test.vbs. i am able to run this file n execute through command promt but i dont know how to run in shell script
example:
file name is test.vbs which contains
strSoundFile = "C:\windows\Media\Notify.wav"
Set objShell = CreateObject("Wscript.Shell")
strCommand... (5 Replies)
Hi,
I have a requirement to encrypt a file using gpg with a public key. However when i encrypt a file, i get a question like 'Do you want to go ahead with unverified user?' . when i press 'y' file is encrypted.
I am not able to automate this job because of this interactive mode. Could... (3 Replies)
Hi Folks
I came up with peculiar requierement ..:)
I have to jar special files types only from a number of child folders , and also exactly same as the child file path...sorry i will give an example
suppose i have following folder structure
# cd HTML/
total 0
drwxrwxr-x 2... (1 Reply)
Hi,
I have run the below script which is connected to db2 v9.5. There is no issue. The only problem is how to encrypt the dbpwd?
#!/bin/ksh
#---- Set Environment
dbalias="dev1db"
dbuser="user1"
dbpwd="password"
#---- Connect to the Database
cd /opt/ibm/db2/V9.5/bin
db2 "connect to... (1 Reply)
Hi,
We have some scripts which will run in other project..So the requirement is that we dont want that they should see our code though they can run it. I have done some searching about how to encrypt the shell script and found SHC utillity as the answer.
Can anybody please suggest how will... (11 Replies)
Hi
I have a mail attachment coming from a mail id and evreytime with the same name in .xls format.I have to download the .xls file into a location and convert it itno .csv format and copy the .csv file to another location. (1 Reply)
Hey Guys ,
Recently working on a requirement , i had to deal with XLS file with multiple tabs and the requirement was as below :
1. Convert one XLS file with multiple tabs to multiple CSV files.
-- As i was working on MAC , so it was quite easy through APPLESCRIPT to deal with this.But... (2 Replies)
Hi All,
I have stored Oracle database passwords in a hidden file - .pass_file.
My shell script reads the hidden file, gets the password and then logs in to the Oracle database and runs some SQL script.
My requirement is:
I need to provide the shell script to be executed by someone else. So,... (1 Reply)