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
macOS & iOS Developer Playground
macOS - Development and Darwin
Creating a script (like a windows batch file)
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="Dysfunction" data-source="post: 1355736" data-attributes="member: 51052"><p>Sure.. it's good practice to shebang the scripts though.</p><p></p><p>That is...</p><p></p><p>[code]</p><p>#!/bin/bash</p><p>fsck -fy</p><p>mount -uw /</p><p>rm /var/db/.applesetupdone</p><p>cd /users</p><p>rm -rf user</p><p>reboot #does this need to be done with elevated permissions? If so, toss in sudo</p><p></p><p>[/code]</p><p></p><p>It would be easy, at this point to establish what user by simply doing something like...</p><p></p><p>[code]</p><p>#!/bin/bash</p><p>if [ $# -ne 1 ] ; then </p><p> echo "Usage: $0 username"</p><p> exit</p><p>fi</p><p></p><p>fsck -fy</p><p>mount -uw /</p><p>rm /var/db/.applesetupdone</p><p>rm -rf /users/$1</p><p>reboot #does this need to be done with elevated permissions? If so, toss in sudo</p><p>[/code]</p></blockquote><p></p>
[QUOTE="Dysfunction, post: 1355736, member: 51052"] Sure.. it's good practice to shebang the scripts though. That is... [code] #!/bin/bash fsck -fy mount -uw / rm /var/db/.applesetupdone cd /users rm -rf user reboot #does this need to be done with elevated permissions? If so, toss in sudo [/code] It would be easy, at this point to establish what user by simply doing something like... [code] #!/bin/bash if [ $# -ne 1 ] ; then echo "Usage: $0 username" exit fi fsck -fy mount -uw / rm /var/db/.applesetupdone rm -rf /users/$1 reboot #does this need to be done with elevated permissions? If so, toss in sudo [/code] [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Creating a script (like a windows batch file)
Top