aix

How to mkdir only if a dir does not already exist?

旧城冷巷雨未停 提交于 2019-11-26 18:02:30
I am writing a shell script to run under the KornShell (ksh) on AIX. I would like to use the mkdir command to create a directory. But the directory may already exist, in which case I do not want to do anything. So I want to either test to see that the directory does not exist, or suppress the "File exists" error that mkdir throws when it tries to create an existing directory. Any thoughts on how best to do this? Try mkdir -p : mkdir -p foo Note that this will also create any intermediate directories that don't exist; for instance, mkdir -p foo/bar/baz will create directories foo , foo/bar ,

fgetc does not identify EOF [duplicate]

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 17:18:40
问题 This question already has answers here : Difference between int and char in getchar/fgetc and putchar/fputc? (2 answers) Closed last year . The program below runs fine on various Solaris/Linux flavours, but not on AIX. However, if I replace while(c!=EOF) with while(c!=0xff) on AIX it runs completely fine. Any thoughts? I checked the fgetc man page on AIX, and it should return the EOF constant! #include <stdio.h> #include<unistd.h> #include <string.h> int main() { char c; FILE *fp; fp = fopen(

How to get the command line args passed to a running process on unix/linux systems?

点点圈 提交于 2019-11-26 11:45:31
问题 On SunOS there is pargs command that prints the command line arguments passed to the running process. Is there is any similar command on other Unix environments? 回答1: There are several options: ps -fp <pid> cat /proc/<pid>/cmdline | sed -e "s/\x00/ /g"; echo There is more info in /proc/<pid> on Linux, just have a look. On other Unixes things might be different. The ps command will work everywhere, the /proc stuff is OS specific. For example on AIX there is no cmdline in /proc . 回答2: This will

How to mkdir only if a dir does not already exist?

久未见 提交于 2019-11-26 08:53:52
问题 I am writing a shell script to run under the KornShell (ksh) on AIX. I would like to use the mkdir command to create a directory. But the directory may already exist, in which case I do not want to do anything. So I want to either test to see that the directory does not exist, or suppress the \"File exists\" error that mkdir throws when it tries to create an existing directory. Any thoughts on how best to do this? 回答1: Try mkdir -p: mkdir -p foo Note that this will also create any