In both POSIX-compatible shells such as bash
and in PowerShell, $
is a metacharacter, which – in unquoted use or inside "..."
– requires escaping in order to be interpreted verbatim (in order to be passed through to a command as-is).
However, the escape character differs between these two shells:
- For POSIX-compatible shells it is
\
:
psql -d trm -h localhost -p 5432 -U postgres -c "\COPY ts_dev.tbl\$trm_secndry_readings from 'FILEPATH' with delimiter ',' ;"
- For PowerShell it is
`
(the so-called backtick; see about_Special_Characters):
psql -d trm -h localhost -p 5432 -U postgres -c "\COPY ts_dev.tbl`$trm_secndry_readings from 'FILEPATH' with delimiter ',' ;"
CLICK HERE to find out more related problems solutions.