04-07-2009
re-direction
Say I have a single bin directory with Linux and SunOS executables, like this:
bin/myprog_lnx
bin/myprog_sun
Assume these programs read from stdin and write to stdout and, thus, are meant to be run like this:
myprog_lnx < filein > fileout
My users may log in from a Linux or Solaris client and I don't want to bother them with the suffix...I would like them to simply run the program like this:
myprog < filein > fileout
So, it occurs to me, that I could have a korn shell named "myprog" that when run, it checks for the OS and runs the appropriate executable...
Question: how can the arguments and re-direction typed at the command line after the shell script be passed to the command inside the shell script?
In other words, when I run my shell like this:
> myprog < filein > fileout
in Solaris, the shell should execute
myprog_sun < filein > fileout
when in Linux, the shell should execute
myprog_lnx < filein > fileout
==myprog====
#!/bin/sh
if [[ `uname` = 'SunOS' ]] ; then
suffix='_sun'
elif [[ `uname` = 'Linux' ]] ; then
suffix='_lnx'
fi
myprog${suffix} < filein > fileout <<< how to accomplish this effect???
==myprog====
Thanks in advance for any hints you may offer.
gsal
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
First, I just rebuilt/installed my custom kernel & I don't know how to check if it ran properly (I'm fairly sure it did, but I'm looking for reassurance that it loaded the new kernel file).
Second, I'd love to get into programming, scripting, whatever, I want my imagination to be the builder &... (2 Replies)
Discussion started by: LazySpoon
2 Replies
2. Programming
I'm a senior in high school trying to start getting into computer programming. All I've done so far is picked up a book on C for beginners and started to teach myself. There aren't really any courses at my high school for introductory programming, so it looks like I'll have to wait for college to... (7 Replies)
Discussion started by: Fritzz
7 Replies
3. Programming
Hi,
I'm writing my first daemon application. I need to make sure I cover my bases as far as correct procedures, etc... I've tried to do my own legwork by reading as much as I could on daemonizing programs, etc... There are so many different examples, some include this but not that, etc...... (3 Replies)
Discussion started by: mph
3 Replies
4. Fedora
Hey , I have become pretty normal, using unix and what not and working around FEDORA 9
I was wondering does anyone have any IDEAS or have anything I should try to build or scripts to write ,
or possibly know any sites where I could practice some things just so I know I am writing them... (2 Replies)
Discussion started by: Producer
2 Replies
5. Fedora
Okay, so I'm not a complete newb when it comes to using Unix/Linux. I've been using Ubuntu for a few years now and I've dipped my toes into a few other distros but now I want to get a bit serious.
I'm looking at becoming a sysadmin but the trouble is...I have no idea where to start. What I'm... (1 Reply)
Discussion started by: Tamachan87
1 Replies
6. AIX
picked up a 9111-520 p5 hardware recently with 8 Gig of RAM, lots of internal disk space...6 x 140 gig
had 7.1 pre-installed, and managed to upgrade the firmware to latest SF240_xxxx
goal is to virtualize this and have LPARs running aix 7.1, 6.x, and Rhat for ppc ..
need some... (13 Replies)
Discussion started by: ppchu99
13 Replies
7. Shell Programming and Scripting
Hello,
I have a log file as shown below. Each line starts with instance nr.
: Session: IP Processing HTTP Socket Command
: Connecting User-Agent Media:
: NOT Rejected Media
: Session: Username Request Channel
: Username : Check if he is in User Database
: Username : not in the... (6 Replies)
Discussion started by: baris35
6 Replies
8. Shell Programming and Scripting
Being a beginner in scripting I am not sure the direction to take to accomplish the below task and would love suggestions.
GOAL
input file: domains.list
Read input file, search in named.conf and find domain and delete entry for the purpose of cleanup activity.
named.conf entry example
zone... (8 Replies)
Discussion started by: djzah
8 Replies
9. Shell Programming and Scripting
Hi,
I have a shell script which executes some sql. When the shell script executes the sql's logging is shown on the console. I need to grep some data from this output shown on console. So I do the following
hive -f load.adj.hql 2>&1 | tee c.txt
echo $?
A=`grep num_rows c.txt`
$? will... (1 Reply)
Discussion started by: wahi80
1 Replies
LEARN ABOUT DEBIAN
aubioonset
AUBIOONSET(1) General Commands Manual AUBIOONSET(1)
NAME
aubioonset -- a command line tool for real time onset extraction
SYNOPSIS
aubioonset [options] [-i soundfile]
DESCRIPTION
aubioonset attempts to detect onset times, the beginning of discreted sound events, in audio signals.
When started without an input file argument (--input), aubioonset creates jack input and output ports. When an input file is given, the
results are given on the console.
OPTIONS
This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included
below.
-i --input filein
Run analysis on this audio file. Most common uncompressed formats are supported.
-o --output fileout
Save results in this file. The file will be created on the model of the input file. Results are marked by a short wood-block sam-
ple.
-O --onset mode
The onset detection function to run. Available functions are complexdomain, hfc, phase, specdiff, energy, kl and mkl. By default,
both Kullback Liebler (kl) and complex domain are used in parallel.
-t --threshold value
Set the threshold value for the onset peak picking. Typical values are within 0.001 and 0.900. Default is 0.1. Lower threshold
values imply more onsets detected. Try 0.3 in case of over-detections.
-j --jack
Run in jack mode (default when started without input file) and creates a midi output.
-v --verbose
Show results on the console (default).
-h --help
Show summary of options.
BUGS
For now the program has only been tested on audio signals sampled at 44.1 kHz.
SEE ALSO
aubiotrack(1) aubionotes(1) aubiocut(1) aubiopitch(1)
AUTHOR
This manual page was written by Paul Brossier (piem@altern.org). Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.
AUBIOONSET(1)