LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 11-13-2015, 03:22 PM   #1
ThatCyberGuy
LQ Newbie
 
Registered: Nov 2015
Posts: 1

Rep: Reputation: Disabled
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.
 
Old 11-13-2015, 05:23 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Welcome to LinuxQuestions

Per the rules
Quote:
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.
 
Old 11-14-2015, 12:49 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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.
 
Old 11-14-2015, 01:58 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Two shell tutorials. Find the Bash Guide on Wooledge.org, and the advanced bash scripting guide on tldp.org.
 
Old 11-14-2015, 02:58 PM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Member response

Hi,

Welcome to LQ!

If this is homework then you should be asking the instructor. You may find the following useful;
Quote:
Just a few links to aid you to gaining some understanding;


1 Linux Documentation Project
2
Rute Tutorial & Exposition
3
Linux Command Guide
4 Bash Beginners Guide
5
Bash Reference Manual
6
Advanced Bash-Scripting Guide
7
Linux Newbie Admin Guide
8
LinuxSelfHelp
9
Utimate Linux Newbie Guide

The above links and others can be found at '
Slackware-Links'. More than just SlackwareŽ links!
EDIT: Look here; http://www.linuxquestions.org/questi...#faq_lqwelcome
Hope this helps.
Have fun & enjoy!

Last edited by onebuck; 11-14-2015 at 02:59 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH scripting Condition Statements Xyaib Linux - General 1 01-23-2013 02:18 PM
IP aliases, test environments, and address binding... fmillion Linux - Networking 2 06-21-2009 05:23 PM
bash scripting problem with nested if statements in while loop error xskycamefalling Programming 4 05-11-2009 03:14 PM
scripting/aliases mayaabboud Linux - Newbie 8 01-02-2008 08:58 AM
if statements and case statements not working in bourne shell script mparkhurs Programming 3 06-12-2004 02:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration