You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/env bash
dirname="foo"# Create the directory under /usr/local with group ownership set to "admin"
sudo mkdir "/usr/local/$dirname"
sudo chown :admin "/usr/local/$dirname"# Change the owner of the directory to local user
sudo chown $USER"/usr/local/$dirname"# Check if the directory was created, group ownership was set, and owner was changed successfullyif [ $?-eq 0 ];thenecho"Directory '$dirname' created successfully under /usr/local with group ownership set to 'admin' and owner changed to '$USER'"elseecho"Failed to create directory '$dirname', set group ownership to 'admin', or change owner to '$USER'"fi
In this version of the script, we've used sudo to create the directory "foo" under /usr/local, and then used sudo chown to set the group ownership of the directory to "admin". The rest of the script remains the same, and it will provide feedback on whether the directory was created and group ownership was set successfully or not. Please use caution when using sudo and make sure to understand the implications of running commands with administrative privileges. Additionally, ensure that the "admin" group exists on your system before using it as the group ownership.
The text was updated successfully, but these errors were encountered:
Starting point...
In this version of the script, we've used sudo to create the directory "foo" under /usr/local, and then used sudo chown to set the group ownership of the directory to "admin". The rest of the script remains the same, and it will provide feedback on whether the directory was created and group ownership was set successfully or not. Please use caution when using sudo and make sure to understand the implications of running commands with administrative privileges. Additionally, ensure that the "admin" group exists on your system before using it as the group ownership.
The text was updated successfully, but these errors were encountered: