Skip to main content
Question

Wildcard in shell script error when pushing through Casper?

  • October 14, 2016
  • 6 replies
  • 18 views

Forum|alt.badge.img+12
  • Contributor
  • 288 replies

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

6 replies

Forum|alt.badge.img+7
  • Contributor
  • 50 replies
  • 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
  • Author
  • Contributor
  • 288 replies
  • 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
  • 50 replies
  • 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
  • Author
  • Contributor
  • 288 replies
  • 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
  • Author
  • Contributor
  • 288 replies
  • 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
  • Author
  • Contributor
  • 288 replies
  • 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.