3

I like to make command-line bash variables for testing or for other purposes. I give them generic names like a, b, var1... Sometimes I may forget which variables I've already used. Anyway, is there a single command to clear all bash variables? Now after running such a command, I want all bash variables that were defined by the user to become undefined. When echo $undefinedvariable is run, the result is a blank line. All built-in variables like $USER or $SHELL should remain untouched by this command.

Galaxy
  • 485
  • 1
  • 7
  • 12

1 Answers1

6

Use the bellow command

 $ exec bash

It will clear all bash variable

AReddy
  • 3,122
  • 5
  • 35
  • 75
Rakib
  • 2,347
  • 1
  • 17
  • 20