Run simple bash script to start applications at login
Go to System → Preferences → Startup Applications, then click Add. Under Command just enter spotify
, instead of the script. There's no need to start a terminal for it.
If you need the output, you can change your script:
#!/bin/bash
echo "start spotify"
spotify > /home/username/spotify.log
and set it as the command, rather than Spotify itself.
Make sure the script is executable by opening the file's properties, going to permissions and setting "Allow executing file as program".
ganjan
Updated on September 17, 2022Comments
-
ganjan over 1 year
I want to run a simple bash script automatically when I log in. For example
#!/bin/bash echo "start spotify" gnome-terminal -e spotify --title spotify
When I run this command, one
gnome-terminal
shows up andspotify
show up. I also want the gnome-terminal to popup "hidden" in a different virtual desktop. (one of the other four virtual desktops you can choose from taskbar)I tried to add this to
/home/me/.bash_login
or something, but that didn't work..-
flo about 13 years@Olli, that starts it every time you open a Terminal window :)
-
Olli about 13 years@Stefano: or when you login from console, or over ssh. Whenever your shell is started. That's why I said "that's not good..."
-
-
Olli about 13 yearsThere might be multiple reasons for terminal. For example debug messages.
-
flo about 13 years@Olli, Thank you, I've edited my answer accordingly. This seems to me like the proper solution.
-
Olli about 13 yearsyes, definitely. And of course you should use
~
instead of static path, so it'll work with any user :)