mirror of
				https://github.com/appleboy/ssh-action.git
				synced 2025-11-04 13:43:53 +00:00 
			
		
		
		
	docs: improve non-interactive shell command handling
- Add a Q&A section to the README with information on resolving 'command not found' errors for non-interactive shells - Provide a solution involving editing `/etc/bash.bashrc` to ensure commands are added to the path in non-interactive shells Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
		
							parent
							
								
									71eaf27009
								
							
						
					
					
						commit
						0184999efb
					
				
							
								
								
									
										23
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								README.md
									
									
									
									
									
								
							@ -395,6 +395,29 @@ Now you can adjust you config:
 | 
				
			|||||||
        ls -al
 | 
					        ls -al
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Q&A
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Command not found (npm or other command)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See the [issue comment](https://github.com/appleboy/ssh-action/issues/31#issuecomment-1006565847) about interactive vs non interactive shell.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Basically, if you are running a command in a non interactive shell, like ssh-action, on many linux distros,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`/etc/bash.bashrc` file has a specific command that returns only, so some of the files didn't run and some specific commands doesn't add to path,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```sh
 | 
				
			||||||
 | 
					# /etc/bash.bashrc
 | 
				
			||||||
 | 
					# System-wide .bashrc file for interactive bash(1) shells.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# To enable the settings / commands in this file for login shells as well,
 | 
				
			||||||
 | 
					# this file has to be sourced in /etc/profile.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# If not running interactively, don't do anything
 | 
				
			||||||
 | 
					[ -z "$PS1" ] && return`
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					just comment out the line that returns early and everything should work fine, or you can use the real paths of the commands that you would like to use.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Contributing
 | 
					## Contributing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
We would love for you to contribute to `appleboy/ssh-action`, pull requests are welcome!
 | 
					We would love for you to contribute to `appleboy/ssh-action`, pull requests are welcome!
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user