Help with basic bash scipting
Go to solution
Solved by Willowwizard,
For bash scripting you can use a cheatsheet (for example, I use this one) to learn about the programmatic elements (e.g. program flow elements like if, for, while, etc.).
and as for other functions like copying (cp) and moving (mv), as tikker said, you can use the man command to view it's documentation.
Here's an example for the first script, anyway:
Spoiler
#!/usr/bin/bash if [ ! -f test ]; then # If file "test" does not exist, then echo "" > test # Create (overwrite if it exists) file "test" with blank contents else # If file "test" does exist then echo "" > test2 # Create (overwrite if it exists) file "test2" with blank contents fi # End of if statement cp test temp # Copy file "test" into "temp" (overwriting if it exists) mv test ./storage/.conf # Move "test" into storage/.conf/ (storage/.conf must exist beforehand) mv temp ./storage/.conf # Move "temp" into storage/.conf/ (storage/.conf must exist beforehand)
Edit: You can learn about user/group/password management here
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now