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.

http://tldp.org/howto/bash-prog-intro-howto.html


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -