Update up()
This commit is contained in:
		
							parent
							
								
									55d6796e7a
								
							
						
					
					
						commit
						7e531c1a0f
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		
							
								
								
									
										12
									
								
								zshrc
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								zshrc
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -139,14 +139,18 @@ autoload mkmdir
 | 
			
		|||
autoload pw
 | 
			
		||||
autoload mkcmod
 | 
			
		||||
 | 
			
		||||
# Go up n directories (saves me from having to type ../ ad # nauseum)
 | 
			
		||||
# Go up $1 directories, where $1 is an integer (saves me from having to type ../
 | 
			
		||||
# ad nauseum)
 | 
			
		||||
function up {
 | 
			
		||||
    if [[ -z $1 ]]; then
 | 
			
		||||
        pushd ..
 | 
			
		||||
    else
 | 
			
		||||
        updirs=()
 | 
			
		||||
        for (( i=0; $i < $1; i++ )); do updirs+='..' done
 | 
			
		||||
        pushd ${(j./.)updirs}
 | 
			
		||||
        local updir=''
 | 
			
		||||
        for (( i=0; $i < $1; i++ ))
 | 
			
		||||
        do
 | 
			
		||||
            updir="../$updir"
 | 
			
		||||
        done
 | 
			
		||||
        pushd $updir
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue