Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. User:/$ mkdir -g foo
  2. User:/foo/$
  3.  
  4. mkdir() {
  5. if "$1" -eq "-g"
  6. mkdir "$2"
  7. cd "$2"
  8. else
  9. ## do the regular code
  10. fi
  11. }
  12.  
  13. mkcd() {
  14. if "$1" -eq "-g"
  15. mkdir "$2"
  16. cd "$2"
  17. else
  18. ## do the regular code
  19. fi
  20. }
  21.  
  22. mkdir () {
  23. local do_cd=
  24. if [ "$1" = "-g"]; then
  25. do_cd=1
  26. shift
  27. fi
  28. command mkdir "$@" &&
  29. if [ -n "$do_cd" ]; then
  30. eval "cd "${$#}""
  31. fi
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement