You are not logged in.

#1 2021-04-01 05:01:30

AirsoftHamster
Member
Registered: 2020-11-10
Posts: 74

[SOLVED] How do I execute a command as soon as I login to a TTY?

I have a program that I use to start different window managers or desktop environments. How can I get it to load as soon as I load TTY1? By that, I mean after I log in, I want the first thing that executes to be that program. If it matters, I use zsh with oh-my-zsh for plugins and theming. My default shell is set to /bin/zsh.

Last edited by AirsoftHamster (2021-04-01 05:26:07)

Offline

#2 2021-04-01 05:03:46

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] How do I execute a command as soon as I login to a TTY?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2021-04-01 05:04:51

AirsoftHamster
Member
Registered: 2020-11-10
Posts: 74

Re: [SOLVED] How do I execute a command as soon as I login to a TTY?

Sorry, I don't entirely understand. Where do I put that code?

Offline

#4 2021-04-01 05:14:18

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] How do I execute a command as soon as I login to a TTY?

https://wiki.archlinux.org/index.php/Zs … down_files

Mind you, since you have essentially broken your shell by installing OMZ, it is difficult to predict what may actually happen.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2021-04-01 05:19:31

AirsoftHamster
Member
Registered: 2020-11-10
Posts: 74

Re: [SOLVED] How do I execute a command as soon as I login to a TTY?

Out of curiosity, how does installing oh-my-zsh break my shell?

Offline

#6 2021-04-01 05:21:52

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] How do I execute a command as soon as I login to a TTY?

Zsh is a powerful, elegant shell. OMZ is a ratmangle of bloat and misunderstood "hacks" that results in undocumented and unexpected behaviours. Read the boards here: just about every problem reported with zsh as the shell is solved by uninstalling OMZ.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2021-04-01 05:25:31

AirsoftHamster
Member
Registered: 2020-11-10
Posts: 74

Re: [SOLVED] How do I execute a command as soon as I login to a TTY?

Ah. Thanks for the response. By the way, creating a .zprofile file in my home directory and adding

if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
  exec COMMAND TO RUN
fi

makes the command run whenever I open my TTY. Thanks so much!

Offline

Board footer

Powered by FluxBB