Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ElfQrin authored Sep 21, 2019
1 parent 7a80b7a commit 9a04ff2
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
16 changes: 16 additions & 0 deletions back.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# back # back from cdm and upm # r2017-02-01 fr2017-02-01
# by Valerio Capello - http://labs.geody.com/ - GPL
# alias back=". PATH/back.sh"
if [ "$MPWD" == "" ]; then LIMIT=0; fi
LIMIT="$1"
if [ "$LIMIT" == "" ]; then LIMIT=1; fi
P="$MPWD"
# echo -n "cd from $P "
for ((i=1; i <= LIMIT; i++))
do
P="${P%/..}"
done
# echo "to $P"
cd "$P"
export MPWD="$P"
7 changes: 7 additions & 0 deletions cdm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# cdm # change directory (and back) # r2017-02-01 fr2017-02-01
# by Valerio Capello - http://labs.geody.com/ - GPL
# alias cdm=". PATH/cdm.sh"
# echo "cd from $P to $1"
export MPWD="$PWD"
cd "$1"
10 changes: 10 additions & 0 deletions dirm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
# dirm # memorize directory (to get back) # r2019-09-21 fr2017-02-01
# by Valerio Capello - http://labs.geody.com/ - GPL
# alias dirm=". PATH/dirm.sh"
# echo "directory to remember: $1"
if [ -z "$1" ]; then
export MPWD="$PWD"
else
export MPWD="$1"
fi
9 changes: 9 additions & 0 deletions ldirm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# ldirm # list memorized directory # r2019-09-21 fr2019-09-21
# by Valerio Capello - http://labs.geody.com/ - GPL
# alias ldirm=". PATH/ldirm.sh"
if [ "$MPWD" ]; then
ls -laF --group-directories-first --color=auto "$MPWD"
else
ls -laF --group-directories-first --color=auto
fi
9 changes: 9 additions & 0 deletions showdirm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# showdirm # echo memorized directory # r2019-09-21 fr2019-09-21
# by Valerio Capello - http://labs.geody.com/ - GPL
# alias showdirm=". PATH/showdirm.sh"
if [ "$MPWD" ]; then
echo "$MPWD"
else
echo ""
fi
19 changes: 19 additions & 0 deletions up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# up # up one directory # r2017-02-01 fr2017-02-01
# by Valerio Capello - http://labs.geody.com/ - GPL
# alias up=". PATH/up.sh"
LIMIT="$1"
if [ "$LIMIT" == "" ]; then LIMIT=1; fi
if [ "$LIMIT" -lt 0 ]; then LIMIT=0; fi
P="$PWD"
if [ "$P" == "/" ]; then LIMIT=0; fi
# echo -n "cd from $P "
for ((i=1; i <= LIMIT; i++))
do
P=`echo -n "$P" | rev | cut -d "/" -f2- | rev`
# P="$P/.." # alternative method
done
if [ "$P" == "" ]; then P="/"; fi
# echo "to $P"
cd "$P"
# export MPWD="$P"
19 changes: 19 additions & 0 deletions upm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# upm # up one directory (and back) # r2017-02-01 fr2017-02-01
# by Valerio Capello - http://labs.geody.com/ - GPL
# alias upm=". PATH/upm.sh"
LIMIT="$1"
if [ "$LIMIT" == "" ]; then LIMIT=1; fi
if [ "$LIMIT" -lt 0 ]; then LIMIT=0; fi
P="$PWD"
if [ "$P" == "/" ]; then LIMIT=0; fi
# echo -n "cd from $P "
for ((i=1; i <= LIMIT; i++))
do
# P=`echo -n "$P" | rev | cut -d "/" -f2- | rev` # this won't work with back
P="$P/.."
done
if [ "$P" == "" ]; then P="/"; fi
# echo "to $P"
cd "$P"
export MPWD="$P"

0 comments on commit 9a04ff2

Please sign in to comment.