Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #-------------------------------------------------------------------------------
  4. # PARAMETERS:
  5. # $@ - cp arguments
  6. #-------------------------------------------------------------------------------
  7.  
  8. get_last_arg() {
  9. shift $(($# - 1)) && # skip all arguments expect the last one
  10. echo "$1" # print it
  11. }
  12.  
  13. last_arg="$(get_last_arg "$@")" && # get the target directory
  14. mkdir -p -- "$last_arg" && # create the target directory
  15. cp "$@" # copy files to the created directory
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement