All Questions
64 questions
3
votes
2
answers
100
views
Simulated Execution of Redirections
My shell is the Korn Shell, but I think the problem (and its eventual remedy) applies to other shells as well.
I usually build a "simulation mode" into my scripts to test potentially ...
0
votes
1
answer
91
views
ksh88 string substitution in alias | mpv streaming [duplicate]
tl;dr how can I substitute a string (i.e. a youtube/streaming url) in an alias such as alias mpvyt='yt-dlp <URL> -o - | mpv - ' ?
I live in a mezzanine studio using a M1 macbook for a ...
-2
votes
1
answer
244
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 ...
0
votes
1
answer
492
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 - $...
0
votes
1
answer
160
views
Issue - infinite loop using while on ksh script
I'm writting a scsript to automate some check at work & i have trouble on only 1 standing issue which is the script never ending.
It do the all task over & over.
There are 2 while loop & ...
-1
votes
1
answer
577
views
One master ksh file to call 2 ksh script files [duplicate]
I have 2 ksh (korn shell script) : file1.ksh and file2.ksh; and I want to have a master file ksh script that will call the 2 files; what's the code I have to put in my master file?
Thanks
0
votes
3
answers
1k
views
Script to keep the latest 5 files and rest will be moved to other destination
Source path:
/var/log/
Here I have 4 folders named ad1nrld,ad2nrld,icp1rmnrl,icp2rmnrl
I can move all the files to the other destination named /home/spsy/logs_bkp. But I want to keep latest 5 files in ...
0
votes
1
answer
73
views
'If' statement breaking his own rule or I'm doing so
Explanation:
I'm playing a little bit with a script this one helps notifying to user about SSL certificate expiration. If certificate has less than 30 days to expires, this will notify to user, if isn'...
0
votes
0
answers
167
views
How to launch this DtKsh application?
I'm working with Desktop Korn Shell
You can create examples like this one; So I want to create it
and here's the code of this:
#!/usr/dt/bin/dtksh ##...
0
votes
0
answers
59
views
How to pass a folder as argument to the executing script? [duplicate]
I would like to execute a script(h.ksh) with the passing argument kim (which is a folder),
so when I run the command
h.ksh kim
the folder "kim" will be used as a variable in the h.ksh
Do I need to ...
0
votes
1
answer
196
views
display time per minute using start and end date time
I want to write a script that will display the time per minute between two date and time. The Start and End time gap can be anything, could be 5minutes, 3hours, 30days, etc.
Example:
Start time: ...
-1
votes
1
answer
47
views
Find Command, I want to use my variables
I have a script that creates a new directory based on User Input, and well as which directory contents it will copy over. Now here is where I am having issues, I have a find command that will replace ...
3
votes
2
answers
3k
views
ksh - subtract 5 minutes from current time
I need to get the date and time of the command date minus 5 mins.
date:
29 Aug 2018 21:56:01
result:
29 Aug 2018 21:51:02
I tried to search on the Internet/forums but most of it involved using the -...
3
votes
3
answers
7k
views
How may I find the most recently modified file(s)?
In a directory, I have a number of files, and I need to do something with the most recently modified file with a .txt suffix.
Ideally, I'd like to do
myutility "$newest"
in the end, where $newest ...
1
vote
2
answers
922
views
ksh - Reading an unset variable into an array using the read command [closed]
I have the following ksh script, where $an_unset_var is an unset variable which is being used for the first time:
read -A arr <<< "$an_unset_var"
echo ${#an_unset_var}
echo ${#arr[*]}
...