1
votes

Pardon me if I have been unable to frame my question clearly.

I am trying to execute the following Linux command from Oracle Forms 10g procedure:

ls -lact --full-time /etc |awk 'END {print $6,$7,$8}'

In the procedure, I have the following:

command := ' ls -lact --full-time /etc |awk \'\END {print $6,$7,$8}  ';

The variable command is, of course, declared beforehand.

The error that I get is this:

Encountered the symbol "\" when expecting one of the following

I shall be grateful for any assistance to solve this problem.

1

1 Answers

3
votes

You can either just escape the single quotes within your string value by doubling them up:

command := 'ls -lact --full-time /etc |awk ''END {print $6,$7,$8}''';

or a bit more cleanly as you don't have to modify the original text (assuming Forms supports this!?) use the alternative quoting mechanism:

command := q'[ls -lact --full-time /etc |awk 'END {print $6,$7,$8}']';

Here I've used [] as the delimiters, but they can be any characters that don't appear in your actual string:

If the opening quote_delimiter is one of [, {, <, or (, then the closing quote_delimiter must be the corresponding ], }, >, or ). In all other cases, the opening and closing quote_delimiter must be the same character.