Comments (9)
Hm, seems your version of bash doesn't have global variables (-g). If
possible, try bash>=4.2.
I'll try to figure out a workaround.
On Mon, 15 Feb 2016 at 09:50, Łukasz Schabek [email protected]
wrote:
Have this error when running your-script.sh on Solaris.
$ uname -a
SunOS deuxviqm 5.11 11.2 sun4v sparc sun4v
$ bash --version
GNU bash, version 4.1.17(1)-release (sparc-sun-solaris2.11)
$ ./your-script.sh
/pkg/vdcro/tools/bash-oo/lib/oo-bootstrap.sh: line 44: declare: -g:
invalid option
declare: usage: declare [-aAfFilrtux] [-p] [name[=value] ...]
/pkg/vdcro/tools/bash-oo/lib/oo-bootstrap.sh: line 45: declare: -g:
invalid option
declare: usage: declare [-aAfFilrtux] [-p] [name[=value] ...]
/pkg/vdcro/tools/bash-oo/lib/oo-bootstrap.sh: line 176: declare: -g:
invalid option
declare: usage: declare [-aAfFilrtux] [-p] [name[=value] ...]
/pkg/vdcro/tools/bash-oo/lib/oo-bootstrap.sh: line 177: declare: -g:
invalid option
declare: usage: declare [-aAfFilrtux] [-p] [name[=value] ...]
/pkg/vdcro/tools/bash-oo/lib/oo-bootstrap.sh: line 178: declare: -g:
invalid option
declare: usage: declare [-aAfFilrtux] [-p] [name[=value] ...]
/pkg/vdcro/tools/bash-oo/lib/oo-bootstrap.sh: line 190: declare: -g:
invalid option
declare: usage: declare [-aAfFilrtux] [-p] [name[=value] ...]—
Reply to this email directly or view it on GitHub
#16.
from bash-oo-framework.
Declare -x is the other method for global variables.
I used the following on SunOS ${BASH_VERSION}=3.2.57(1)-release
[[ "${BASH_VERSION:0:1}" -lt 4 ]] && P="x" || P="g"
...
...
declare -${P} __oo__libPath="$( cd "${BASH_SOURCE[0]%/*}" && pwd )"
declare -${P} __oo__path="${__oo__libPath}/.."
declare -${P}a __oo__importedFiles
from bash-oo-framework.
-x
exports the variables, that's not the same as making them global. The thing is, you can't export arrays or associative arrays, which is what the framework currently depends on. How much of the framework seemed to work under bash 3.2.57, @JaredTS486? I would imagine many parts to be broken without a proper porting process.
from bash-oo-framework.
That is true they are not the same but for bash 3.2 that is the only alternative and so far does the trick. I got most of the framework sourced without any errors after I changed the declares and modified the Aliases but made no direct function calls. Most recently I was working on log.sh attempting to use eval and indirect variable references to mimic the associative arrays. I manage scripts that run on both 3.2 and 4.2 so I know some methods for portability.
from bash-oo-framework.
Ah, cool. Did you manage to get console logging running?
from bash-oo-framework.
I did but it required changing some major parts to Color.sh
declare/export only allow characters A-Z, a-z, 0-9, and _
So UI.Color.Default became UI_Color_Default etc...
Also had to change UI_Color_IsAvailable to a function that performs the same check.
UI_Color_IsAvailable(){ if
Also:
UI_Powerline_IsAvailable(){ if UI_Color_IsAvailable && test -z
Then the call below seemed to work without errors.
Console::WriteStdErr "This will be printed to STDERR, no matter what."
from bash-oo-framework.
Cool, thanks for investigating!
from bash-oo-framework.
Will this get integrated into the next release?
from bash-oo-framework.
@Tzrlk I think a version supporting bash 3 would have to differ by quite a bit of modules, but I'd be up for supporting bash 4.0 in master if you wanna PR that. PR's welcome for both, we can keep the backwards compatible version in a bash-3
branch.
from bash-oo-framework.
Related Issues (20)
- Is the project dead? HOT 3
- Sorry, a bit cheeky/impolite... HOT 2
- [question] Logging to File, Syslog or Email HOT 4
- Unbound variables cause a crash when running examples with 'set -u' HOT 3
- [bug?] `throw` is said to be 'undefined command' when `import` fail HOT 5
- Catch exception from Classes doesn't work HOT 7
- Inconsistent array assignments HOT 3
- Translating README into Japanese
- for people who want to use Bpkg to install this framework HOT 1
- example/trycatch.sh doesn't work as expected
- Make wiki page
- [Question] Does value of '__primitive_extension_fingerprint' have special meaning?
- update readme instructions for namedParameters
- util/exception.sh shows stack trace as expected but don't exit on Ctrl+C HOT 2
- False boolean not working HOT 1
- Referring this in Human example class doesn't work as described HOT 1
- Exception messages are invisible in light theme mode in Shell console.
- [Question] Is this project still alive? HOT 6
- [Discussion] Log API
- Using a variable for an Object name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bash-oo-framework.