ncd descend subfolder
This commit is contained in:
10
qcd_function
10
qcd_function
@@ -181,11 +181,19 @@ complete -F _qcd qcd
|
||||
function ncd() {
|
||||
# echo Next sibling cd
|
||||
[[ "$1" = "-h" ]] && {
|
||||
echo Next sibling cd: change directory to [../next_folder]. ncd - to go to previous.
|
||||
echo -e "Next sibling cd: change directory to [../next_folder]. \nncd - to go to previous folder. \nncd . to descend to first subfolder."
|
||||
return
|
||||
}
|
||||
local _current_pwd _iter_d _iter_prev _current_found
|
||||
_current_pwd=$( basename "$( pwd )" )
|
||||
if [ "$1" = "." ]; then
|
||||
for _iter_d in *; do
|
||||
if [ ! -d "$_iter_d" ]; then continue; fi
|
||||
\cd "$_iter_d"
|
||||
return
|
||||
done
|
||||
return
|
||||
fi
|
||||
\cd ..
|
||||
for _iter_d in *; do
|
||||
if [ ! -d "$_iter_d" ]; then continue; fi
|
||||
|
||||
Reference in New Issue
Block a user