Help with scripting, aliases, and test statements.
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Help with scripting, aliases, and test statements.
Hello I am working through projects and I am really confused, I don't understand scripting very well yet, and I do not understand how to use test statements. Here are some questions I am trying to figure out:
Creating an alias called mm that displays only those filesystems that are mounted and contain an ext4 filesystem.
Creating and exporting a varialbe called NEWHOME that is equivalent to the value contained in the HOME variable.
Finding all files that start with the word "host" starting from the /etc directory and save the Standard Output to a file called file1 and the Standard Error to the same file.
Displaying only the lines from the output of the set command that have the word "bash" in them and the list should be sorted alphabetically.
Displaying only the user name in the colon-delimited /etc/passwd file and save the output to a file called users in the current directory.
And here are the ones I am trying to work through that involve the test statements.
Name the test statement that can be used to test to the following scenarios:
The user has read permission to the /etc/hosts file.
The user has read and execute permission to the /etc directory.
The contents of the variable $TEST are equal to the string "success"
The contents of the variable $TEST are equal to the string "success" and the file /etc/hosts exists.
The contents of the variable $TEST are equal to the string "success," or the number 5, or the contents of the variable $RESULT.
Any help with these questions would be greatly appreciated. I am having trouble learning about these commands and I don't know the commands needed to answer these questions. Thank you.
Do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and searches) and we'll do our best to help. Keep in mind that your instructor might also be an LQ member.
I believe many of your answers are only a google search away but you could also try the man or help command (such as man test or help test).
As indicated above, please show us something we can help with. If you show us what you have tried and where you are stuck you will get a tonne of help from those on this site.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.