How do I write shell script for Redhat Linux bash shell -
i using jenkins build project. able build project. need copy war file in target location. can copy .war file using cp source_file_location target_file_location
job. want check if file exist show message old file found delete old file , copy new file in target location.
and zip target location folder , copy in x place.
i sorry. seems have given requirement. don't know how write shell script except basic command. can body me?
ok, hints of commands need. should enough create first bash script.
but want check if file exist
take test command (or equivalent [ -f file_exists ]. example:
if [ ! -f /tmp/foo.txt ]; echo "file not found!" fi
show message old file found
echo "my message"
then delete old file
rm file (or -r directory)
and copy new file in target location.
this part think know ho it
if have doubt command, try consult command manual. in general it's easy , straightforward. following link bash programming tutorial.
Comments
Post a Comment