I'm probably missing something basic with bash function variable syntax here.
My understanding of the zip command's syntax is that it's zip newfilename.zip filetobezipped
. So I want my function to zip the specified folder and all its contents, and I want the result, zipped folder to be named the same name as the contents, just with .zip added. Then I copy that over to my windows directory and delete it from the linux directory.
To be clear, if the file I want zipped is called "something", then I want the zipped version to be named "something.zip".
However, this function produces a hidden zip file, .zip
with no letters before the period. So it seems my variable $1 is not being passed into the function correctly.
params: $1: filename, $2: week_x, $3: day_y
hwcopy() {
zip -r $1.zip $1
cp $1.zip /mnt/c/Users/myName/Desktop/homework/$2/$3
rm -r $1.zip
}
How I called it (from within the parent directory): $ hwcopy file_folder_name/ week_x day_5