LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 07-12-2006, 10:55 AM   #1
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Variable in Script


How can I make a variable in a script. One of the file that I need to look at every morning uses the julian date as an extension.
 
Old 07-12-2006, 01:06 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Original Poster
Rep: Reputation: 102Reputation: 102
I found out how. For anyone that wants to know it is just
variablename=value

x="ABC"

also if you want to make a variable be a command just type in the following.

x=$(command goes here)
echo $x //That will run the command.
 
Old 07-14-2006, 08:53 AM   #3
AbrahamJose
Member
 
Registered: Feb 2006
Location: India
Posts: 167

Rep: Reputation: 31
Post Good thing

Thank u for posting the answer, eventhough u found it by yourself.
This is a good habit.
As a script developer, the second part of your answer is very useful to me.
 
Old 07-14-2006, 09:02 AM   #4
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Quote:
Originally Posted by jstephens84
x=$(command goes here)
echo $x //That will run the command.
No, the first line will run the command and assign the command's output to the variable x. The second line will then print the output.

Last edited by spirit receiver; 07-20-2006 at 05:21 PM.
 
Old 07-14-2006, 09:21 AM   #5
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Original Poster
Rep: Reputation: 102Reputation: 102
Thanks guys did not know that.
 
  


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
Shell script --cannot assign variable-- ralvez Programming 6 02-24-2006 04:56 PM
Help with shell script, can't show variable stormrider_may Programming 5 01-27-2006 05:22 PM
variable one script to another rharris72 Programming 2 11-23-2005 01:17 AM
Query about script variable phantomdude Linux - Newbie 1 03-18-2004 11:21 AM
Bash script renaming a variable zael Programming 3 09-30-2003 04:37 AM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

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