Skip to content

Instantly share code, notes, and snippets.

@rhardih
Created June 18, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhardih/0e7d8c359868ea518d0e to your computer and use it in GitHub Desktop.
Save rhardih/0e7d8c359868ea518d0e to your computer and use it in GitHub Desktop.
Remove duplicates from a list of arguments in bash
#!/usr/bin/env bash
function uniquify {
echo "$@" | tr ' ' '\n' | sort -u | tr '\n' ' '
}
@rhardih
Copy link
Author

rhardih commented Jun 18, 2015

$ source uniquify.sh
$ uniquify aa bb cc aa bb dd
aa bb cc dd

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