jsch


java jsch -executing multiple unix commands


Channel channel=session.openChannel("exec");
((ChannelExec)channel).setCommand("cd ../ && pwd && ls");
channel.connect();
channel.run();
Here how can i use the above code if my commands are from command line arguments or if they are stored in variable like cmd1 ,cmd2 etc
i tried
((ChannelExec)channel).setCommand("cmd1 && cmd2 && cmd3");
variable substitution is not happening. Please help me on this
Thanks,
Prashanth
The variables need to be specified outside of the String itself rather than being part of a String
((ChannelExec)channel).setCommand(cmd1 + " && " + cmd2 " + " && " + cmd3);

Related Links

Creating a new file in SSH enabled system using JSCH
How to interact with the script after its execution using Jsch
java jsch -executing multiple unix commands
How to get one stream from error stream and input stream when calling a script using JSCH
SFTP using jschexception verify false sometimes fails
how to increase the jsch buffer size?
The cipher 'aes256-cbc' is required, but it is not available
How to pause/resume procedure while/after upload file by ChannelSftp
jsch + running multiple command in shell after SU and then close channal
NGit/Nsch Generating SSH Keypair (c# Jgit)
Extract userInfo from JSCH stream
Running a Shell Script using java ( process Builder ) with a specific unix user
Java jsch and resuming file upload after interruption?
How to pass a variable through channel in Jsch?
How to handle passwords prompts in expectj
Retaining the last modified date while using ChannelSftp for file transfer

Categories

HOME
maven
yii2
hook
netsuite
cookies
minimum-spanning-tree
mediawiki
tizen
office365api
relayjs
read-eval-print-loop
cvs
yarn
sqlite3
pivotal-cloud-foundry
uber-api
portia
slick-slider
gorm
quickbooks
google-apps-marketplace
zend-framework3
remote-access
ups
vaadin7
opentracing
database-replication
orleans
xpages-ssjs
javacv
info.plist
fluentvalidation
maquette
xacml
log4js-node
jaxb2
windowbuilder
create-table
scorm2004
code-contracts
gammu
overriding
main
space-complexity
espeak
neuroscience
sharefile
splice
awt
sas-visual-analytics
texmaker
gpx
avconv
pubmed
jquery-validate
logparser
fancybox-2
slickedit
android-cursor
windows-mobile-6.5
namecoin
mako
flutterwave
nbconvert
minimization
google-cdn
passport-google-oauth
grails-tomcat-plugin
adxstudio-portals
mongocsharpdriver
multiple-regression
jwplayer7
persist
sigabrt
hover-over
design-by-contract
simple-framework
tmuxinator
wyam
varargs
microbenchmark
javax.mail
offloading
typekit
tablelayout
coldbox
bitcoinj
openexr
eol
contenttype
navigationservice
system.net.webexception
xceed-datagrid
dealloc
bundles
android-2.2-froyo
xsockets.net
apc
dbconnection
ora-00911
batterylevel
gridcontrol
pushbackinputstream
type-equivalence
smtp-auth
reddot
cufon
stage
krl
imac
sudzc
subviews
sproutcore-2
webkit.net
anti-piracy
grid-system
signal-handling
lzh

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App