Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Computing Products:
macOS - Operating System
Syntax help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mohibb" data-source="post: 1399078" data-attributes="member: 249837"><p>#!/bin/bash</p><p></p><p>bash -c if [ system_profiler SPAirPortDataType | grep theprinceandthepauper: ] = theprinceandthepauper;</p><p> then</p><p> sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist;</p><p> sudo launchctl load -w /System/Library/LaunchDaemons/smbd.plist;</p><p> echo "connected to princeandpauper sharings settings"</p><p> elif [ system_profiler SPAirPortDataType | grep eduroam: ] = eduroam;</p><p> then</p><p> sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist;</p><p> sudo launchctl unload -w /System/Library/LaunchDaemons/smbd.plist;</p><p> echo "connected to eduroam and settings applied"</p><p> else</p><p> sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist;</p><p> sudo launchctl unload -w /System/Library/LaunchDaemons/smbd.plist;</p><p> echo "connected to unknown"</p><p> fi</p><p></p><p>im getting an error everytime i run this. Some silly syntax cant figure out what it is?</p><p></p><p>[: -c: line 1: syntax error: unexpected end of file</p><p>grep: ]: No such file or directory</p><p>grep: =: No such file or directory</p><p>grep: theprinceandthepauper: No such file or directory</p><p>homesharing.sh: line 4: syntax error near unexpected token `then'</p><p>homesharing.sh: line 4: ` then'</p></blockquote><p></p>
[QUOTE="mohibb, post: 1399078, member: 249837"] #!/bin/bash bash -c if [ system_profiler SPAirPortDataType | grep theprinceandthepauper: ] = theprinceandthepauper; then sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist; sudo launchctl load -w /System/Library/LaunchDaemons/smbd.plist; echo "connected to princeandpauper sharings settings" elif [ system_profiler SPAirPortDataType | grep eduroam: ] = eduroam; then sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist; sudo launchctl unload -w /System/Library/LaunchDaemons/smbd.plist; echo "connected to eduroam and settings applied" else sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist; sudo launchctl unload -w /System/Library/LaunchDaemons/smbd.plist; echo "connected to unknown" fi im getting an error everytime i run this. Some silly syntax cant figure out what it is? [: -c: line 1: syntax error: unexpected end of file grep: ]: No such file or directory grep: =: No such file or directory grep: theprinceandthepauper: No such file or directory homesharing.sh: line 4: syntax error near unexpected token `then' homesharing.sh: line 4: ` then' [/QUOTE]
Verification
Name this item 🌈
Post reply
Forums
Apple Computing Products:
macOS - Operating System
Syntax help
Top