Sponsored Content
Full Discussion: bash shell piping
Top Forums Shell Programming and Scripting bash shell piping Post 302230075 by RockyC123 on Thursday 28th of August 2008 02:44:05 PM
Old 08-28-2008
bash shell piping

Hello all,

I am new to bash. I am trying to get a sub string of a variable in a shell script. While trying to do that I get the following error:

------------------------------------------------------------------------
OHOME: /aaa/bbb/product/eee
./t.sh: line 6: /aaa/bbb/product/eee: No such file or directory
Oracle Base:
------------------------------------------------------------------------

Here is the code:

------------------------------------------------------------------------
#!/bin/sh

OHOME=/aaa/bbb/product/eee
echo " OHOME: "$OHOME

O_BASE=echo $OHOME | awk -F"/" '{for(i=2;i<=NF;i++) {if($i=="product"){exit;} a=a"/"$i; }} '

echo " Oracle Base: "$O_BASE
------------------------------------------------------------------------

I am very surprised. Since it does not seem to like "echo $OHOME" I tried several things like enclosing in brackets, single/double quotes, etc. I still get this error. I cannot seem to find the syntax from the book or google Smilie

Looks very simple, but I am stuck on this for hours. Maybe experts here can guide me.

Here is our Linux version:

Linux <name> 2.6.9-67.0.20.ELsmp #1 SMP Wed Jun 18 12:40:47 EDT 2008 i686 i686 i386 GNU/Linux

Rocky.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run a C Shell using only Bash shell

Hi, I have only bash on my system. And I want to run a C shell... Is there a way for that? (3 Replies)
Discussion started by: HSN
3 Replies

2. Shell Programming and Scripting

Piping from BASH in to an Instant Messenger??

Is it possible to pipe a command in to an instant messenger e.g pidgin, finch or something similar and have it send??? e.g echo "hello" | messenger Or is there anything similar?? Thanks in advance! (1 Reply)
Discussion started by: 64mb
1 Replies

3. Shell Programming and Scripting

I need to understand the differences between the bash shell and the Bourne shell

I do not claim to be an expert, but I have done things with scripts that whole teams of folks have said can not be done. Of course they should have said we do not have the intestinal fortitude to git-r-done. I have been using UNIX actually HPUX since 1992. Unfortunately my old computer died and... (7 Replies)
Discussion started by: awk_sed_hello
7 Replies

4. Shell Programming and Scripting

Piping output from a command into bash script

Hi all. I am using procmail to deliver an email to a script I am developing. Procmail delivers the email to the script on standard input. I imagine this is the same as piping input from a command into the script. Hence I've been testing my script by running echo 'test' | sms-autosend-backup.sh ... (2 Replies)
Discussion started by: akindo
2 Replies

5. Shell Programming and Scripting

Exit code from piping in unix shell script

Hi , I have following code in my shell script : "$TS_BIN/tranfrmr" "${TS_SETTINGS}/tranfrmr_p1.stx" "${TS_LOGS}/tranfrmr_p1.err" | ( "$TS_BIN/cusparse" "${TS_SETTINGS}/cusparse_p2.stx" "${TS_LOGS}/cusparse_p2.err" | ( "$TS_BIN/tsqsort" "${TS_SETTINGS}/srtforpm_p3.stx"... (8 Replies)
Discussion started by: sonu_pal
8 Replies

6. Shell Programming and Scripting

Oneliner ---split string to character by piping shell output to perl

Hello, I was trying to split a string to characters by perl oneliner. echo "The quick brown fox jumps over the lazy dog" | perl -e 'split // ' But did not work as with bash script pipe: echo "The quick brown fox jumps over the lazy dog" | fold -w1 | sort | uniq -ic 8 1 T 1... (6 Replies)
Discussion started by: yifangt
6 Replies

7. UNIX for Dummies Questions & Answers

Which of the following command displays your login shell in bash shell?

Options:: A)$shell B)echo $ bash C)echo $ O D)$ O (1 Reply)
Discussion started by: raghugowda
1 Replies

8. Programming

Linux Shell Piping w/Shared Memory

So I am pretty new to the linux environment, and I am trying to create a shell that uses multiple pipes, and I read online that piping using shared memory space is more efficient than using regular piping. However, I have zero clue how to use shared memory space with pipes. Has anyone done this... (1 Reply)
Discussion started by: Greg_MC
1 Replies

9. Shell Programming and Scripting

Different behavior between bash shell and bash script for cmd

So I'm trying to pass certain json elements as env vars and use them later on in a script. Sample json: JSON='{ "Element1": "file-123456", "Element2": "Name, of, company written in, a very weird way", "Element3": "path/to/some/file.txt", }' (part of the) script: for s... (5 Replies)
Discussion started by: da1
5 Replies

10. UNIX for Beginners Questions & Answers

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed

In Bash shell - the ps -ef shows only the /bin/bash but the script name is not displayed ? Is there any way to get the script names for the process command ? --- Post updated at 08:39 AM --- in KSH (Korn Shell), my command output shows the script names but when run in the Bash Shell... (3 Replies)
Discussion started by: i4ismail
3 Replies
TORRUS_ACTION_NOTIFY(7) 					      torrus						   TORRUS_ACTION_NOTIFY(7)

NAME
action_notify - Generic notification handler for Torrus monitor SYNOPSIS
<action name="notify"> <param name="action-type" value="exec" /> <param name="command"> $TORRUS_BIN/action_notify </param> <param name="launch-when" value="set" /> </action> DESCRIPTION
This program is designed for usage from a monitor action only. It takes the arguments from environment variables, as described in action- type "exec" in Torrus XML Configuration Guide. The handler reads its configuration from <notify-siteconfig.pl>, a small Perl file which defines the notification paths for various conditions. Example: %Torrus::Notify::programs = ( 'mailto' => '$TORRUS_BIN/action_printemail | /usr/bin/mail $ARG1', 'page' => '/usr/bin/echo $TORRUS_NODEPATH:$TORRUS_MONITOR ' . '>> /tmp/monitor.$ARG1.log' ); %Torrus::Notify::policies = ( 'CUST_A' => { 'match' => sub { $ENV{'TORRUS_P_notify_policy'} eq 'A' }, 'severity' => { '3' => [ 'mailto:aaa@domain.com', 'mailto:bbb@domain.com' ], '5' => [ 'page:1234', 'mailto:boss@domain.com' ] } } ); In this example, we define two message handlers: e-mail sender and a dummy replacement for a pager program. Then we define the notification policies. For the customer A, we define the policy so that the parameter "notify-policy" should match the name "A". The parameter is defined in the datasource tree and marks only those leaves that belong to this customer. Then, depending on the monitor severity, different notification paths are defined. For severity values higher or equal 3, aaa@domain.com and bbb@domain.com will receive the email notifications, and for severity higher than or equal 5 all recipients will receive the notification. The "match" argument is a Perl subroutine, and can depend on various parameters, such as time of day or day of the week, the tree name, and so on. FILES
/etc/torrus/conf/notify-siteconfig.pl Notification policies configuration SEE ALSO
torrus(8) NOTES
See more documentation at Torrus home page: http://torrus.org AUTHOR
Stanislav Sinyagin <ssinyagin@yahoo.com> torrus 2.03 2013-07-26 TORRUS_ACTION_NOTIFY(7)
All times are GMT -4. The time now is 03:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy