Timeline for clear out all variables without closing terminal
Current License: CC BY-SA 3.0
23 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 27, 2019 at 3:14 | answer | added | user30747 | timeline score: 1 | |
| Jan 18, 2016 at 16:28 | vote | accept | Alex Jones | ||
| Dec 11, 2014 at 19:46 | answer | added | Gilles Quénot | timeline score: 20 | |
| Dec 11, 2014 at 0:40 | history | edited | Braiam | CC BY-SA 3.0 |
edited tags
|
| Dec 11, 2014 at 0:37 | history | tweeted | twitter.com/#!/StackUnix/status/542840686585053184 | ||
| Dec 11, 2014 at 0:31 | history | edited | Alex Jones | CC BY-SA 3.0 |
added 102 characters in body
|
| Dec 10, 2014 at 23:57 | comment | added | Alex Jones | @Gilles my apologies I should not have mentioned "script". | |
| Dec 10, 2014 at 23:56 | history | edited | Alex Jones | CC BY-SA 3.0 |
deleted 35 characters in body
|
| Dec 10, 2014 at 23:49 | comment | added | Gilles 'SO- stop being evil' | I have no idea what you're trying to do. Are you talking about an interactive shell or a script? Variables set in a script executed from an interactive shell don't affect the parent shell. Tell us what you want to achieve, not which dead end you're pursuing. | |
| Dec 10, 2014 at 23:42 | comment | added | jimmij | The short explanation is also here: stackoverflow.com/questions/15222328/… | |
| Dec 10, 2014 at 23:37 | comment | added | mikeserv |
@edwardtorvalds - not like that - that was just a naive command - you need a little more to it to do it right.=. I did explain it - in the link I posted above. It's explained pretty well (I hope). I'd rather not do it twice. Will you read it please and let me know if you need any more help or whatever? Particularly you'll want not to do the set part in the link I left - that's what migrates vars from old shell to new.
|
|
| Dec 10, 2014 at 23:36 | comment | added | Alex Jones |
@mikeserv your very first comment exec "$0" works. can you please explain it in answer how ?
|
|
| Dec 10, 2014 at 23:34 | comment | added | mikeserv |
@muru - he gets a list saved to a $var with var=$(declare -p +F); then passes that as an argument to a function which does echo "${2%%=*}". That answer has a few problems with sheer size - but it should work if your environment isn't huge.
|
|
| Dec 10, 2014 at 23:30 | comment | added | Alex Jones | @muru didn't understood thats why I asked :( | |
| Dec 10, 2014 at 23:28 | comment | added | muru | I would, if I understood what Gilles did. But whatever he did, if you can get a list of variables defined by you using it, then probably you can use unset on them. | |
| Dec 10, 2014 at 23:25 | comment | added | muru | Related: unix.stackexchange.com/questions/172244/… | |
| Dec 10, 2014 at 23:22 | history | edited | Alex Jones | CC BY-SA 3.0 |
edited title
|
| Dec 10, 2014 at 23:18 | comment | added | Alex Jones | @HaukeLaging I am working with arrays using script. I sometimes add one element to it. because of which I cant run the script with old values(since array is changed). i have to close the terminal and start a new session again. I hope I made clear. if not please let me know :) | |
| Dec 10, 2014 at 23:15 | history | edited | Alex Jones | CC BY-SA 3.0 |
deleted 93 characters in body
|
| Dec 10, 2014 at 23:13 | comment | added | mikeserv |
theyre not global - they're defined somewhere. probably in your profile or rcfile. if so then exec is what you want. I once did an answer in detail on this. maybe look - it was all about clearing the shells memory.
|
|
| Dec 10, 2014 at 23:12 | comment | added | Hauke Laging | Why do you want to do that? | |
| Dec 10, 2014 at 23:07 | comment | added | mikeserv |
exec "$0"maybe - but it's hard to tell what you mean by global.
|
|
| Dec 10, 2014 at 23:06 | history | asked | Alex Jones | CC BY-SA 3.0 |