757 questions
3 votes
1 answer
97 views
Why does declare reset the IFS in bash?
Why does this work to create an array out of the newline separated elements: declare -a themes IFS=$'\n' themes=($(plutil -extract 'Window Settings' xml1 -o - - <<< "$terminal_settings&...
0 votes
0 answers
109 views
Lost name reference when setting extra attribute
I have shot myself in the foot a fair number of times with declare until I started to differentiate its switches that are not all equal. Some set variable attributes, but some just affect scope. So ...
1 vote
1 answer
96 views
`declare -x` vs `export` inside a function
I always considered declare equivalent to local when used within a function and declare -x equivalent to export. f() { declare -x k=1 } f echo $k The above was expected to show 1, but ...
-1 votes
2 answers
215 views
How to deserialize ${aa[@]@K} into referenced associative array with no eval effect?
How can I reference an associative array and reassign its content from serialized string? (The eval requirement is now spelled out explicitly in the title, but this is natural when it comes to ...
0 votes
4 answers
171 views
How to pass complex serialized variables from a (remote) subshell to the parent?
I would like to do equivalent of name referencing from a function run in a subshell, so that arbitrary variable (e.g. associative array) is then available in the parent. Note on duplicates: I found ...
0 votes
1 answer
31 views
What is wrong in this declare?
When I am running code DECLARE c int; BEGIN execute 'select count(1) from my_dwh.accounts' into c; raise notice c; END; I am getting error SQL Error [42601]: ERROR: syntax error at or near "...
2 votes
2 answers
76 views
Declare variables in the same address of other variables in XC8
I have the following problem with XC8 compiler I had an array --> char my_array[8]; but for convenience, I want to declare the variable --> unsigned int cont_up; at the same address of ...
6 votes
1 answer
108 views
Manipulate arrays which have $var in their names [duplicate]
I am trying to manipulate associative arrays that contain $var in their names. # this does not work for i in {1..3}; do declare -A tab$i=( [nom]="john" [comment]="this does not work&...
3 votes
3 answers
196 views
Bash declare not liking values with spaces
This is a continuation of awk gsub not replacing all instances of period in field. I have some input: $ cat ./ipv4settings.txt ipv4.gateway: 192.168.2.1 ipv4.routes: ...
0 votes
1 answer
452 views
Excel VBA 32-Bit to 64-Bit
I have a old Excel file with 32-bit code. Who can turn this into 64-Bit code? Private Declare Function SetWindowPos Lib "user32" ( _ ByVal hWnd As Long, _ ...
0 votes
0 answers
58 views
bash: declare -i behavior unclear
I'd need clarification about some aspects of declare -i: As stated on gnu.org: 6.5 Shell Arithmetic [...]The value of a variable is evaluated as an arithmetic expression when it is referenced, or ...
0 votes
1 answer
74 views
How to modify query run based on the day of the week?
I have code that runs every weekday looking for the previous day, however, on Mondays, it needs to look from last Friday through Sunday. Right now, I am manually commenting in and out rows of code if ...
2 votes
1 answer
69 views
SQL Server scalar variable holds only last value from table result instead of throwing an error
I have a source table that I think whose table stores only one distinct period. I'm assigning that period to an int variable like below. SET NOCOUNT ON; DECLARE @tarih INT; ------------ SELECT @tarih =...
0 votes
1 answer
58 views
How to enforce variable-types in bash?
I'm trying to create an err function to be used by bash-scripts. The function is supposed to emulate BSD's errx(3) -- printing the specified message and exiting with the code specified as the first ...
0 votes
1 answer
55 views
SQL - inserting a combination of set and dynamic data
I need to insert a combination of set and dynamic data into a table. For example, I have a table called "Sports" and wanted to insert the set value "Soccer" to the column "...