Thread: Shell Script Parsing Pipe Feed
i'm doing bit of shell scripting , have pipe feed so...
how parse out , each value it's own variable?code:value1|value2|value3
could clarify? values feed command line parameters? if yes, can read them in follows (assuming have no options command/script name):
this not want pipe value1 value 2 etc, far, i'm not quite sure try do. if instead have 3 commands, , want pipe result of command 1 2 (etc), better off make them functions (if it's script), or use command line directly, in:code:#!/bin/bash value1=$1 value2=$2 value3=$3
notation , use of local/global vars improved, that's gist.code:#!/bin/bash value1=0 value2=0 value3=0 function1() { ... echo $value1 #note: echo should last line } function2() { # f, insert calculation(s) using value1 value2=f($1) echo $value2 } (similar function3()) #this assumes not hand on value function1 value1=`function1` value2=`function2 $value1` value3=`function3 $value2`
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] Shell Script Parsing Pipe Feed
Ubuntu
Comments
Post a Comment