patchThe GNU Bourne-Again SHell - Patches: patch #8733, let `declare -p -g FOO' generate...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #8733: let `declare -p -g FOO' generate global declarations

Submitter:  Colin Fraizer <cfraizer>
Submitted:  Sat 05 Sep 2015 07:38:12 AM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  None Open/Closed:  Open

Sat 05 Sep 2015 07:38:12 AM UTC, original submission:  

As I think is common, I use ``declare -p FOO > my_file'' in shell functions to persist variables (especially arrays and associative arrays) into files.

For modularity, I would like to use a shell function to load those persisted values when (if) they are needed with ``source my_file''. My problem is that, if FOO is a global variable, it is persisted as ``declare -a FOO...'', but I want it persisted as ``declare -a -g FOO'' so it will be visible in the global namespace of my shell after the function returns.


Colin Fraizer <cfraizer>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Updated the item)
  • -email is unavailable- added by cfraizer (Submitted the item)
  • -email is unavailable- added by cfraizer
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-20 chet StatusNone Wont Do
    2015-09-05 cfraizer Carbon-Copy- Added cfraizer

    Back to the top

    Powered by Savane 3.14-6db8.
    Corresponding source code