Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. goto(){
  2. if [ -z "$1" ]; then
  3. printf "No argument supplied \nUsage: goto [FOLDER_NAME]\n"
  4. else
  5. find . -maxdepth 4 -type d > temporarybashoutputfile 2> >(grep -v 'Permission denied' >&2)
  6. VAR=$(cat temporarybashoutputfile)
  7. rm temporarybashoutputfile
  8. DIR=$(echo "${VAR}" | grep ".*/$1$")
  9. if [ -z ${DIR} ]; then
  10. echo "Directory not found"
  11. else
  12. cd ${DIR}
  13. fi
  14. fi
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement