I want to create a simple bash function (in .bashrc) that takes in one parameter (a directory name) and tars all the files inside of that directory into a specific directory in /home (we'll call that destdir). The name of the tar should be the same as the directory parameter.
For example, I want to be able to type into the terminal "task directory_name".
I tried this but it didn't work:
tar czf /~/destdir/$1.tar *
What am I doing wrong?