Sponsored Content
Top Forums Shell Programming and Scripting pipe to grep doesn't work in bash script Post 302597688 by Scrutinizer on Saturday 11th of February 2012 12:01:53 PM
Old 02-11-2012
You can either do this:
Code:
eval dastring=\`${cmnd}\`

or do this for example:
Code:
dastring=$(gvfs-mount -l | grep -i "${mount}")

-or with back ticks:-
Code:
dastring=`gvfs-mount -l | grep -i "${mount}"`

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep doesn't work within shell script?

I am trying to run the following code from a script file but it complains that syntax of (both instances of) grep is wrong. When I copy and paste it to the terminal, it is OK. Any idea what the problem might be? set i = `grep -c #define flags.h` while ($i>20) @ i-- my func (`cat... (4 Replies)
Discussion started by: barisgultekin
4 Replies

2. Linux

By angle-brackets/"pipe" button doesn't work?

How can I configure it? I have a swedish keyboard with swedish keyboard setting. Everything works perfectly (едц) except that button. What can be wrong? /Richard ++ NOTE: It seems like the computer notices the input but that the button isn't assigned to anything (the keyboard-cursor stops).... (1 Reply)
Discussion started by: riwa
1 Replies

3. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

4. Solaris

grep -e doesn't work on solaris

grep -e doesn't work in Soalris. Same script with grep -e worked on AIX/HP/LINUX.. I would like to search a list of patterns on "log.txt" like ... grep -e FATAL -e ERROR log.txt I get the error message as grep: illegal option -- e Usage: grep -hblcnsviw pattern file . . . (3 Replies)
Discussion started by: jmkraja
3 Replies

5. UNIX for Dummies Questions & Answers

For some reason, my grep doesn't work as expected

I am trying to find only those entries where 7018 and another number appear in the end of the line. 7018 2828 1423 2351 7018 2828 14887 2828 7018 1222 123 7018 1487 I am looking for a way to generate only the last two lines. I was trying to do just "grep '7018{1,5}" but it does not... (5 Replies)
Discussion started by: Legend986
5 Replies

6. Shell Programming and Scripting

two grep in one script doesn't work?

Hi there, the following script doesn't work. the first part works, then the second 'grep' fails with ': not found'. However, if I take out the second part (starting with the grep command) and put in a seperate script, it works. everyone know what's wrong here? no two 'grep' in one script, that... (2 Replies)
Discussion started by: monkey77
2 Replies

7. Shell Programming and Scripting

Grep doesn't work when assigning to variable

Hello, First of all, I'd like to say hello to all members of forum. Can You please help me with the matter described below? I am trying to fetch a data from the file to variable, I am doing this using below script: returned=`tail -50 SapLogs.log | grep -i -E "Error|"` echo $returned ... (2 Replies)
Discussion started by: jedzio
2 Replies

8. Shell Programming and Scripting

Rsync in bash script doesn't work even after placing pub key in target server

Hello Friends, My bash script is like this #!/bin/bash # request Bourne shell as shell for job #$ -S /bin/bash # assume current working directory as paths #$ -cwd #$ -N rsync-copy # # print date and time date rsync -rltD --progress "ssh -i /home/myname/.ssh/id_rsa"... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

9. Shell Programming and Scripting

Bash script: "mkdir -p" doesn't work with var(cat x)

Hello, :) I've an issue with the creation of a directory, All work without it :mad: So, below, my scripts with the debug output : #!/bin/bash # PATHS HOME_BACKUP="/home/backup" HOME_SCRIPT="/home/scripts/test/backup_server" TARGET="/var/www" # DATE DATE_Ymd=$(date +%Y-%m-%d) #... (1 Reply)
Discussion started by: Arnaudh78
1 Replies

10. UNIX for Beginners Questions & Answers

Bash diff date doesn't work

Hi everyone, I've an issue trying to soustracte two dates, e.g: d1=$(date -d "Nov 18, 2017" +%s) d2=$(date +%s) # Today we are 2017-11-16 echo "$(( (d1 - d2) / 86400 ))" Output: 1 I don't understand why it doesn't work. for me, it should give "18 - 16 = 2". Much appreciated... (1 Reply)
Discussion started by: Arnaudh78
1 Replies
gvfs-tree(1)							   User Commands						      gvfs-tree(1)

NAME
gvfs-tree - list contents of directories in a tree-like format using the VFS system SYNOPSIS
gvfs-tree [-h] [-l] URI DESCRIPTION
gvfs-tree lists contents of directories in a tree-like format using the VFS system. OPTIONS
The following options are supported: -h Show hidden files -l Follow symlinks, mounts and shortcuts like directoties EXAMPLES
Example 1: List the content of a local directory example% gvfs-tree file:///usr/bin/ Example 2: List the content of a remote directory example% gvfs-tree smb://server/resource/ ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gvfs-tree Executable to list contents of directories in a tree-like format using the VFS system ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-gvfs | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
gvfs-copy(1), gvfs-cat(1), gvfs-less(1), gvfs-info(1), gvfs-mkdir(1) gvfs-monitor-dir(1), gvfs-monitor-file(1), gvfs-mount(1), gvfs- move(1), gvfs-rename(1), gvfs-open(1), gvfs-rm(1), gvfs-save(1), gvfs-trash(1), gvfs-ls(1), attributes(5), environ(5) NOTES
Written by Alvaro Lopez Ortega, Sun Microsystems Inc., 2008. SunOS 5.11 25 Mar 2008 gvfs-tree(1)
All times are GMT -4. The time now is 02:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy