Sponsored Content
Full Discussion: Output to shell variable
Top Forums Shell Programming and Scripting Output to shell variable Post 302578909 by agama on Friday 2nd of December 2011 11:37:57 PM
Old 12-03-2011
If you're using kshell or bash then this will work:

Code:
variable=$(head -n 1 ~/.fvwm/config | grep -c "some-string")

This User Gave Thanks to agama For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk redirect output to shell variable

I'm trying to redirect awk's output to a BASH variable. Currently the statement looks like this options=`awk '{ while (i < NF) { print $i; ++i } }' answer but for some reason that makes $options look like this: 1 2 3 4 1 2 3 Now, the input file 'answer' is taken from a dialog... (3 Replies)
Discussion started by: dhinge
3 Replies

2. Shell Programming and Scripting

assigning command output to a shell variable

I have the sql file cde.sql with the below contents: abcdefghij abcwhendefothers sdfghj when no one else when others wwhen%others exception when others Now I want to search for the strings containing when others together and ceck whether that does not occur more than once in the... (2 Replies)
Discussion started by: kprattip
2 Replies

3. Shell Programming and Scripting

assigning nawk output to shell variable

Hello friends, I doing the follwing script , but found problem to store it to a shell variable. #! /bin/sh for temp in `find ./dat/vector/ -name '*.file'` do echo $temp nawk -v temp=$temp 'BEGIN{ split(temp, a,"\/"); print a}' done output: ./dat/vector/drf_all_002.file... (6 Replies)
Discussion started by: user_prady
6 Replies

4. Shell Programming and Scripting

sql output to shell variable

Hi I tried searching but I used to see , this has been answered may times. But I could not find. I am looking a SQLPLUS output to be assigned to shell variable. This is what I coded. ##/bin/ksh sqlplus dmishr/mishra#09@ps004d.world <<ENDOFSQL spool abc.log SET ECHO OFF NEWP... (4 Replies)
Discussion started by: dgmm
4 Replies

5. Shell Programming and Scripting

Output of matlab as a variable for shell script

I'm running a matlab code within a shell script. This is how I do it, matlab -nodesktop -nosplash -nojvm -r "my_program;quit" This works fine. My matlab code prints out a single number, say "ans = 10" for example. I want to assign this to a variable in the shell script. I tried doing this... (18 Replies)
Discussion started by: lost.identity
18 Replies

6. Shell Programming and Scripting

Sending sqlplus output to a shell variable

I am trying to import a sqlplus output into a shell variable but it doesnt seem to be working. set -x export DEPENDENT_CR_NO=`sqlplus -s /nolog <<EOF conn username/passwd set heading off select dependency from custom_patches where patch_name='PATCH.zip'; exit; EOF` echo $DEPENDENT_CR_NO ... (2 Replies)
Discussion started by: beginer314
2 Replies

7. Shell Programming and Scripting

Passing sqlplus output to shell variable

Hi , I am using below code : for i in `ps -ef|grep pmon|awk {' print $8 '}|cut -f3 -d'_'|grep -v '^grep'` do ORACLE_SID=$i export ORACLE_SID; dest=`sqlplus "/ as sysdba" <<EOF set heading off feedback on verify off select DESTINATION from v\\$archive_dest where target in... (5 Replies)
Discussion started by: admin_db
5 Replies

8. UNIX for Beginners Questions & Answers

How to use printf to output a shell variable path?

So I created two shell variables: COLUMN1_HEADING, COLUMN2_HEADING. They have values: COLUMN1_HEADING="John" COLUMN2_HEADING="123456789" How would I use printf to get it to print an output like this: $COLUMN1_HEADING\t$COLUMN2_HEADING\nJohn\t123456789\n Thanks! (3 Replies)
Discussion started by: steezuschrist96
3 Replies
fvwm-config(1)							   Fvwm Modules 						    fvwm-config(1)

NAME
fvwm-config - query an existing fvwm installation SYNOPSIS
fvwm-config [--help] [--version] [--info] [--prefix] [--exec-prefix] [--bindir] [--datadir] [--libexecdir] [--sysconfdir] [--mandir] [--localedir] [--fvwm-moduledir] [--fvwm-datadir] [--fvwm-perllibdir] [--default-imagepath] [--default-userdir] [--fvwm-exe] [--supports] [--supports-<feature>] [--is-final] [--is-stable] [--release-date] DESCRIPTION
fvwm-config is a shell script that provides an information about the fvwm version, installation directories, built-in paths and supported features. OPTIONS
fvwm-config prints to the standard output in all options. Both short and long GNU-like option names may be used. -h --help -? prints the short usage -v --version -V prints the version -i --info prints the full info page -P --prefix prints the installation prefix -E --exec-prefix prints the installation exec-prefix -B --bindir prints the installation bindir -D --datadir prints the installation datadir -L --libexecdir prints the installation libexecdir -S --sysconfdir prints the installation sysconfdir -M --mandir prints the installation mandir -O --localedir prints the installation localedir -m --fvwm-moduledir prints FVWM_MODULEDIR, where the modules are installed -d --fvwm-datadir prints FVWM_DATADIR, where the system wide configs are installed -p --fvwm-perllibdir prints FVWM_PERLLIBDIR, where the perl library is installed -I --default-imagepath prints the built-in ImagePath -U --default-userdir prints the default FVWM_USERDIR, note: $HOME is not expanded -e --fvwm-exe prints the fvwm executable name (in bindir) -s --supports lists all supported features, one per line --supports-<feature> prints nothing, returns: 0 if the <feature> is supported, 100 if not, 200 if unknown. All or supported feature names may be found using --info or --supports respectively. --is-final prints "yes" for final releases and "no" for cvs snapshots --is-stable prints "yes" for the stable branch and "no" otherwise --release-date prints the release date if the release is final USAGE
Here are some real life usages. Checks for xft support: if fvwm-config --supports-xft; then echo 1; else echo 0; fi fvwm-themes package checks for the correct fvwm version installed using: fvwm-config --version and tries to use the same installation directories: fvwm-config --bindir --mandir --fvwm-datadir A way to find the full path to the fvwm executable: echo `fvwm-config --bindir`/`fvwm-config --fvwm-exe` A way to start modules in perl: use lib `fvwm-config -p | tr -d '0`; use FVWM::Module; For a more human readable output, try: fvwm-config --info COPYING
fvwm-config is a part of fvwm package and distributed by the same terms, see GNU GPL. AUTHOR
Mikhael Goikhman <migo@homemail.com> 3rd Berkeley Distribution 7 May 208 (2.5.26) fvwm-config(1)
All times are GMT -4. The time now is 05:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy