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 04-07-2020, 01:44 AM   #1
darkshadow56
LQ Newbie
 
Registered: Apr 2020
Posts: 2

Rep: Reputation: Disabled
Question I want to know about expansion of variable and path name and how to demonstrate which one occurs first.


I need to write a script or series of commands to demonstrate what occurs first and how between variable expansion and pathname expansion.
It would be amazing if anyone could show me script.
 
Old 04-07-2020, 02:06 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Seems like a homework to me. From LQ 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.
BTW, in order just to learn what occurs first reading the manual page for your shell would be enough.

Last edited by shruggy; 04-07-2020 at 04:10 AM.
 
Old 04-07-2020, 02:36 AM   #3
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
My script (not tested):
Code:
VARIABLE=123
touch VARVAR
echo ${!V*}
 
Old 04-07-2020, 03:07 AM   #4
darkshadow56
LQ Newbie
 
Registered: Apr 2020
Posts: 2

Original Poster
Rep: Reputation: Disabled
please help me understand

its pretty noob thing but i read different articles and handbooks but i just don't get concept so I'm seeking ans in simple language and not in bookish language.
thanks.
 
Old 04-07-2020, 04:23 AM   #5
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
Quote:
Originally Posted by darkshadow56 View Post
its pretty noob thing but i read different articles and handbooks but i just don't get concept so I'm seeking ans in simple language and not in bookish language.
thanks.
From the manual page that shruggy linked to:
Quote:
The order of expansions is: brace expansion; tilde expansion, parameter and variable expansion, arithmetic expansion, and command substitution (done in a left-to-right fashion); word splitting; and filename expansion.
I hope you don't call that bookish.

Meanwhile, I did test my script, and it worked as expected.

Last edited by berndbausch; 04-07-2020 at 04:25 AM.
 
  


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
Run command via path expansion doesn't work even when variable is correct grob115 Linux - Server 7 11-09-2015 10:56 PM
variable expansion and pathname expansion ShadeLover Linux - General 6 04-22-2015 10:56 PM
Microsoft & Canonical demonstrate first fully automated OCP Deployment jeremy Linux - News 1 03-17-2015 12:25 PM
Need for examples which comprehensively demonstrate all software features daggett LQ Suggestions & Feedback 1 04-14-2011 11:38 AM
LXer: Simple Perl Script To Demonstrate DNS Name Lookups In Linux LXer Syndicated Linux News 0 05-24-2008 07:50 AM

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

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