Custom command newline

Advertisement

pockypuck
Joined:
Posts:
2

Custom command newline

I want to have a remote command that includes a Here String, but I don't see anything in the WinSCP documentation about being able to include a LF (newline) character in the syntax.

I could use printf "\n" remote-side to simulate it, but that somewhat defeats the purpose of why I want to use a Here String in the first place, which is to initialize a variable for a path that may contain all sorts of characters. For instance, let's say WinSCP included the pattern !L to represent LF characters, I would have my command be:
PATH=$(cat <<'///'!L!$!L///!L);!Lmycommand "${PATH:0:-1}"
... which, when expanded, would be:
PATH=$(cat <<'///'
!$
///
);mycommand "${PATH:0:-1}"
/// is used to terminate since there isn't any scenario I know of where a path can include more than two forward slashes (not counting URIs). Then, !$ and ${PATH:0:-1} are used because otherwise the command would include !!L – which would get interpreted as an exclamation point and the letter L instead of the file path and a LF character. Anyway, you get the idea.

I'm posting this here instead of the feature request section because there might already be a way to accomplish this that I don't know about. If there isn't, I can repost it there.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum