Skip to content

Instantly share code, notes, and snippets.

@AfroThundr3007730
Created May 19, 2018 21:45
Show Gist options
  • Save AfroThundr3007730/3482b2e59e5aaea01315c91a0117adad to your computer and use it in GitHub Desktop.
Save AfroThundr3007730/3482b2e59e5aaea01315c91a0117adad to your computer and use it in GitHub Desktop.
Show the number of args in a command. Useful for troubleshooting word splitting.
#!/bin/sh
printf "%d args:" $#
printf " <%s>" "$@"
echo
@AfroThundr3007730
Copy link
Author

Put it in your $PATH, then call it before a command:

foo@bar:~$ args ls -a -l -h /var/lib
5 args: <ls> <-a> <-l> <-h> </var/lib>

Found it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment