Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-2 votes
1 answer
218 views

"for" loop is not executing on the remote server using SSH

The below "for" loop works locally on the same server. But when triggered through "ssh" protocol on remote servers, the output is not received. Please, can anyone suggest how to ...
ShyamNarayan's user avatar
0 votes
2 answers
162 views

korn shell Store for loop output "values" in array and pass to another loop

Need help with array in korn shell. I need to pass the values from first for loop to 2nd loop. The first loop returns /opt/IBM/db2/V11.5 /opt/IBM/db2/V11.5.8 /opt/IBM/db2/V11.5.8 Then I am greap &...
user3590915's user avatar
0 votes
1 answer
438 views

Switch user using EOF does not work su - ${instance} <<'EOF'

I am running a ksh script from root where I switch (su) to different users and execute the commands. But, some reason EOF does not. Here is part of my code. This part of the code does not work su - $...
user3590915's user avatar
1 vote
1 answer
493 views

Display branch name in $PS1 on ksh88

I want to display my current git branch in the prompt in ksh88. I'm working on a legacy project, when the backend run on IBM's AIX, with a mandatory ksh88 shell. I can switch to say, bash, for some ...
Rafiki's user avatar
  • 111
1 vote
1 answer
472 views

Club the two commands i.e output of first as input to the second command

I wish to club the below two Steps whereby the output of Step 1 i.e the PORTS should go as input to Step 2. Step 1: The below command gets me the port numbers from a file. genpwdfile dec -in test/test....
Ashar's user avatar
  • 519
1 vote
2 answers
217 views

How add new lines between rows and start and end position of the csv file

The below input data contains table attribures with header information. The expected output is given below as well where the header and newline with intended text. This is expected as and when there ...
vijay's user avatar
  • 45
2 votes
3 answers
2k views

How could I know inside a script if stdout has been redirected for it?

I have a script in ksh; depending whether there is a redirection from the command line, I redirect the output via a exec 1>file. How can I test from inside the script itself if the command calling ...
NeronLeVelu's user avatar
3 votes
0 answers
1k views

Get/Set environment variables in a different tty

I'm using a tool (Autokey) that spawns in a new shell. Cool tool, but I want to pull info from my current shell. Say I'm on pts/0 and I have a variable set: VAR1=yes. In another shell, I want to be ...
BrowncoatOkie's user avatar
1 vote
2 answers
4k views

Concatenate a string with a variable in grep command

I have to search by this pattern: _20181106 20181106 is yesterdays date, so it has to be be a variable like TZ=aaa24 date +%Y%m%d How can I search a file with this pattern? I'm working with AIX
Tarek Sayed's user avatar
0 votes
1 answer
117 views

Use small script inside another On AIX, or a solution in a single command

I want put on a small script (perl-script.pl) inside another in order to use use it with a find command, like this: #Saving the previous permission information for a possible recovery. case "$STAND" ...
Filipe Torres's user avatar
1 vote
1 answer
46 views

setting a remote stdout into local KORNSHELL variable

I'm writing a script. The idea is to compare MD5 checksums between a local file and a remote one. The local file checksum is saved into a local variable: LOCALMD5=!chsum "$(basename "$file")" I ...
arcee123's user avatar
  • 167
-1 votes
2 answers
525 views

reestablish root shell

I disabled the shell of user root with the command chuser shell=/bin/false root and now I cannot switch to root with sudo su -. PermitRootLogin is disabled too, so I don’t know how could I reestablish ...
user308669's user avatar
3 votes
2 answers
677 views

Echo the list of process not running

I have developed a script, the script refers to a file to start the required processes on that server. The script times out after 180 secs. At the end of the script I would like to display the ...
Amit Baid's user avatar
1 vote
2 answers
122 views

I want search for a string and to pull all the lines between two patterns [duplicate]

I want search for a string and to pull all the lines between two patterns(including the pattern). START#1 Name S 101 Frankfurt_1_1 19 A+ Street END START#2 Name B 104 Berlin 20 A+ ...
user4432340's user avatar
-2 votes
2 answers
1k views

How to find the word before a match

I have the following log file. I need to know if there are any fault / suspect condition using a shell script. I need to find fault and check the previous word, if it is greater than 0 then there is ...
Swaminathan Ks's user avatar
1 vote
1 answer
4k views

