I have a bunch of ksh and csh scripts that need to be updated to run in different *nix flavors (red hat linux, hp ux, solaris). The shells are mounted in the home of each of our servers and we need to have them working in each env.
We have issues with some particular commands that are not found under linux.
For example scripts use nawk
, which should be replaced by gawk
on linux.
Scripts also use /usr/xpg4/bin/grep
because on solaris grep
can't take the -q (quiet) option, but linux's grep can and in this env /usr/xpg4/bin/grep
doesn't exist.
I don't want to touch every script, so I'm looking for a more global solution.
I've tried to setup aliases, that works. But only in interactive mode. Looks like it isn't advised to use aliases in scripts...
I can add symlink in the system dirs but then I'll need admin rights to manage this 'mocking' setup and the our setup is not portable anymore...
I'm not used to system admin, so I can miss a standard solution for this kind of need.
What can I do to have portable script without to rewrite them all ?