LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-03-2022, 01:57 AM   #1
egodeath0
LQ Newbie
 
Registered: Oct 2022
Posts: 1

Rep: Reputation: 0
Unhappy Bash Scripts Newbie. Asking for help to understand the assignment


I have an assignment to do which i also need to understand. Asking your help to write it and explain it in an easier form possible. ♡♡♡

1. script gets arguments
2. script asks user in which order to show arguments
3. script reads user's answer (as example - if users enters a nubmer bigger than 0, script shows arguments in ascending order)
4. Script shows total number of arguments and reads them in given by user format

Thank you guys! ♡♡♡
 
Old 10-03-2022, 07:59 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by egodeath0 View Post
I have an assignment to do which i also need to understand. Asking your help to write it and explain it in an easier form possible. ♡♡♡

1. script gets arguments
2. script asks user in which order to show arguments
3. script reads user's answer (as example - if users enters a nubmer bigger than 0, script shows arguments in ascending order)
4. Script shows total number of arguments and reads them in given by user format

Thank you guys! ♡♡♡
Welcome to LQ,

What best helps is if you show us your work.

https://www.linuxquestions.org/linux/rules.html

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 10-03-2022, 08:37 AM   #3
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
I'll give you a bit of a start with script gets arguements = positional parameters.
 
Old 10-03-2022, 09:21 AM   #4
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
I will provide an additional hint.
https://tldp.org/LDP/abs/html/index.html
 
Old 10-04-2022, 12:01 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
K.I.S.S - Keep It Simple Stupid ie do one part at a time; don't try to do the whole script immediately.

The 2nd line in your script should be
Code:
set -xv
whilst debugging.
 
Old 10-04-2022, 01:52 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
this was the first hit by google: https://www.baeldung.com/linux/use-c...in-bash-script
I guess you can start with this.
 
  


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
LXer: Python Scripts as a Replacement for Bash Utility Scripts LXer Syndicated Linux News 1 01-17-2013 08:08 AM
Help with an assignment: writing a bash script hayah Programming 26 10-04-2010 09:57 PM
[SOLVED] [BASH] variable assignment help RaptorX Programming 2 08-30-2009 10:28 AM
Don't understand OpenVPN IP-assignment jonaskellens Linux - Newbie 6 08-23-2009 01:21 PM

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

All times are GMT -5. The time now is 11:43 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