I'm trying to set up my terminal so that Neofetch or Fastfetch runs automatically, but only the first time I open a terminal. I've added Neofetch to my .bashrc file, but it shows up every single time I open a new terminal window. Is there a way to make it run just once? For context, I'm using Ubuntu Gnome.
3 Answers
To achieve that, you can create a temporary file that indicates whether the command has already been run. Here’s a quick script you can add to your .bashrc:
```bash
if [[ ! -f /dev/shm/fetchblock ]]
then
touch /dev/shm/fetchblock
fastfetch # or use neofetch here
fi
```
This script checks for a file named `fetchblock`. If the file isn't there, it creates it and runs your command. Just remember, `/dev/shm` is a temporary storage, so this file will disappear with a reboot. If you prefer, you could use `/tmp` or another temp directory!
How exactly did you add Neofetch to your .bashrc?

Got it! I just learned that Neofetch isn't being updated anymore. I might need to switch to Fastfetch if it starts acting up.