Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash one-liner to print a list of unique names in ownCloud apps
# Create a temporary file to store the results of the script
tmpfile=$(mktemp /tmp/dirnames.XXX);
# Print the directories found in each app directory
for i in $( ls . )
ls -A $i >> $tmpfile
# Sort and print a unique list of the discovered directories
sort < $tmpfile | uniq
# Remove the temp file after use
unlink $tmpfile
tmpfile=$(mktemp /tmp/dirnames.XXX) && for i in $( ls . ); do ls -A $i >> $tmpfile; done && sort < $tmpfile | uniq && unlink $tmpfile

This comment has been minimized.

Copy link
Owner Author

settermjd commented Jan 30, 2019

Recently, I've been updating a section of the ownCloud developer tutorial, and needed to find a unique list of the names of directories that are commonly available for ownCloud apps. This bash one-liner almost did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.