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

Submitted by:  Colin Fraizer <cfraizer>
Submitted on:  Sat 05 Sep 2015 07:38:12 AM UTC  
 
Category:  None Priority:  5 - Normal
Status:  None 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>

 

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 cfraizer (Submitted the item)
  • -email is unavailable- added by cfraizer
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-05 cfraizer Carbon-Copy- => Added cfraizer

    Back to the top


    Powered by Savane 3.3