Guest User

Untitled

a guest
Jan 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # utility function which is used to create and change
  2. # to the given directory name
  3. # Add to the .bashrc file
  4. # usage:
  5. # mkcd directory_name
  6. mkcd() {
  7. local directory_name="${1}"
  8. if [ -z $directory_name ]
  9. then
  10. echo "Pass the directory name as the argument!!!" > /dev/stderr
  11. elif [ -d "${directory_name}" ]
  12. then
  13. cd $directory_name
  14. unset directory_name
  15. else
  16. mkdir -p $directory_name
  17. cd $directory_name
  18. unset directory_name
  19. fi
  20. }
Add Comment
Please, Sign In to add comment