Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 02-05-2004, 05:05 PM   #1
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

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

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

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

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


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

All times are GMT -5. The time now is 12:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration