wget or curl throws -bash: syntax error near unexpected token `(' - wget

I am trying to download a file which has symbol "(" in it;s URL.
I tried using wget and curl. Bash is not allowing it to be processed and throws "-bash: syntax error near unexpected token `('".
Any idea how to resolve it?

You should escape the character by adding a "\" before it. Like \( or \)

Add single quotes ' or double quotes " around the URL.

I hope someone found this useful.
In my case, I want to curl this file name data (1).rar
then it should be write like this in the terminal
http://example.com/data%20\(1\).rar

I encountered the same problem and solved that issue just by adding double quotes to the command what I am passing.
for eg:
git checkout "<branch_name>"

Related

jq reading filter from a file results in Invalid Syntax Error

filter.jq
".security = {hideVersionStringsWhenNotLogged: true}"
When trying to apply the filter,
jq --from-file filter.jq a.json
encountering the following error
jq: error: syntax error, unexpected INVALID_CHARACTER, expecting $end (Unix shell quoting issues?) at , line 1
tried all combinations of single and double quotes to no avail.
Any suggestions?
Thx
If you want the filter to be read from a file, do not enclose it in the quotation marks that are needed if the filter is specified on the command line.
So the contents of your filter.jq file could look like this:
.security = {hideVersionStringsWhenNotLogged: true}

Powershell missing terminator error

I get an error when running a powershell script on one of our VMs. The error is:
ERROR: The string starting:
At C:\iso\floppy\Blah.ps1:7
char:95
+ cinst VisualStudio2012Professional -packageParameters "/Features:'WebTools
SQL VCMFCLibraries <<<< ' "
is missing the terminator: '.
The line, as pasted straight from the script is:
cinst VisualStudio2012Professional -packageParameters "/Features:'WebTools SQL VCMFCLibraries ' "
I can't see an error at all, the terminators are all correct, and this line was working fine until a few days ago.
Hoping someone else can see the obvious.
Found the issue. Further up the script file I had added the line
choco sources add -n=Local -s='L:\Chocolatey Package Repository'
It should have been
choco sources add -n Local -s 'L:\Chocolatey Package Repository'
As well as being wrong, it turns out that the = screws up the quote parsing despite the fact that the quotes match up, leading to a weird error further down.
Thank you to everyone who commented, it helped.

sed repetition-operator operand invalid *****

I have text files that contain ***** in some locations. I need to replace the ***** with 9.999. This obviously came from some formatting error, but I do not have the program that created the files I now have to work with. I tried using the following command in csh:
sed -i "" 's/*****/9.999/g' *.dat
However, as I expected, I get the following error message:
sed: 1: "s/*****/9.999/g": RE error: repetition-operator operand invalid
I'm assuming this is because ***** is considered a special operator or something like that, but I can't figure out how to exempt them while using the sed command.
Does anyone have a hint that could help?
sed -E 's/\*{5}/9.999/g' file

What's wrong with this Bitvise Tunnelier SFTP command?

I'm trying to put together an SFTP command to be run through Powershell. The executable I have access to is SFTPC.exe (Bitvise Tunnelier)
The command I'm trying is
sftpc.exe user#ftp.domain.com -pw=password -unat=y -cmd="ls \"somefile.txt\""
According to the documentation at https://www.bitvise.com/files/sftpc-v4.14-usage.txt this should log in and run the command ls "somefile.txt" (quotes are escaped within the command parameter)
What actually happens is that I get another line for input, as if there's an unclosed quote.
I've tried adding an extra quote to the end
sftpc.exe user#ftp.domain.com -pw=password -unat=y -cmd="ls \"somefile.txt\"""
This connects and logs in, but the colland it tries to run is ls \somefile.txt"
Note the trailing quote and the leading slash.
So it looks like I'm missing something in the quote escaping, but I can't see what I might be doing wrong. I've also tried replacing double quotes with single in a couple of different places, experiments that usually end in a syntax error.
The escape character in powershell is not a backslash, it's the backtick.
Does the below work?
sftpc.exe user#ftp.domain.com -pw=password -unat=y -cmd="ls `"somefile.txt`""

WCAT gives error: "must specify at least one of the following parameters -run, -update, -terminate, -showclients or -setclients"

When running WCAT on my windows XP machine via the commandline I get the following error:
error: must specify at least one of
the following parameters -run,
-update, -terminate, -showclients or -setclients
The command I try to run is:
wcat.wsf -terminate -run -t scenario.wcat -f settings.ubr -s localhost -singleip -x
And is copied directly from the readme.
The problem is that in the readme, it's not really a hyphens.
If you look at the hex code, you see that the fake hyphen in the readme is 0x96, a hyphen is 0x2d
So go ahead and replace all the hyphens in the line with real ones. It will work after that.
The problem exists because of an error in the regex matching in the wcat.wsf file. For some reason the regex:
var run_regular_expression = /[-\/]run$/;
Will not match the "-run" argument
Changing it to:
var run_regular_expression = /[\-\/]run$/;
Does match the run argument.
Another option is to change to commandline call to:
wcat.wsf /terminate /run -t scenario.wcat -f settings.ubr -s localhost -singleip -x
using slashes instead of hyphens