-2

I'm trying to add script

function proxyset() {
        proxy_enabled=true

        NO_PROXY_DOMAINS=".abc.com,"
        LOCAL_ADDRESSES="localhost"

        USER=<USER_ID>
        PASSWORD=<URL_ENCODED_PASSWORD>
        SERVER=httppxgot.abc.com
        PORT=8080

# Disable HTTP proxy
function proxyunset() {
        unset NO_PROXY
        echo 'Im unset!'
}

but when I'm opening cygwin terminal its showing

syntax error near unexpected token `newline'
-bash: /cygdrive/c/Users/XXX/.bashrc: line 214: `        USER=<USER_ID>'

whats is wrong with script

4
  • bash function doesn't accept - in its name. Check that!
    – mja
    Dec 4, 2018 at 12:29
  • sure that works: function echo-test() { echo test ;}; echo-test
    – Benibr
    Dec 4, 2018 at 12:33
  • 3
    There is a missing close bracket for the firs function.
    – pa4080
    Dec 4, 2018 at 13:15
  • 1
    Cygwin is not Ubuntu.
    – wjandrea
    Dec 4, 2018 at 21:40

1 Answer 1

3

As it says, bash can not handle the line 214 in which the USER variable is set to I don't know what you want to fill in there but the signs '<' and '>' are used in bash for redirecting output therefore the variable cannot be set.

Example:

bash-4.4$ USER=<USER_ID>
bash: syntax error near unexpected token `newline'

bash-4.4$ USER=test<
bash: syntax error near unexpected token `newline'

bash-4.4$ USER=test
bash-4.4$ echo $USER
test

If you want to get your actual username or id either use the command id or look with export for Environment Variables which already exists.

For more information about I/O redirection have a look at the docs: https://www.tldp.org/LDP/abs/html/io-redirection.html

Not the answer you're looking for? Browse other questions tagged .