The first thing is a general observation: when you write some "if..else..fi" and you end up with commands in both the "if"- and the "else"-branches - they could be placed outside the "if" too, no?
No, I didn't know that. Do you mean, "in the then and else branches"? Although I've read that fi is simply if backwards, I've always read it as finish. You know, like, it's the end. I'm still not entirely clear on how these commands, or arguments, or whatever they're called, work.
But you're saying that I could could just put a single instance of find, or whatever command, after fi, and it'll execute no matter what happens above it? Yeah, ok, I can see that now.
I should also mention that I simply forgot to delete ls ~/$dir, which I intended to do. I like the output of find better, because prints only the path on one line, as opposed to what I was getting, or hoping to get, from ls.
Quote:
The next thing is a minor detail...
No, you're right, especially if we try to make something that might actually be useful. I'm thinking it's possible in many cases that a variable could be handed some white spaces. Do you think it's a good idea to always quote variables, as a matter of course?
Quote:
Next detail: "mkdir" intrinsics.
Right! Again, something I hadn't considered. I tried it, and as you suggest, it did not work. Adding the -p flag fixes it.
Quote:
Last thing: "find" is not necessary in this case.
While I did not try this - at least, not yet - I wonder if cd .. would always work, since it only takes you up one level? For instance, if you had empty directory /Fun, then specified, say, a new directory four levels down: /Fun/X1/X2/X3 Wouldn't cd .. only position you, (and ls), at /X2?
Ih all,
i have multiples ksh scripts for crontab's unix jobs
they all have same variables declarations and some similar functions
i would have a only single script file to declare my variables, like:
var1= "aaa"
var2= "bbb"
var3= "ccc"
...
function ab { ...}
function bc { ... }... (2 Replies)
I want to write a script in KSH that takes the output of one command and redisplays it. Something like:
while true
do
read inpt
date +"%I:%M:%S %p <-> $inpt"
done
and then some how get the output of the ping command to redirect to the input of this script.
does that make sense? (2 Replies)
Hello All
Nice to meet you all here in this forum,
it's my 1rst time here
i'm asking about a little issue that i face
i added a ksh script that echo " please insert your name " and store the output to a login.log file.
the script is working fine with normal telnet
but Xstart is not working... (8 Replies)
Hi
I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email.
For example
-------
Script ABC
-------
a.ksh
b.ksh
c.ksh
I need to call all three scripts execute them and... (2 Replies)
Hi,
I would like to know how can i pipe the following output of grep into a predefined output format
This is the output of the grep command grep record *.txt | sort -r
2010-04-28-11-12-21.txt:C The user has created a record
2010-04-29-10-18-41.txt:U The user has updated a record... (8 Replies)
This is Input - starts with Storage Group Name and ends with Shareable and the loop continues all I need is Storage group name and Alu numbers in the below output format requested.
Storage Group Name: abcd
Storage Group UID: 00:00:000:00:0:0:0
HBA/SP Pairs:
HBA UID ... (6 Replies)
Hi ,
I'm writing the for loop script in home directory and wanted to get the files from /etc/data directory.
#!/bin/ksh
file_nm="/etc/dat"
for test_data in $file_nm/fln*
do
echo "$test_data"
done
the code is executing successfully , but in the output it is showing
... (6 Replies)
I'm having a brain freeze moment. I've created a ksh script in AIX that ssh's to a remote server, executes some commands, and then logs out. All of this is sent to a file. I then have the script cat the file so i can see the output. Even though the cat command is outside of the remote session part;... (5 Replies)
Hi,
I am new to shell script programming. I have written a ksh script to run the sql File placed in server directory and spool the output in destination directory.
Below Command:
$ORACLE_HOME/bin/sqlplus -s $ora_uid @$sqlfile_loc$testquery.sql > $opfiledirectory
It is generating the output... (6 Replies)
Hello,
I have researched and tried many way to pass OUT parameter to be stored in variable in KSH Script.Still not success, please help.
Here is my Store Procedure.
create procedure testout3(v_in varchar2,v_out OUT integer)
as
begin
v_out := 1;
end;
Here is my testvout.ksh
#!/bin/ksh... (1 Reply)