-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
./myyt: 9: Syntax error: redirection unexpected #2
Comments
The error is due to the usage of the here-string construct ( To fix the issue either change the executing shell to
Herestring is simply syntactic sugar for single-line heredoc input. |
So does this worked for you. Your error is fixed?
…On Sun, Dec 27, 2020 at 2:36 PM slavistan ***@***.***> wrote:
The error is due to the usage of the here-string construct (<<<) in line
9: query="$(sed 's/ /+/g' <<<$query)". Presumably @Bugswriter
<https://github.com/Bugswriter> links */bin/sh* to bash whereas some
people use a strictly POSIX compliant shell. Since the here-string is a
bashism and not POSIX compliant, this script will fail for the latter.
To fix the issue either change the executing shell to #!/bin/bash or use
the POSIX-compliant heredoc
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04>
construct:
query="$(sed 's/ /+/g' <<EOF
$query
EOF
)"
Herestring is simply syntactic sugar for single-line input from stdin.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFRUM5X35FUAWDZTUMTLSCDSW32KXANCNFSM4VKQBI7Q>
.
|
If you use telegram then you can contact me => @Bugswriter or join my
linux group @linuxindia (pretty cool)
On Sun, Dec 27, 2020 at 2:51 PM Suraj Kushwah <surajkushwah6969@gmail.com>
wrote:
… So does this worked for you. Your error is fixed?
On Sun, Dec 27, 2020 at 2:36 PM slavistan ***@***.***>
wrote:
> The error is due to the usage of the here-string construct (<<<) in line
> 9: query="$(sed 's/ /+/g' <<<$query)". Presumably @Bugswriter
> <https://github.com/Bugswriter> links */bin/sh* to bash whereas some
> people use a strictly POSIX compliant shell. Since the here-string is a
> bashism and not POSIX compliant, this script will fail for the latter.
>
> To fix the issue either change the executing shell to #!/bin/bash or use
> the POSIX-compliant heredoc
> <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04>
> construct:
>
> query="$(sed 's/ /+/g' <<EOF
> $query
> EOF
> )"
>
> Herestring is simply syntactic sugar for single-line input from stdin.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#2 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AFRUM5X35FUAWDZTUMTLSCDSW32KXANCNFSM4VKQBI7Q>
> .
>
|
That worked, thanks! |
Hi Bugswriter, thanks for the script!
When running ./dmenyt or ./myyt it prompts for the search query. Regardless of what I enter I receive the syntax error
Dependencies:
API key is properly inserted as variable in terminal,
output of echo:
The text was updated successfully, but these errors were encountered: