Shell script that accept filenames specified as argument & creates shell script that contain this file as well as the code to recreate these files. Thus if the script generated by your script is executed it would recreate the original file


#!/bin/bash

If [ $#-eq0 ]

Then

Echo “invalid number of argument”

Exit

Fi

For x in $@

Do

If [ -f $x ]

Then

Echo “extracting $x”

Cat $x

Echo “end of file $x”

Else

Echo “error extracting $x”

Fi

done

Contributed by : Sri Raksha 

Comments