LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-05-2004, 05:05 PM   #1
fooforon
Member
 
Registered: Sep 2003
Posts: 37

Rep: Reputation: 15
command output to varible!!!


Hi, I was wondering how to store a commands output in a varible this is example of what I have been trying


$z = ls -a ~ | grep .path the out put of this command is ".path"
but will not store in this varible and someone please help me im using bash scripting. thanks ahead of time

Jamie
 
Old 02-05-2004, 05:21 PM   #2
artur
Member
 
Registered: Apr 2002
Location: Illinois, US
Distribution: Red Hat, Fedora, Yellow Dog, Debian, FreeBSD, Embedix
Posts: 106

Rep: Reputation: 15
Code:
z="$(ls -a ~ | grep .path)"
 
Old 02-05-2004, 05:46 PM   #3
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
another method is
Code:
z=`ls -a ~ | grep .path`
 
Old 02-05-2004, 08:41 PM   #4
fooforon
Member
 
Registered: Sep 2003
Posts: 37

Original Poster
Rep: Reputation: 15
thank you very much guys
 
  


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
Problem setting DISPLAY varible abefroman SUSE / openSUSE 1 05-09-2005 04:23 PM
Assign command output to a varible. wilku Linux - Newbie 3 03-26-2005 11:56 AM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 04:35 PM
' last -i ' command output praveenv Linux - Newbie 1 08-23-2004 02:14 PM
how to export a varible in the kernel firefoxii Programming 0 06-08-2004 04:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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