Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-02-2011, 12:29 PM   #1
LQ Newbie
Registered: Jun 2011
Posts: 7

Rep: Reputation: Disabled
Redirecting command output to input of another command

HI guys,

Sorry I can't wrap my head around this one. So hopefully someone can help.

I want to run

gsettings list-schemas (which return a list of about 100 names separated by spaces)

and somehow direct each name one at a time as the input to this command:

gsettings list-recursively

I've tried it with awk, and standard | piping and also as a string variable strvar=$(gsettings list-schemas) and using the $strvar as the input but I am missing something in between I'm sure like for - while or proper syntax of awk etc

Can someone help as I would like to be able to save the output of each schema entry to make it easy searching etc

Thanks heaps in advance
Old 07-02-2011, 12:32 PM   #2
Registered: Jul 2004
Distribution: Arch Linux, Ubuntu
Posts: 80

Rep: Reputation: 16
Not @ my computer to test but you might be able to use shift along with awk. Id google awk shift entries to see if anything comes up.
Old 07-02-2011, 01:07 PM   #3
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 834
Blog Entries: 3

Rep: Reputation: 296Reputation: 296Reputation: 296
This script should do the job:

for i in `gsettings list-schemas`; do
	gsettings list-recursively $i
Or as a one liner:
for i in `gsettings list-schemas`; do gsettings list-recursively $i; done
Old 07-02-2011, 01:28 PM   #4
LQ Newbie
Registered: Jun 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks heaps man that's just what I was after
1 members found this post helpful.


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
redirecting output from a command using bash nano2 Linux - General 2 05-10-2011 04:35 PM
Bash scripting: redirecting input to a command hal8000b Programming 2 12-10-2007 08:29 AM
bash command redirecting output to file freeindy Programming 10 11-08-2007 06:48 AM
Redirecting output of running command tommyr1216 Linux - General 3 03-04-2005 09:20 PM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 05:35 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:52 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
Open Source Consulting | Domain Registration