I have a perl script as below, where I want to access a network path on a remote windows machine from a linux machine using rsh.
$cmd = "rsh -l $username $host \"pushd \\\\network\\path\\to\\the\\directory && dir\"";
print $cmd, "\n";
print qx($cmd);
When I run the script the third line prints output The system cannot find the path specified. However, if I run the command printed by the second line directly from the terminal it works fine.
I'm not able to understand why the script is not working. If the command works from the terminal, it should work using qx() too.
While you escape your meta-characters against interpolation by double-quotes and by the remote shell, qx might itself interpolate the string again, in which case you might need to add another level of escaping. From the documentation of qx:
A string which is (possibly) interpolated and then executed as a system command with /bin/sh or its equivalent. ...
How that string gets evaluated is entirely subject to the command interpreter on your system. On most platforms, you will have to protect shell metacharacters if you want them treated literally. This is in practice difficult to do, as it's unclear how to escape which characters. See perlsec for a clean and safe example of a manual fork() and exec() to emulate backticks safely.
The following code runs at the CMD line, but get error "Expected end of statement", Line: 1 Char 11.
sqlcmd -S DONALDLT-PC\SQLEXPRESS -E -i C:\SQL\append_ToTblPurchaseDetials.sql
Its failing because your syntax is incorrect. You can not execute shell scripts directly in visual basic. The statements/parameters need to be properly escaped and passed to some type of execute method. If you are already doing this, please add the entire code.
I'm trying to debug a program in Eclipse so that the command-line arguments will correspond to the following invocation from the shell
[joeuser#host]$ myapp "foo<bar>" -v
Now, specifying the arguments as
-v "foo<bar>"
in the Eclipse Debug Configuration dialog does not work - there's a bash message on the console saying:
/bin/bash: bar: No such file or directory
i.e. the quotation marks get eaten away. I've tried:
escaping the angle-brackets with backslash
escaping the angle-brackets with double-backslashes
escaping the double-quotation marks
using single quotation marks
and probably some other options - none worked. Now, supposedly, there are "simple rules" on how this is to be done, being one of the answers to this question:
Eclipse & quotes in command line arguments?
but that doesn't seem very simple to me, or perhaps I am simpler than those rules. Why can't it just build a string with the command and all of the arguments, unescaped and unsanitized, and just let bash do whatever it does always? :-(
PS - I'm using Eclipse CDT 8.8.1 (Mars.2) on Debian Stretch.
I tried running dialyzer --help from the werl command line and it hung. Am I missing something? Is it only available for the dos shell (I'm on XP SP3)?
It is possible to run dialyzer from within the Erlang shell (and thus, I assume, werl) but the way you attempted to invoke it is only appropriate for the DOS shell.
See Using the Dialyzer from Erlang near the bottom of http://www.erlang.org/doc/man/dialyzer.html
1> dialyzer:module_info().
[{exports,[{plain_cl,0},
{run,1},
{gui,0},
{gui,1},
{plt_info,1},
{format_warning,1},
{format_warning,2},
{module_info,0},
{module_info,1}]},
{imports,[]},
{attributes,[{vsn,[255802808152277240424696594996505155803]}]},
{compile,[{options,[{outdir,"/private/tmp/homebrew-erlang-R15B01-pQbu/erlang-otp-079e06a/lib/dialyzer/src/../ebin"},
warnings_as_errors,warn_missing_spec,warn_untyped_record,
warn_unused_import,warn_exported_vars,debug_info]},
{version,"4.8"},
{time,{2012,4,13,13,14,35}},
{source,"/private/tmp/homebrew-erlang-R15B01-pQbu/erlang-otp-079e06a/lib/dialyzer/src/dialyzer.erl"}]}]
2> dialyzer:gui().
ok
Is there a way to pass command line arguments to a Perl program you are running from the Padre menu ("Run->Run Script")?
Under Tools->Preferences->"Language - Perl5", set "Script arguments" and save.
Or under Tools->Preferences->Advanced, see "run_script_args_default". Set a value, and save.
Either way they do the same thing. You can also use the "Interpreter Arguments" field to set flags for the Perl interpreter.