I use these commands on a daily basis:
mkdir ______ && rar a -m0 -v200M ______/______.rar "XXXXXXXX" && rm -rf "XXXXXXXX" &&
par2 c -r10 -l ______/______.par2 ______/* && ~/newsmangler/mangler.py -c
~/.newsmangler.conf ______ && rm -rf ______
Where "XXXXXXXX" and "______" are two variables.
Is there a way to use a shortcut to make this easier since the only things that change are "XXXXXXXX" and "______"? I'm looking for something similar to:
mycommands _____ XXXXX
Couple things you may want to know:
- I use GNOME terminal.
- I don't have a root access.
Just write a function that accepts two arguments:
function just_do_it (){
( [ -z "$1" ] || [ -z "$2" ] ) && echo "No arguments given" && return 1
echo "do stuff with $1 and $2"
# notice to use double quotes, when processing the varibales
ls -l "$1"
}
The first line check if the two arguments are given. The argument can be accessed by $1
(first one) and $2
(second).
Edit: the function in your case would then for example look like this (a bit more readable formatted):
function just_do_it (){
( [ -z "$1" ] || [ -z "$2" ] ) && echo "No arguments given" && return 1
mkdir "$1" && \
rar a -m0 -v200M "$1/$1.rar" "$2" && \
rm -rf "$2" && \
par2 c -r10 -l "$1/$1.par2" "$1/*" && \
~/newsmangler/mangler.py -c ~/.newsmangler.conf "$1" && \
rm -rf "$1"
}