LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-08-2016, 09:25 AM   #1
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Rep: Reputation: Disabled
Script trouble


hi everyone!
I came across to this question and excuse my ignorance but, I do not understand the question at all. Would someone please give me some guidance? thank you!

If the command line to run your script looks like this:

./scriptname file1 file2

What would $2 refer to in the script?
 
Old 06-08-2016, 09:41 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by torito View Post
hi everyone!
I came across to this question and excuse my ignorance but, I do not understand the question at all. Would someone please give me some guidance? thank you!

If the command line to run your script looks like this:

./scriptname file1 file2

What would $2 refer to in the script?
This looks very much like homework. Believe it or not, despite the rule against homework:
Quote:
Originally Posted by LQ rules
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.
http://www.linuxquestions.org/linux/rules.html
...I am not opposed to help out with these kind of questions. Provided that you tell *up front* that it is indeed homework.

Homework or not; I suggest you use DuckDuckGo, you will find the answer in a minute.
https://is.gd/ez6qCb

Best regards,
HMW
 
2 members found this post helpful.
Old 06-08-2016, 09:42 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,681

Rep: Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971Reputation: 7971
Quote:
Originally Posted by torito View Post
hi everyone!
I came across to this question and excuse my ignorance but, I do not understand the question at all. Would someone please give me some guidance? thank you!

If the command line to run your script looks like this:

./scriptname file1 file2

What would $2 refer to in the script?
Seems like it's another homework question....have you checked your textbooks and/or asked your instructor??

Think about what you're doing here...you're typing in a script name, and two command line arguments to that script. The first argument would be, $1....so......

I agree with HMW...we don't mind helping out with homework, but you need to be upfront about it, and you do need to show some effort of your own. These questions are to help YOU learn, so you have to start thinking about them, and trying to figure them out.

Last edited by TB0ne; 06-08-2016 at 09:44 AM.
 
2 members found this post helpful.
Old 06-08-2016, 09:54 AM   #4
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Original Poster
Rep: Reputation: Disabled
I am very confuse about the rules about this forum... I am an old dude trying to learn Linux for the class I am taking. If you see my post history, at the begging I used the word "Homework" and I was told not to use that word anymore. So I am not using it.

With my post, I am not looking for people to just give me the answer and move on! I am 41 years old and because I did not do what I was suppose to do when I was a young man, I am back in school dealing with three kiddos at home at the same time trying to get a degree. I am here to LEARN, not to pass a course. So, I do not understand what they are saying about $2 in the script.

Thank you for your understanding and help. Would you please give me some guidance?
 
Old 06-08-2016, 10:00 AM   #5
dab1414
Member
 
Registered: May 2011
Location: OK, USA
Distribution: Slackware 14.1_64
Posts: 76

Rep: Reputation: 52
You have been given the tools to LEARN this already.

Quote:
Originally Posted by HMW View Post
Homework or not; I suggest you use DuckDuckGo, you will find the answer in a minute.
https://is.gd/ez6qCb
Quote:
Originally Posted by TB0ne View Post
Think about what you're doing here...you're typing in a script name, and two command line arguments to that script. The first argument would be, $1....so......
 
1 members found this post helpful.
Old 06-08-2016, 10:05 AM   #6
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by torito View Post
I am very confuse about the rules about this forum... I am an old dude trying to learn Linux for the class I am taking. If you see my post history, at the begging I used the word "Homework" and I was told not to use that word anymore. So I am not using it.

With my post, I am not looking for people to just give me the answer and move on! I am 41 years old and because I did not do what I was suppose to do when I was a young man, I am back in school dealing with three kiddos at home at the same time trying to get a degree. I am here to LEARN, not to pass a course. So, I do not understand what they are saying about $2 in the script.

Thank you for your understanding and help. Would you please give me some guidance?
But... this course you are taking must surely have textbooks of some kind, or provide some sort of online help?

Regardless, if you clicked the link(s) I provided from DuckDuckGo, you will find all the necessary information about $2. Also, TB0ne provided you with more than just a small hint in his post.

I too have taken classes with small kids at home. I know that it is not easy.
 
Old 06-08-2016, 10:10 AM   #7
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thank you guys! Expecially TB0ne and HWM.

I didn't know about duckduckg.com
 
Old 06-08-2016, 10:12 AM   #8
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by torito View Post
Thank you guys! Expecially TB0ne and HWM.

I didn't know about duckduckg.com
DuckDuckGo is like Google minus the spying and intrusion! In other words; a search engine. Use it!

Best regards,
HMW
 
Old 06-08-2016, 10:15 AM   #9
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Original Poster
Rep: Reputation: Disabled
SO you mean that I can use it as my default search engine instead of Google?
 
Old 06-08-2016, 10:48 AM   #10
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by torito View Post
SO you mean that I can use it as my default search engine instead of Google?
Yes, if you use Firefox, see this link:
https://duck.co/help/desktop/firefox
 
Old 06-08-2016, 10:50 AM   #11
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thumbs up

Thank you VERY much HMW!
 
  


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
Trouble with script gilad73 Linux - Newbie 8 07-30-2012 05:57 AM
Convert ksh script into bsh script trouble dan-e Linux - Newbie 1 05-09-2011 01:11 AM
Having trouble with cp command in my script. maprice Linux - General 1 03-18-2008 01:37 PM
Trouble with script and bc Freestone Linux - General 4 10-11-2006 06:10 PM
Trouble with my first SlackBuild script Yalla-One Slackware 6 06-10-2006 02:03 PM

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

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