[UPDATE][SHELL] Add quote to variable expansions
Everyone assumes that spaces do not exist on a Linux system... This is unfortunately not the case (although I hate having spaces in my own files). Quoting the variables avoids running into those kind of issues.
This commit is contained in:
parent
6d17f7ac54
commit
5723876694
|
@ -37,21 +37,21 @@ fi
|
|||
# jump directorys upwards until it hits a directory with multiple folders
|
||||
function up() {
|
||||
local d=""
|
||||
limit=$1
|
||||
limit="$1"
|
||||
for ((i=1 ; i <= limit ; i++))
|
||||
do
|
||||
d=$d/..
|
||||
d="$d/.."
|
||||
done
|
||||
d=$(echo $d | sed 's/^\///')
|
||||
d=$(echo "$d" | sed 's/^\///')
|
||||
if [ -z "$d" ]; then
|
||||
d=..
|
||||
fi
|
||||
cd $d
|
||||
cd "$d"
|
||||
}
|
||||
|
||||
# create an directory and directly cd into it
|
||||
function mcd() {
|
||||
mkdir -p $1
|
||||
cd $1
|
||||
mkdir -p "$1"
|
||||
cd "$1"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue