linux:shell_commands:up

no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


linux:shell_commands:up [2022/02/18 07:41] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== .bashrc up ======
 +To cd up a certain number of times, add this to your .bashrc file
  
 +<code bash>
 +up() {
 +        local d=""
 +        local limit="$1"
 +        if [ -z "$limit" ] || [ "$limit" -le 0 ]; then
 +                limit=1
 +        fi
 +
 +        for ((i=1;i<=limit;i++)); do
 +                d="../$d"
 +        done
 +
 +        if ! cd "$d"; then
 +                echo "Path shallower than $limit";
 +        fi
 +}
 +</code>
  • linux/shell_commands/up.txt
  • Last modified: 2022/02/18 07:41
  • by 127.0.0.1