sh

How to add confirm in shell script in sftp mode [duplicate]

天涯浪子 提交于 2021-02-08 07:45:23
问题 This question already has answers here : How can I force ssh to accept a new host fingerprint from the command line? (6 answers) Closed 1 year ago . I have a shell script which is performing some renaming and archiving steps. I have added sftp commands to copy multiple files. But when i try to login to the remote machine thru putty it asks for confirmation like Are you sure you want to continue connecting (yes/no)? . I need to enter yes. but since this is being done thru the script am not

Specify which shell Yarn uses for running scripts

折月煮酒 提交于 2021-02-07 06:13:48
问题 My package.json has a script in it like this: "buildTslint": "node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts", Note the {,helpers/}*.ts part, this is called Brace Expansion and is only possible in bash , not sh . When running yarn buildTslint I get the following output: # yarn buildTslint yarn buildTslint v0.22.0 $ node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts error TS6053: File 'node_modules/awesomeLibrary

How to bypass an ampersand (&) without using quotes when receiving an URL as an argument to a shell script?

余生颓废 提交于 2021-02-05 12:31:06
问题 I'm building a shell script (trying to be POSIX compliant) and I'm stuck in an issue. The script is supposed to receive an URL and do some things with it's content. myscript www.pudim.com.br/?&args=ok The thing is, the ampersand symbol is interpreted as a command additive, and giving to my script only the www.pudim.com.br/? part as an argument. I know that the right workaround would be to surround the URL with quotes but, because I need to use this script several times in a row, I wanted to

Save ssh -V to variable

余生长醉 提交于 2021-02-05 06:00:20
问题 I am trying to automate the testing of passwordless ssh from 72 remote servers back to a central server. I have central server passwordless ssh working to the 72 servers, but need it working from them back the the central server. The 72 servers have one of two ssh versions. OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 OR sshg3: SSH Tectia Client 6.1.8 on x86_64-unknown-linux-gnu Build: 136 Product: SSH Tectia Client License type: commercial The issue I am experience is trying to save

Can you portably read sensitive input from the commandline?

扶醉桌前 提交于 2021-02-04 19:40:07
问题 The bash builtin read has a flag -s that prevents it from echoing whatever is being read from the commandline. After searching opengroup.org and filtering through all the other meanings for read , I still haven't found a POSIX/portable equivalent. Is there a reasonable way to do this? In bash it's easy enough: $ bash -c 'read -sp "What is your password? " password; printf "\n%s\n" "$password"' What is your password? I'll never tell! But in sh… $ dash -c 'printf "What is your password? "; read

FIFO with one READER and multiple WRITER in BASH/SH

僤鯓⒐⒋嵵緔 提交于 2021-01-29 07:42:55
问题 I have one named pipe (FIFO) say : 'MY_FIFO' One process reads the fifo from multiple processes to get instructions. (1) reader bash script: while read LINE < 'MY_FIFO' do # process line done (many) writer bash script: while [ 1 ] do INSTRUCTION = # get an instruction echo $INSTRUCTION > 'MY_FIFO' done This works fine to pass instructions to the reader when we have 1 writer or that the writers don't write at the same time. But if we have many writers writing at the same time, the reader gets

Stress testing URI using xargs + curls bash script failing with status empty

半腔热情 提交于 2021-01-29 05:09:47
问题 I'm trying to do user acceptance testing on an application which becomes unresponsive on a particular URL parameter included in the GET request. Steps I have curl and run the GET req (crafted) copied curl syntax for Unix and copied to ubuntu server along with some changes. 'https://abc.ai/getMultiDashboard/demouser' -H 'Cookie: _ga=GA1.2.561275388.1601468723; _hjid=ecd3d778-b7f5-4f7f-b3ef-6f9f12b13d66; 54651cc_an=4; _gid=GA1.2.1366208807.1601560229; _hjTLDTest=1; 54651cc_data

follow logfile with tail and exec on event

五迷三道 提交于 2021-01-29 05:01:38
问题 i wonder if there is a more simplyfied way to run the tail -f or -F on a logfile and execute a command each time a special keyword is mentioned. this is my working solution so far, but i don't like it for following reasons: i have to write new lines for each match to log file to avoid endless loop tail does not follow exactly the log, it could miss some lines while the command is executed i am not aware about CPU usage because of high frequency example: #!/sbin/sh while [ 1 ] do tail -n1

Is it possible to rename PascalCase1.wav to kebab-case-1.wav with a single perl regex?

时间秒杀一切 提交于 2021-01-29 00:45:00
问题 Here is a sample of my data: SomePascalCase.wav ThingsThat1.wav Are.wav Here.wav Here is the result I'm looking for: some-pascal-case.wav things-that-1.wav are.wav here.wav Here is what I used: for f in *.wav; do mv "$f" $( echo "$f" | perl -pe 's/([A-Z])([a-z]+)(?=[0-9A-Z])/\L\1\2-/g' | perl -pe 's/([A-Z])([a-z]+)(?=.wav)/\L\1\2/g' ) done Is it possible to consolidate the two regular expressions I used into a single one? 回答1: You wouldn't really use a regex substitution here. You would use

Is it possible to rename PascalCase1.wav to kebab-case-1.wav with a single perl regex?

我的梦境 提交于 2021-01-29 00:40:55
问题 Here is a sample of my data: SomePascalCase.wav ThingsThat1.wav Are.wav Here.wav Here is the result I'm looking for: some-pascal-case.wav things-that-1.wav are.wav here.wav Here is what I used: for f in *.wav; do mv "$f" $( echo "$f" | perl -pe 's/([A-Z])([a-z]+)(?=[0-9A-Z])/\L\1\2-/g' | perl -pe 's/([A-Z])([a-z]+)(?=.wav)/\L\1\2/g' ) done Is it possible to consolidate the two regular expressions I used into a single one? 回答1: You wouldn't really use a regex substitution here. You would use