Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 6248  / 2 Years ago, tue, february 8, 2022, 1:16:57

I have some Amazon EC2 instances that run Ubuntu 10.04.1 LTS.



Every time I connect to those instances I run a couple of simple commands, like a cd <repository>, a git status etc.



How can I add them to a script / to which script should I add them so they would be automatically ran every time, on SSH connect?


More From » bash

 Answers
5

The solution is basically to run a script on login.



Since Bash looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.



I did a simple ls -la ~, saw that from that hierarchy .profile was the first only one available, so I just appended my commands here.



Problem solved!


[#39653] Tuesday, February 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ranquctive

Total Points: 391
Total Questions: 103
Total Answers: 104

Location: South Sudan
Member since Thu, Feb 4, 2021
3 Years ago
ranquctive questions
;