0

I'm playing around with listing the files and folders for Firefox profiles on a mac using a shell script. Right now, my code will get the profile folder names and put them in a list, but it splits the items in the list whenever it hits a space. I can't seem to find a way to concatenate the two parts of the whole folder path.

For example, the path /Users/username/Library/Application Support/Firefox/Profiles/ will end up being /Users/username/Library/Application Support/Firefox/Profiles/

Here is my code:

firefoxProfiles=$(find "/Users/$userName/Library/Application Support/Firefox/Profiles" -name '*.default*' -type d)
for x in $firefoxProfiles; do
echo "$x"
  • https://stackoverflow.com/questions/23356779/how-can-i-store-the-find-command-results-as-an-array-in-bash/54561526 – LMC Nov 10 '21 at 22:39
  • In evaluating answers on the linked duplicate, the best ones will be those that use the `-print0` or `-exec` arguments to `find`. – Charles Duffy Nov 10 '21 at 22:41
  • ...the "Actions", "Complex Actions", and "Actions In Bulk" sections of [Using Find](https://mywiki.wooledge.org/UsingFind) are also relevant -- maybe a better reference than anything in Stack Overflow, insofar as the wiki's contents are reviewed by actual experts. – Charles Duffy Nov 10 '21 at 22:42
  • Also, read [BashFAQ #20: How can I find and safely handle file names containing newlines, spaces or both?](http://mywiki.wooledge.org/BashFAQ/020) – Gordon Davisson Nov 10 '21 at 23:22
  • I didn’t see that post in my searches since I wasn’t thinking of an array at the time, but it makes sense. Thanks for all the resources! I’ll figure out which one works best and report back. – DarkKnight4251 Nov 10 '21 at 23:41

0 Answers0