NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Scripting for /bin/ksh



On 2021-08-02 14:22, Todd Gruhn wrote:
I am attempting to write some ksh-scripts that invoke "borg" .
How does one tell ksh to cat the 2 vars together and invoke the
resulting command?

$foo  <--> /umass1/BORG-REPOS
$FIRSThalf <--> borg-3.8 list
$cmd= $FIRSThalf  . $foo  #thats how it is coded in PERL

execute $cmd

I never learned much about /bin/ksh -- I jumped straight into PERL.
Anyone know of some good PDFs regarding this?

Any help will be appreciated.

Not entirely sure what you actually intend here, but this might be much easier than you think.

Is the command supposed to be "borg-3.8 list /umass1/BORG-REPOS" ?

Or are the the arguments actually supposed to be the output of the commands, and that is then what you feed in to the next command?

Anyway, if the command really is the quoted string above, then just give that string as it is. Nothing more to it.

If you actually want the output from a command assigned to a string, or used as an argument to another command, then $(command) should do it.

If you have variables you just want expanded, then ${variable} will expand the variable to its value.

So, for example

foo = $(ls)

will make foo contain the output from the command ls.

foo = ${ls}

will make foo contain the same value the variable ls have, assuming that variable exist. Otherwise you'll get an error.

There is a lot more. Why not read the man-page?

  Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index