Sunday, January 28, 2024

[SOLVED] Is there a way to or operation in sftp get command?

Issue

Something like :

filePattern='sor.log*|sor.SOR.log*'
myLocation=/opt/tradertools/omer
clientLocation=/opt/tradertools/omer/sor/from
clientName=vmonitorlmpa
clientUser=root
clientPass=triltest

export SSHPASS=$clientPass

sshpass -e sftp -oStrictHostKeyChecking=no -oBatchMode=no -b - $clientUser@$clientName << !
   mget $clientLocation/$filePattern $myLocation
   bye
!

where the filepattern is what needs the "or" operation.


Solution

No, there's no "or" operator for strings, only for characters (aka range: [abc]).

See the glob man page for syntax supported.


You can use multiple get commands instead.

(Note that the mget is just a ftp-compatibility alias to the get)



Answered By - Martin Prikryl
Answer Checked By - Candace Johnson (WPSolving Volunteer)