I have a bash script which asks a user for the number of CPU cores and saves it to variable named $cores
.
Now I want to add this variable to .bashrc
, so I ask user how many CPU cores he has and then if he wants to save this value to .bashrc
.
Now the question: how can I check if $cores
already exists in .bashrc
so the script won't ask the user again?
.bashrc
belongs to the user and may be shared by different machines. – Stéphane Chazelas Jun 20 '14 at 12:54