Moving from AIX 6.1 to RHEL 6.6, I have noticed a few command differences.
One that has been causing issue is a simple echo command when I have to use it this way ->
On the AIX it outputs to "-e" but since RHEL has "-e" as an option for echo and hence it outputs to blank here.
All the code needs to be updated unless anyone here has a better option that you may have found in similar scenario.
Please suggest.
Use ksh instead bash. You are probably used to ksh anyway when you come from AIX and it is available on every Linux since some time now. When using ksh you have the shell-internal "print" for output. It allows to explicitly end options by using a single dash:
will output "foo bar" to stderr (-u2) but:
will write "-u2 foo bar" to stdout, because "-u2" is no longer considered an option.
Per default i use it that way, especially if i do not know what a variable i want to display contains:
Even if "$var" contains options to "print" they will be ignored.
Ok... so in general we have an old SysV vs. Berkley... or perhaps a ksh vs. Berkley-ism.
I too was somewhat displeased with the Linux choice of a BSD-ish like echo since it tried to be more POSIX which made is smell more SysV like (Linux is sort of its own blend).
So the niceness of echo "first line\nsecond line" that you had in HPUX, Solaris, etc.. well, you had to do echo -e "first line\nsecond line" in Linux. Now... with more contemporary versions of ksh, they've added a "do nothing" option of -e, which means for any system running ksh93 (maybe even something less) but not not a really old ksh, you could use -e to make scripts seemingly portable.
But... maybe you plan to run ksh93 on your Linux host.
Then, you can run the following:
Sadly, even getconf syntax has changed over the years, for the command getconf UNIVERSE = att, you may have to use a minus instead of an equals....
Now... with regards to that latter solution, if you whole system runs in ksh and uses a non-systemd SysV style init, you could put that stuff there, but of course I can pretty much guarantee you that your distro producers didn't have portability in mind when they wrote their init scripts. So... it will likely render your system useless to try change away from bash.
There's like a KSHENV var that might be able to pull such things in for any ksh script..... it's been too long.. anyhow, might get you pointed in the right direction.
bakunin - That is the excat change I am trying to avoid as it involves many script changes.
Our scripts have something like
Now when this script is called in command line, its like
inside the script we check as below
This is where the problem arises.
cjcox - Thanks a lot for those inputs...I will try to research more on those lines.
Hi All,
The scripts developed in AIX can be executed in Red Hat Linux too? Because, we are migrating OS from AIX to LINUX.
Will there be any differences in commands?
Thanks in advance!!!
Regards,
U (2 Replies)
I'm having a problem regarding the encoding of my files in Linux and AIX.
I have a file which can be viewed both in Linux and AIX (via NetApp mount). When I checked the encoding, they have difference.
In Linux, the file is encoded as ISO-8859 text. (checked by using "file" command).... (1 Reply)
To list file permission/access right in octal format, linux has a command 'stat'. For example, we can use the followin -
stat -c %a `find . -type f
Is there any equivalent command in AIX and HP-UX to give the same result as linux 'stat' command?
Please advice. (3 Replies)
Hi,
Script :
#!/usr/bin/ksh
echo "\n\t\t\t\t Enter your Name : \c"
read name
##############################
I ran the script in LINUX
Enter your Name : abcdefghijklmnopqrstuvwxyz
I ran the script in AIX
Enter your Name : opqrstuvwxyz <
I'm not able to see the... (2 Replies)
Hi,
I am facing one problem only with mv command not with cp command. I have a test program
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <fcntl.h>
#include <errno.h>
int sync_file(char *file)
{
FILE *fp=NULL;... (6 Replies)
Hello all
the su with -l option is running normal with linux but when i try to run it on unix AIX 5.2.7 it's not working with -l option
any help (6 Replies)
Sir ,
Can any body explain the difference between linux , Unix and AIx on command Reference all the command on AIx and unix is same or not
please reply (2 Replies)
How to convert this linux command to Unix AIX?
I have tried this command and work in CentOS:
tail --line=0 --retry -f --follow=name --max-unchanged-stats=1 logFile.log
But in AIX, the tail haven't "--retry" "--follow=name" option.
Thanks in advance. (1 Reply)
On Linux I could use the `watch` command to loop a command X times. Is there a similar command on AIX? If not, is there a way to write a loop on the command line to do this?
Linux: watch -d -n 60 'db2 list applications show detail | grep Connect | wc -l'
AIX: ??? (2 Replies)