Skip to main content
Question

Wildcard in shell script error when pushing through Casper?


Forum|alt.badge.img+12

I'm pushing a script to change firefox settings that uses as a wildcard. When I run the script locally, the script executes with no issues. When I push from Casper, it doesn't recognize as a wildcard. See script below.

I'm using a * because the profile names are randomized for Firefox. For example, mine is 71jal12.default.

!/bin/sh

currentuser=stat -f "%Su" /dev/console

Modify Firefox settings

echo user_pref("network.automatic-ntlm-auth.trusted-uris", "iwa.com"); >> /Users/$currentuser/Library/Application Support/Firefox/Profiles/.default/prefs.js
echo user_pref("network.negotiate-auth.trusted-uris", "iwa.com"); >> /Users/$currentuser/Library/Application Support/Firefox/Profiles/.default/prefs.js

Output from JAMF log -
/Users/bwong/Library/Application Support/Firefox/Profiles/.default/prefs.js: No such file or directory
/Library/Application Support/JAMF/tmp/enableSSOBrowsers: line 13: /Users/bwong/Library/Application Support/Firefox/Profiles/
.default/prefs.js: No such file or directory

Forum|alt.badge.img+7
  • Contributor
  • October 17, 2016

Try

echo 'user_pref("network.automatic-ntlm-auth.trusted-uris", "iwa.com");' >> /Users/"$currentuser"/Library/Application Support/Firefox/Profiles/*.default/prefs.js
echo 'user_pref("network.negotiate-auth.trusted-uris", "iwa.com");' >> /Users/"$currentuser"/Library/Application Support/Firefox/Profiles/*.default/prefs.js

Forum|alt.badge.img+12
  • Contributor
  • October 17, 2016

I ended up using the following. Thanks!

echo user_pref("network.automatic-ntlm-auth.trusted-uris", "*iwa..com"); >> /Users/$currentuser/Library/Application Support/Firefox/Profiles/*.default/prefs.js
echo user_pref("network.negotiate-auth.trusted-uris", "*iwa..com"); >> /Users/$currentuser/Library/Application Support/Firefox/Profiles/*.default/prefs.js

Forum|alt.badge.img+7
  • Contributor
  • October 17, 2016

This applies more to double quoting rather than single quoting, but a good rule of thumb is to use quotes, unless you have a specific reason not to. Makes life way easier :)


Forum|alt.badge.img+12
  • Contributor
  • October 17, 2016

Gotcha. I also found another thing. It doesn't work if I'm using #!/bin/sh... switched it to #!/bin/bash and it started working.


Forum|alt.badge.img+12
  • Contributor
  • October 18, 2016

Spoke too soon... appears to be working on 3/4 of our machines. Some machines are still not taking the *.

JAMF Log -- /Users/bwong/Library/Application Support/Firefox/Profiles/.default/prefs.js: No such file or directory
/Library/Application Support/JAMF/tmp/enableSSOBrowsers: line 13: /Users/bwong/Library/Application Support/Firefox/Profiles/
.default/prefs.js: No such file or directory


Forum|alt.badge.img+12
  • Contributor
  • October 18, 2016

Spoke too soon again... found out that some user's firefox profiles were not just like 5sjl23i.default...but they were 5al369aj.default-18559871

I added a .default and it's working now.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings