LinuxQuestions.org
Visit Jeremy's Blog.
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 12-01-2016, 02:51 PM   #1
ang2183727
LQ Newbie
 
Registered: Dec 2016
Posts: 3

Rep: Reputation: 0
Help ME!! bash script


i am fairly new at bash scripting. i have a problem that i want to understand more.

how would i create a script (name).sh that sets an alias for the less command so that it will diplay numbers when 1 is used and the filename passed.

then reads th /etc/passwd file, ise the variable Line to store the data

Also uses a function to process the data from /etc/passwd
a) use the global variable,Line, when processing the data
b) information passed to the function from the main script is:
1. the username field number
2. the UID field number
c) the function will determine which UIDs are less than 100 and then write thoe to a file named: results.me.txt in the users home directory
i: use the form:
 
Old 12-01-2016, 02:55 PM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Current: Fedora and OpenSUSE. Past: Debian, Arch, RedHat (pre-RHEL). FreeBSD & OpenBSD, macOS (hack)
Posts: 1,215
Blog Entries: 7

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
Smells like homework. What have you come up with so far?
 
Old 12-01-2016, 03:01 PM   #3
ang2183727
LQ Newbie
 
Registered: Dec 2016
Posts: 3

Original Poster
Rep: Reputation: 0
yes as a second assignment i feel is pretty advanced, so i have gone into vim and set up the script but i am having trouble with the alias command
 
Old 12-01-2016, 03:19 PM   #4
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
 
Old 12-01-2016, 06:50 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 25,392

Rep: Reputation: 7569Reputation: 7569Reputation: 7569Reputation: 7569Reputation: 7569Reputation: 7569Reputation: 7569Reputation: 7569Reputation: 7569Reputation: 7569Reputation: 7569
Quote:
Originally Posted by ang2183727 View Post
yes as a second assignment i feel is pretty advanced, so i have gone into vim and set up the script but i am having trouble with the alias command
Ok..so tell us what trouble you're having. We can't guess...even more helpful if you actually posted what you've done/tried.
 
Old 12-01-2016, 09:29 PM   #6
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Post the output of the script you made in vim so TB0ne can read it.

We can't advise you on something we can't see.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Bash Script - Reading User Input while Processing output from Command within Bash cleeky Linux - General 5 05-27-2014 03:57 PM
How to end the bash script using commands in bash not manually by pressing ctrl+c Sanpreet Singh Linux - Newbie 1 07-03-2013 02:04 PM
[SOLVED] Converting Script from Linux (GNU) Bash 4 to Solaris Bash 2.05 - Any cheat sheet? oly_r Solaris / OpenSolaris 6 05-03-2013 09:25 AM
SSH connection from BASH script stops further BASH script commands tardis1 Linux - Newbie 3 12-06-2010 09:56 AM
[SOLVED] Using a long Bash command including single quotes and pipes in a Bash script antcore Linux - General 9 07-22-2009 12:10 PM

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

All times are GMT -5. The time now is 10:35 AM.

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