Probably the simplest thing is:
$ ssh -t host 'cmd1; cmd2; sh -i'
If you want to set variables, do:
$ ssh -t host 'cmd1; cmd2; FOO=hello sh -i'
Note that this is a terrible hack, and you would be much better off putting your desired initial commands in a script and doing:
$ scp setup host:~ $ ssh host host$ . setup
Related Contents:
- How do I copy a folder from remote to local using scp?
- How to use SSH to run a local shell script on a remote machine?
- How to set ssh timeout?
- How to ssh to vagrant without actually running “vagrant ssh”?
- How to input automatically when running a shell over SSH?
- How to split a file using a numeric suffix
- How to delete from a text file, all lines that contain a specific string?
- How can I reverse the order of lines in a file?
- Find and replace in file and overwrite file doesn’t work, it empties the file
- Going to a specific line number using Less in Unix
- Check if a file exists with a wildcard in a shell script [duplicate]
- How can I shuffle the lines of a text file on the Unix command line or in a shell script?
- Getting the last argument passed to a shell script
- How can I parse a YAML file from a Linux shell script?
- Curl to return http status code along with the response
- What are the uses of the exec command in shell scripts? [closed]
- How to check if a file exists in a shell script
- Compare a string using sh shell
- Seeing escape characters when pressing the arrow keys in python shell
- Returning value from called function in a shell script
- What is the difference between a directory and a folder?
- Compare two files line by line and generate the difference in another file
- Why 0 is true but false is 1 in the shell?
- How to invoke bash, run commands inside the new shell, and then give control back to user?
- How to print the number of characters in each line of a text file
- Choosing the shell that SSH uses?
- Force SSH to use a specific shell
- How to rename multiple files by replacing word in file name?
- How to edit command completion for ssh on zsh?
- Using telnet in shell script
- Shell Script Syntax Error: Unexpected End of File [duplicate]
- Commandline hexdump with ASCII output?
- Write byte at address (hexedit/modify binary from the command line)
- Trim leading and trailing spaces from a string in awk
- Subtract 1 hour from date in UNIX shell script
- Time condition loop in shell
- Show full path when using options
- How would you launch a browser from the a node.js command line script [duplicate]
- How to run a series of vim commands from command prompt
- ZSH Agnoster Theme showing machine name
- Read first x lines of csv file into new outfile?
- using OR in shell script
- How to replace one character with two characters using tr
- Is there a static analysis tool like Lint or Perl::Critic for shell scripts?
- How do I get the default gateway in Linux given the destination?
- Shell cmd “date” without new line in the end
- How to resume screen?
- How to generate a 2hour-long blank video
- How to change password of AWS Cognito User?
- Rename files recursively Mac OSX