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
Change ownership of home directory
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="Raz0rEdge" data-source="post: 1785051" data-attributes="member: 110816"><p>Assuming this is a BASH shell script, do you have appropriate checks around the various functions? That is, I would do the chown in the following way</p><p>[CODE]</p><p>if [ -e $userdir ]; then</p><p> chown -R $tgtgu $userdir</p><p>else</p><p> echo "$userdir doesn't exist"</p><p>fi</p><p>[/CODE]</p><p></p><p>This should ensure that the folder exists before you try to change ownership. I assume you have error checking in place but have provided a streamlined version of your commands for input.</p><p></p><p>Also, I'm confused by your use of quotes and escaped quotes in the script since those are variables to commands and not being printed, so not sure why you are using those.</p></blockquote><p></p>
[QUOTE="Raz0rEdge, post: 1785051, member: 110816"] Assuming this is a BASH shell script, do you have appropriate checks around the various functions? That is, I would do the chown in the following way [CODE] if [ -e $userdir ]; then chown -R $tgtgu $userdir else echo "$userdir doesn't exist" fi [/CODE] This should ensure that the folder exists before you try to change ownership. I assume you have error checking in place but have provided a streamlined version of your commands for input. Also, I'm confused by your use of quotes and escaped quotes in the script since those are variables to commands and not being printed, so not sure why you are using those. [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Change ownership of home directory
Top