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: NonePriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: NoneOpen/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
  • -unavailable- added by cfraizer (Submitted the item)
  • -unavailable- added by cfraizer
  •  

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 05 Sep 2015 07:38:12 AM UTCcfraizerCarbon-Copy-=>Added cfraizer

    Back to the top


    Powered by Savane 3.1-cleanup1