LinuxQuestions.org
Review your favorite Linux distribution.
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 07-02-2011, 12:29 PM   #1
mightymouse2045
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
raevin
Member
 
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
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 384
Blog Entries: 2

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

Code:
#!/bin/sh
for i in `gsettings list-schemas`; do
	gsettings list-recursively $i
done
Or as a one liner:
Code:
for i in `gsettings list-schemas`; do gsettings list-recursively $i; done
 
Old 07-02-2011, 01:28 PM   #4
mightymouse2045
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.
  


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
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


All times are GMT -5. The time now is 01:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration