random-gradient | Generate beautiful random gradients | Runtime Evironment library
kandi X-RAY | random-gradient Summary
kandi X-RAY | random-gradient Summary
Generate beautiful random gradients
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of random-gradient
random-gradient Key Features
random-gradient Examples and Code Snippets
Community Discussions
Trending Discussions on random-gradient
QUESTION
I'm writing the .xinitrc for my system, but the code (below) crashes on line 17 (the ending brace of the `freespace' function) with the error
"}" unexpected (expected "done")
Is there actually a problem with the function declaration, or did I mess up somewhere else in the script?
...ANSWER
Answered 2017-Sep-15 at 15:55This error will happen if the shell running this code is not actually bash. It's noteworthy that your script doesn't include a shebang -- without #!/usr/bin/env bash
or another shebang, the interpreter used is unspecified. (Explicitly specifying sh yourscript
will override the shebang and force sh
, just as bash yourscript
will ignore the shebang and use bash, but that's neither here nor there).
function
is not a keyword in standard POSIX sh -- it's a ksh extension which bash adopted. Consequently, to a POSIX shell, the {
in function freespace {
is not syntax -- it's an argument to be passed to a command named function
.
By contrast, the }
is parsed as syntax, but it doesn't match with any syntactic opening brace; hence, your error.
In standards-compliant syntax, the declaration would be:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install random-gradient
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page