chimbu chimbu - 3 years ago 57
Bash Question

how to create a file in shell script with specific password

i am looking for a way to create a password protected file in Shell with same password instead of random password since we need to ftp the file to 3rd party hence we dont need the password to be changed every time , Below is my sample code snipet ,

echo "STORE,CUSTOMER,START TIME,END TIME" > $dir/output/ORDER.csv
cat $dir/output/ORDER.del >> $dir/output/ORDER.csv
rm -f $dir/output/ORDER.del


I need the file ORDER.csv to be password protected and lets say its 1234 every time.

Answer Source

If zipping is an option for you, then you can password protect the zip file:

zip -P 1234 order.zip $dir/output/ORDER.csv
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download