Home > OS >  How do I make a script start up a terminal and run a text line on bash?
How do I make a script start up a terminal and run a text line on bash?

Time:03-28

I am pretty sure its simple, I just couldn't find an answer that fit bash or linux. Here is my script, its really short:

gnome-terminal
echo "you heff bin hackt"
$SHELL

I wanted to make it just as a quick joke but I am having issues with it. It opens the terminal but does not run the text line. What is going wrong with it?

CodePudding user response:

You can use the --command option

gnome-terminal --command="/bin/echo 'msg'; $SHELL"

CodePudding user response:

If you want to show the text if you open any new terminal session, you could add your command to the .bashrc file:

echo 'echo "message"' >> ~/.bashrc
  •  Tags:  
  • bash
  • Related