Browsing articles tagged with "ksh - Admins Goodies"
May 2, 2013
tom

rm + how to remove file with special Characters

I have this file in my linux machine: ———-9976723563nneh4_—–192.9.200.4 I try to delete this file but I cant as all see here: what need to add to rm in order to remove this file ? rm “———-9976723563nneh4_—–192.9.200.4″ rm: illegal option — ——–9976723563nneh4_—–192.9.200.4 usage: rm [-fiRr] file … . rm ‘———-9976723563nneh4_—–192.9.200.4′ rm: illegal option — ——–9976723563nneh4_—–192.9.200.4 usage: rm [-fiRr] file … Asked by yael rm — ———-9976723563nneh4_—–192.9.200.4 You need — in order to tell rm (and […]

Continue Reading »
Jan 16, 2013
tom

how to see process status with full details

I run the script – my_script.ksh as process with 5 long arguments on my solaris/linux machine ( example 1 ) , Later I verify the process by ps -ef | grep my_script.ksh I don’t understand way I not get the all arguments from ps -ef ? , ( see example 2 ) or maybe ps command have limitation to display a long line ? , or maybe need to write the ps command with some […]

Continue Reading »
Dec 31, 2012
tom

linux + create Shortcut command

I am not sure if I performed the following illegal or true but what I need is – to create set of ready commands so if I need to use , for example to match IP address with 4 octet I can use the command – command_that_match_four_octet Please advice if I performed correctly the following and, I want to know if the following syntax will not cause troubles. [root@su1a /tmp]# command_that_match_four_octet=” grep ‘[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}’ “[root@su1a /tmp]# […]

Continue Reading »
Oct 17, 2012
tom

ksh + match and verify two strings in single line

how to match the words linux1a and linux1b from single line ? ( should be performed by ksh ) list=”solaris1a Auto global linux1a linux1b” echo $list | …. ? my target is to find that linux1a and linux1b are exists in the line { $list ) Asked by yael $ echo $list | grep linux1a | grep linux1b If after both the grep’s you still get the output, then it exists. Answered by Guru Check […]

Continue Reading »
May 1, 2012
tom

ksh + print the last value from parameter ( as $_ in perl)

I need advice – how to print the same last value in ksh scripts without to print param argument for example in perl last value is $_ , but we not have this option in ksh script example – of ksh script function test { ETH_PORT=eth0 echo $ETH_PORT echo < what need to write in order to print last value > } test Asked by Eytan It’s not clear what behavior you want in your […]

Continue Reading »
Mar 3, 2012
tom

Script SCP without certificates or expect

I need to script SCP and I need to be able to do this by passing in the password in plain text. I am absolutely aware of the horrible design pattern that I am asking for. I cannot use certificates for this application. My challenge is that the box that I am working on cannot and willnot have expect or perl’s Net::SFTP module. I have an HP-UX box with ksh and a basic perl install. […]

Continue Reading »
Jan 31, 2012
tom

shell script + match MAJOR and CRITICAL strings from log file

I need to match lines that have MAJOR and CRITICAL strings that comes after the word ERROR:< any integer number > please advice how to do that with one awk or sed command? more HW_Log.txt CHK_HW ERROR:0 INFO self_monitor Verifying HW machine CHK_HW ERROR:1 MAJOR self_monitor Verifying HW machine CHK_HW ERROR:1 CRITICAL self_monitor Verifying HW machine Asked by Eytan This can be done using grep like: $ grep “ERROR:[0-9]* (CRITICAL|MAJOR)” /path/to/file Answered by Khaled Check […]

Continue Reading »
Jan 11, 2012
tom

shell script + add inside the script PATH for standard output

Usually if we want to redirect script output to file we simply do /etc/create_connection.sh > file.debug.txt Or /etc/create_connection.sh | tee –a file.debug.txt But What I want is to add /etc/create_connection.sh > file.debug.txt inside the script , but I not sure if it possible and how? so when I run just /etc/create_connection.sh I need that all standard output will write to file.debug.txt so what I need to add in my script in order to do that? […]

Continue Reading »
Dec 14, 2011
tom

What version of ksh ships with AIX 5.3?

I’m writing a Korn shell script for a client, who will use it on AIX 5.3. For testing, I’m using version 93u-1 Debian Wheezy. Is this the same version as the one I’ll find on AIX? In summary, no. oslevel -s 5300-08-03-0831 /usr/bin/ksh – Version M-11/16/88 /usr/bin/ksh93 – Version M-12/28/93 The version may differ slightly between different TL/SP levels in AIX. AIX by default uses ksh, and very little uses ksh93. Obviously, you can configure […]

Continue Reading »
Aug 26, 2011
tom

What do the 2 leading underscores indicate in these alias lines for .kshrc?

I am configuring ksh88 on AIX 5.3L and came across a few lines that are supposed to enable the arrow keys for command history navigation. alias __A=$(print -n “20”) alias __B=$(print -n “16”) alias __C=$(print -n “06”) alias __D=$(print -n “02”) What I want to know is what do the leading underscores indicate? The reason that I am asking is that I need to, on login, conditionally remap function keys based on some criteria. I […]

Continue Reading »
Pages:12»