set -A command not running in Linux

if [ $UNITS = day ]; then while ((OFFSET > 0)); do if (( OFFSET >= day )) ;then month=$((month - 1)) if (( month == 0 )) ;then year=$((year - 1)) ...
user131990's user avatar
3 votes
2 answers
7k views

linux equivalent to AIX proctree command to show all child and parent processes of a given PID

Sometimes I'm looking for an equivalent for the AIX proctree command which displays all children and all ancestors of a specified PID and can be sometimes quite useful for troubleshooting purposes. As ...
doktor5000's user avatar
  • 2,769
2 votes
1 answer
542 views

Shell Script - Redirected output to a file and results are not as expected in first run

I have redirected the output of the command which returns some times 2 rows, 5 rows.. 100 rows etc in the file.. and i will use this file in if condition later to check some other conditions.. ...
RenukaKC's user avatar
1 vote
2 answers
6k views

Database: 0403-009 The specified number is not valid for this command [closed]

getting the error as Database: 0403-009 The specified number is not valid for this command. Code:: #!/usr/bin/ksh #set -x WORKFILE="/tmp/oatest.out" DDLFILE="/tmp/oatest.ddl" TODOFILE="/tmp/...
RenukaKC's user avatar
1 vote
1 answer
3k views

Need to capture part of file name into variable

I have bunch of CSV files named like so in a directory: s_m_u_supplemental_fields_account_9_4_2015_11_26_Error.csv s_m_u_supplemental_fields_account_9_4_2015_12_3_Error.csv ...
sleepy bubba's user avatar
2 votes
1 answer
952 views

Can a process bring itself back to the foreground on completion? (AIX/ksh)

I have a while loop to count to 5 and echo "Done" when finished. I want to be able to execute the script in the background with "&" and continuing issuing commands while it runs. But when it's ...
Matt Dexter's user avatar
1 vote
1 answer
540 views

A question about shell and .profile,.bash_profile,.bashrc

I'm on aix 7.1, my shell is bash If i did ssh ibmunix gqlplus user/pass All works and gqlplus starts. gqlplus is on /opt/freeware/bin If i did from another machine ssh ibmunix "gqlplus user/...
elbarna's user avatar
  • 13.2k
1 vote
1 answer
72 views

zwrite handling of "@" symbol

I've been using zwrite to create simple message popups in AIX, and it handles @ symbols weirdly, even when they're strong quoted. I'm running these commands in ksh. As an example, echo '1 @ 2 @@ 3 @@...
Paul Bunch's user avatar
0 votes
1 answer
3k views

What is the meaning of "${name##*/}" in Shell [duplicate]

I have a code as while read name; do uuencode "$name" "${name##*/}"; done but I do not understand what is meaning of ##*/ in "${name##*/}" Google doesn't give good results. Can someone please ...
Aravind's user avatar
  • 1,669
2 votes
4 answers
12k views

Why doesn't alias work in AIX (Korn shell, .profile)?

I have these files in my home directory: drwxr-xr-x 3 meuser staff 256 Oct 12 13:11 . drwxr-xr-x 102 bin bin 4096 Sep 30 12:28 .. -rw------- 1 meuser staff ...
jrara's user avatar
  • 2,089
4 votes
1 answer
4k views

Installing ksh as the standard shell in Redhat: Foolhardy?

I'm not a system administrator, but my organization is considering replacing /bin/sh in Red Hat Enterprise Linux 6+ with a hard link to /bin/ksh. How foolhardy would this be? The background to this ...
Spacewaster's user avatar
2 votes
3 answers
25k views

How to run the most recent command on AIX?

How can I run the most recent command again from history in AIX Server? And how to edit the most recent command and run it again in AIX?
jrara's user avatar
  • 2,089
23 votes
4 answers
30k views

Skip first 3 bytes of a file

I am using AIX 6.1 ksh shell. I want to use one liner to do something like this: cat A_FILE | skip-first-3-bytes-of-the-file I want to skip the first 3 bytes of the first line; is there a way to do ...
Alvin SIU's user avatar
  • 333
2 votes
3 answers
18k views

What is the default shell for .sh in AIX?

I am fairly new to AIX machine. We would like to deploy some program into the AIX machine which is yet to come. We have a short experience in AIX machine and after login using putty, we felt the ...
lamwaiman1988's user avatar