pass protocols to command from file

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Need one more help please..



Manual run of following command works fine



/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt)



but shell fails
can't read "(< /pass.txt)": no such variable



!/usr/bin/expect



spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt"
expect "password"
send "N0r"
interact
expect eof.







share|improve this question






















  • please do not change question, as is my answer in completly useless. you asked a question about bash, then about expect, those ar two differents topic. would you kindly rollback to version 5 and ask a new question ?
    – Archemar
    Dec 14 '17 at 14:21










  • My apologies... I will change it to previous version.
    – SHaFqaT M
    Dec 14 '17 at 17:48














up vote
1
down vote

favorite












Need one more help please..



Manual run of following command works fine



/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt)



but shell fails
can't read "(< /pass.txt)": no such variable



!/usr/bin/expect



spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt"
expect "password"
send "N0r"
interact
expect eof.







share|improve this question






















  • please do not change question, as is my answer in completly useless. you asked a question about bash, then about expect, those ar two differents topic. would you kindly rollback to version 5 and ask a new question ?
    – Archemar
    Dec 14 '17 at 14:21










  • My apologies... I will change it to previous version.
    – SHaFqaT M
    Dec 14 '17 at 17:48












up vote
1
down vote

favorite









up vote
1
down vote

favorite











Need one more help please..



Manual run of following command works fine



/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt)



but shell fails
can't read "(< /pass.txt)": no such variable



!/usr/bin/expect



spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt"
expect "password"
send "N0r"
interact
expect eof.







share|improve this question














Need one more help please..



Manual run of following command works fine



/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt)



but shell fails
can't read "(< /pass.txt)": no such variable



!/usr/bin/expect



spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt"
expect "password"
send "N0r"
interact
expect eof.









share|improve this question













share|improve this question




share|improve this question








edited Dec 14 '17 at 14:18









Archemar

19k93366




19k93366










asked Dec 13 '17 at 14:54









SHaFqaT M

62




62











  • please do not change question, as is my answer in completly useless. you asked a question about bash, then about expect, those ar two differents topic. would you kindly rollback to version 5 and ask a new question ?
    – Archemar
    Dec 14 '17 at 14:21










  • My apologies... I will change it to previous version.
    – SHaFqaT M
    Dec 14 '17 at 17:48
















  • please do not change question, as is my answer in completly useless. you asked a question about bash, then about expect, those ar two differents topic. would you kindly rollback to version 5 and ask a new question ?
    – Archemar
    Dec 14 '17 at 14:21










  • My apologies... I will change it to previous version.
    – SHaFqaT M
    Dec 14 '17 at 17:48















please do not change question, as is my answer in completly useless. you asked a question about bash, then about expect, those ar two differents topic. would you kindly rollback to version 5 and ask a new question ?
– Archemar
Dec 14 '17 at 14:21




please do not change question, as is my answer in completly useless. you asked a question about bash, then about expect, those ar two differents topic. would you kindly rollback to version 5 and ask a new question ?
– Archemar
Dec 14 '17 at 14:21












My apologies... I will change it to previous version.
– SHaFqaT M
Dec 14 '17 at 17:48




My apologies... I will change it to previous version.
– SHaFqaT M
Dec 14 '17 at 17:48










1 Answer
1






active

oldest

votes

















up vote
1
down vote













Try



command $(< abc.txt)


where




  • $(< ) construct will read file, strip end of line and replace in command line

More information in Bash's manual, chapter Command Substitution:




Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any
trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).







share|improve this answer






















  • worked like a charm :-), Thanks a TON.
    – SHaFqaT M
    Dec 13 '17 at 18:22











  • Need one more help please.. Manual run of following command works fine /jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt) but shell fails can't read "(< /pass.txt)": no such variable #!/usr/bin/expect spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt" expect "password" send "N0r" interact expect eof.
    – SHaFqaT M
    Dec 14 '17 at 8:52










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f410659%2fpass-protocols-to-command-from-file%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













Try



command $(< abc.txt)


where




  • $(< ) construct will read file, strip end of line and replace in command line

More information in Bash's manual, chapter Command Substitution:




Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any
trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).







share|improve this answer






















  • worked like a charm :-), Thanks a TON.
    – SHaFqaT M
    Dec 13 '17 at 18:22











  • Need one more help please.. Manual run of following command works fine /jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt) but shell fails can't read "(< /pass.txt)": no such variable #!/usr/bin/expect spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt" expect "password" send "N0r" interact expect eof.
    – SHaFqaT M
    Dec 14 '17 at 8:52














up vote
1
down vote













Try



command $(< abc.txt)


where




  • $(< ) construct will read file, strip end of line and replace in command line

More information in Bash's manual, chapter Command Substitution:




Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any
trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).







share|improve this answer






















  • worked like a charm :-), Thanks a TON.
    – SHaFqaT M
    Dec 13 '17 at 18:22











  • Need one more help please.. Manual run of following command works fine /jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt) but shell fails can't read "(< /pass.txt)": no such variable #!/usr/bin/expect spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt" expect "password" send "N0r" interact expect eof.
    – SHaFqaT M
    Dec 14 '17 at 8:52












up vote
1
down vote










up vote
1
down vote









Try



command $(< abc.txt)


where




  • $(< ) construct will read file, strip end of line and replace in command line

More information in Bash's manual, chapter Command Substitution:




Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any
trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).







share|improve this answer














Try



command $(< abc.txt)


where




  • $(< ) construct will read file, strip end of line and replace in command line

More information in Bash's manual, chapter Command Substitution:




Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any
trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).








share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 13 '17 at 16:38









ilkkachu

49.9k674137




49.9k674137










answered Dec 13 '17 at 15:07









Archemar

19k93366




19k93366











  • worked like a charm :-), Thanks a TON.
    – SHaFqaT M
    Dec 13 '17 at 18:22











  • Need one more help please.. Manual run of following command works fine /jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt) but shell fails can't read "(< /pass.txt)": no such variable #!/usr/bin/expect spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt" expect "password" send "N0r" interact expect eof.
    – SHaFqaT M
    Dec 14 '17 at 8:52
















  • worked like a charm :-), Thanks a TON.
    – SHaFqaT M
    Dec 13 '17 at 18:22











  • Need one more help please.. Manual run of following command works fine /jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt) but shell fails can't read "(< /pass.txt)": no such variable #!/usr/bin/expect spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt" expect "password" send "N0r" interact expect eof.
    – SHaFqaT M
    Dec 14 '17 at 8:52















worked like a charm :-), Thanks a TON.
– SHaFqaT M
Dec 13 '17 at 18:22





worked like a charm :-), Thanks a TON.
– SHaFqaT M
Dec 13 '17 at 18:22













Need one more help please.. Manual run of following command works fine /jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt) but shell fails can't read "(< /pass.txt)": no such variable #!/usr/bin/expect spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt" expect "password" send "N0r" interact expect eof.
– SHaFqaT M
Dec 14 '17 at 8:52




Need one more help please.. Manual run of following command works fine /jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt) but shell fails can't read "(< /pass.txt)": no such variable #!/usr/bin/expect spawn ssh gq1@a732.co.com "/jrr/bin/java -Xms14M -Xm14M -Dhttps.protocols=Tv1.2 -Dk.ts.client.protocols=TLSv.2 -jar /gq1/ust/classes/S.jar $(< /pass.txt);cd /gucq1/gcust;mail -s 'Hello' sam@gm.com < logs.txt" expect "password" send "N0r" interact expect eof.
– SHaFqaT M
Dec 14 '17 at 8:52












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f410659%2fpass-protocols-to-command-from-file%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay