NetBSD-Users archive

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

Re: Scripting for /bin/ksh



On Mon, Aug 2, 2021 at 8:23 AM Todd Gruhn <tgruhn2%gmail.com@localhost> 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.


foo="ls"
bar="/tmp"
cmd="${foo} ${bar}"
${cmd} #runs ls /tmp
---
output=$(${foo} ${bar}) #captures the output

not sure what "execute" is here

Your perl code wouldn't work because you don't have spaces using the `.`

working perl (looks just like the shell script):
perl -e '$foo = "ls"; $bar = "/tmp"; $cmd = "${foo} ${bar}"; print qx#$cmd#;'


Home | Main Index | Thread Index | Old Index