logo
down
shadow

BASH QUESTIONS

Dockerfile does not replace text but command line does, possible bug?
Dockerfile does not replace text but command line does, possible bug?
This might help you Just to recap. I have the file my-textfile.conf in my working directory. Its content is:
TAG : bash
Date : November 29 2020, 04:01 AM , By : user2188264
Asterisk Creating Script that Emails based on where call originated
Asterisk Creating Script that Emails based on where call originated
I hope this helps . This is a bit of a shambles. You've got an unterminated strings all over the place, your spacing is incorrect around your square brackets, and you're quoting numbers as strings.Since you're using /bin/bash you can use Bash conditi
TAG : bash
Date : November 28 2020, 04:01 AM , By : Calum Dowie
Create wait view in bash script
Create wait view in bash script
fixed the issue. Will look into that further Assuming you have built nyancat, as described in the instructions on github, and placed it somewhere on the PATH:
TAG : bash
Date : November 27 2020, 04:01 AM , By : Candice
Linux Bash ask if user want to execute input
Linux Bash ask if user want to execute input
will be helpful for those in need Use an array to store the user inputs. Let the user enter inputs until a keyword is entered, for instance END or just the empty string:
TAG : bash
Date : November 24 2020, 04:01 AM , By : fbk
nested dictionaries in bash
nested dictionaries in bash
I hope this helps you . Althought bash does not support nested arrays as others comment, if your bash version is 4.3 or newer, declare has an -n option to define a refence to the variable name which works as something like a C pointer.Then you can sa
TAG : bash
Date : November 24 2020, 04:01 AM , By : Koushik
google big query command line executing complex query giving error unexpected '('
google big query command line executing complex query giving error unexpected '('
will help you Terminal might mess up some characters when pasting long and complex text, I would suggest saving your query as a .sql file and then just run:
TAG : bash
Date : November 23 2020, 04:01 AM , By : Edgar
Bash script with sendmail delivers email when executed manually but not from crontab
Bash script with sendmail delivers email when executed manually but not from crontab
help you fix your problem Be aware that the PATH environment variable is different for crontab executions than it is for your typical interactive sessions. Also, not all of the same environment variables are set. Consider specifying the full path for
TAG : bash
Date : November 23 2020, 04:01 AM , By : user2185820
SFTP bash shell script to copy the file from source to destination
SFTP bash shell script to copy the file from source to destination
I wish this helpful for you In a simple case such as this, you could use scp instad of sftp and specify the files to copy on the command line:
TAG : bash
Date : November 22 2020, 04:01 AM , By : Asha Anitha Devi
Awk and a global variable
Awk and a global variable
I think the issue was by ths following , Your variable is in single quotes, therefore it isn't expanded. In the awk part replace $numIterations with '"$numIterations"'.Better alternative: Use awk -v ni="$numIterations" to set an awk variable and use
TAG : bash
Date : November 22 2020, 04:01 AM , By : Markus Fried
Linux bash script: using ls with glob and getting output in variable not working
Linux bash script: using ls with glob and getting output in variable not working
This might help you On my CentOS 7 machine, I have a folder which contains 2 files, with names like: , You could use find :
TAG : bash
Date : November 21 2020, 04:01 AM , By : luca
Shell program, error in for loop. Variable not used
Shell program, error in for loop. Variable not used
wish of those help You try to make use of brace expansion. Depending on the shell you are using, brace expansion is supported or not. Shells that do not support brace expansion are POSIX sh and dash. Shells that do support braces expansion are bash,
TAG : bash
Date : November 20 2020, 04:01 AM , By : hong gu Jang
bash: bash script gives Bad substitution error
bash: bash script gives Bad substitution error
fixed the issue. Will look into that further Script: , The correct syntax is:
TAG : bash
Date : November 19 2020, 04:01 AM , By : user2184811
Piping grep matches into sed
Piping grep matches into sed
this one helps. I have a file that might look like this: , Use awk.
TAG : bash
Date : November 19 2020, 04:01 AM , By : kala nizam
How to execute script that opens interactive and continues inside container
How to execute script that opens interactive and continues inside container
it helps some times Hello i want to create a script that starts an interactive session with a docker container , and then reads a file from that container's filesystem (and maybe more). , Option 1You can add multiple actions in:
TAG : bash
Date : November 19 2020, 04:01 AM , By : pmars
Strange behavior about ”ls | while read" with ffmpeg in shell script
Strange behavior about ”ls | while read" with ffmpeg in shell script
may help you . You should not use ls to pipe a list of files, because this approach will not work well for corner cases like filenames with blanks.The most readable way is to use globbing:
TAG : bash
Date : November 19 2020, 04:01 AM , By : jwhitt
Docker shell script not parameterizing as expected
Docker shell script not parameterizing as expected
To fix this issue Use the json/exec syntax for your CMD and ENTRYPOINT lines. Otherwise docker will wrap the commands with a shell:
TAG : bash
Date : November 17 2020, 04:01 AM , By : Krystel
using bash how can i get the network device name and ip address in one line?
using bash how can i get the network device name and ip address in one line?
this one helps. If you need a one-liner, try this (thanks to Dougie for the more refined ip command) :
TAG : bash
Date : November 16 2020, 04:01 AM , By : demith
Renaming files with a specific scheme
Renaming files with a specific scheme
will be helpful for those in need Honestly I would just use Perl or Python for this. Here's how to embed either in a shell script.Here's a perl script that doesn't use any libraries, even ones that ship with Perl (so it'll work without extra packages
TAG : bash
Date : November 16 2020, 04:01 AM , By : iamlizard
Reading asterisk character (*) from a file in bash
Reading asterisk character (*) from a file in bash
wish helps you I am taking lines from a .txt file: Say Input.txt , Always quote variables:
TAG : bash
Date : November 16 2020, 04:01 AM , By : user2183439
How change source with a bash function
How change source with a bash function
Hope that helps When you put quotes around a string with spaces, you make that string into a single word in shell.The first word in a command is treated as the command to run. So, when you were putting the entire command in spaces, you're telling the
TAG : bash
Date : November 13 2020, 04:01 AM , By : user2182623
how do I create an array with dynamic name in bash
how do I create an array with dynamic name in bash
I hope this helps . A nameref can be pointed at multiple variables; thus making srvVar refer to any of your multiple arrays below:
TAG : bash
Date : November 12 2020, 04:01 AM , By : Evaldas Naujikas
How can i select particular items of array with Bash
How can i select particular items of array with Bash
will be helpful for those in need I have an array which i want to create a new array based on that, which contains just my particular selected items by index number. , You would need a loop:
TAG : bash
Date : November 10 2020, 04:01 AM , By : Aj Matthew
How to understand this line of Bash script?
How to understand this line of Bash script?
may help you . I've been trying to figure out a Bash script file that launches some Docker containers by poring over tons of documents and searching online (I'm very new to Bash). However, I simply cannot figure out what the following line does: , Th
TAG : bash
Date : November 09 2020, 04:01 AM , By : LJones
How do I capture strings between a string match and a new line while ignoring newline and space in between in bash?
How do I capture strings between a string match and a new line while ignoring newline and space in between in bash?
it helps some times EDIT: Since OP told uri string shouldn't be hard coded, so adding this solution now.
TAG : bash
Date : November 09 2020, 04:01 AM , By : Oliver Maxwell
How to backup files before overwriting them with rsync
How to backup files before overwriting them with rsync
will help you I think you should use --backup option of rsync. It's useful to use --backup-dir or --suffix too.
TAG : bash
Date : November 09 2020, 04:01 AM , By : goorner14
How can I output the number on the nth position in a string?
How can I output the number on the nth position in a string?
wish of those help Solution Using sed
TAG : bash
Date : November 09 2020, 04:01 AM , By : duck
Bash. Associative array iteration (ordered and without duplicates)
Bash. Associative array iteration (ordered and without duplicates)
wish helps you Iteration Order As Inian pointed out in the comments, you cannot fix the order in which "${!array[@]}" expands for associative arrays. However, you can store all keys inside a normal array that you can order manually.
TAG : bash
Date : November 08 2020, 04:01 AM , By : user 141154
ANSI escape code weird behavior at end of line
ANSI escape code weird behavior at end of line
I wish did fix the issue. Filling the line with the currently-selected colors is a detail of bce (back color erase) which could be implemented differently in different terminals—but Linux console and xterm happen to do it this way. It's an FAQ: My te
TAG : bash
Date : November 07 2020, 04:01 AM , By : user2180537
configure confixtx.yaml file?
configure confixtx.yaml file?
With these it helps In YAML all anchors ( those tokens starting with ) need to precede any references to them (using aliases, the tokens starting with *) in the file.So in the root-level mapping you should put your key Profiles and its value after th
TAG : bash
Date : November 07 2020, 04:01 AM , By : Stephan
'Bad Substitution' sourcing an auto-completion script as non-root user
'Bad Substitution' sourcing an auto-completion script as non-root user
wish of those help Turns out from trace output that /bin/sh was used instead of /bin/bash to launch the script because /bin/bash was not set as default shell.I have changed the default shell to /bin/bash and it is all ok now :)
TAG : bash
Date : November 07 2020, 04:01 AM , By : facollura
Echo bash variable in separate bash process
Echo bash variable in separate bash process
I wish did fix the issue. I'm trying to create a separate bash process and echo a variable which is set inside of it with no success. Nothing gets echoed. , You have to quote it right.
TAG : bash
Date : November 06 2020, 04:01 AM , By : Aldous Noxgall
How to access a Docker container instance using the image name?
How to access a Docker container instance using the image name?
I wish this help you You have to name your container and specify container name in the docker exec command, not image name.So you have to add --name=CONTAINER_NAME into your docker run command and when you want to manage it just use docker exec -it C
TAG : bash
Date : November 05 2020, 04:01 AM , By : SATYAM ROY
How to add a command line argument to my script?
How to add a command line argument to my script?
This might help you write your code in file.sh, make file.sh executable call you script with a argument: . path/file.sh directory you can use "$1" get the argument; the you can use script get the files starting with a digit in the directory.
TAG : bash
Date : November 04 2020, 04:01 AM , By : Wenceslaus
How can I delete a file that doesn't have a matching file with a different extension
How can I delete a file that doesn't have a matching file with a different extension
To fix this issue It's a bit hard to expliain, but I'm looking for a relatively easy bash script that can delete a file if it doesn't find a file of the same name that is an mp4.
TAG : bash
Date : November 04 2020, 04:01 AM , By : user2179281
Iterating over arrays, each with a pair of values, to operate on each pair in turn
Iterating over arrays, each with a pair of values, to operate on each pair in turn
wish of those help You can use ${!prefix@} to iterate over variable names starting with prefix, and namerefs to refer to content stored under each name:
TAG : bash
Date : November 03 2020, 04:01 AM , By : Boomer
Can't push to github a specific commit that added PNG Images
Can't push to github a specific commit that added PNG Images
Hope this helps Depending on the version of Git, it could be related to how Git is pushing.Since it has changed in recent version (with the introduction of Git wire protocol v2), it pays to try and upgrade to the latest version.
TAG : bash
Date : November 02 2020, 04:01 AM , By : Don
bash: Problems with glob negation and multiple patterns
bash: Problems with glob negation and multiple patterns
Any of those help Use | to separate the patterns in the pattern list (docs):
TAG : bash
Date : November 01 2020, 04:01 AM , By : StringTheoryNYC
Concatenate string in .csv after x commas using shell/bash
Concatenate string in .csv after x commas using shell/bash
will help you If you want to merge the first and the second line of each CSV, try this.
TAG : bash
Date : November 01 2020, 04:01 AM , By : Jean Ricardo
Use the answer of a prompt to swap placeholders in another file
Use the answer of a prompt to swap placeholders in another file
I think the issue was by ths following , Could you please try changing sed -i 's/placeholder/$answer/g' file.txt to:
TAG : bash
Date : October 31 2020, 05:01 AM , By : Kiss_Pythonic
modify something in several specific files for exemple txt (bash)
modify something in several specific files for exemple txt (bash)
seems to work fine I want to write something in several file, I tried with a find : , Just use the glob pattern with the .txt suffix in for:
TAG : bash
Date : October 31 2020, 05:01 AM , By : user2178092
Bash - Read in a file and replace multiple spaces with just one comma
Bash - Read in a file and replace multiple spaces with just one comma
should help you out I'm trying to write a bash script that will take in a file with spaces and output the same file, but comma delimited. I figured out how to replaces spaces with commas, but I've run into a problem: there are some rows that have a v
TAG : bash
Date : October 31 2020, 05:01 AM , By : user2178086
Sed to delete eveything between two non alpha numeric chars
Sed to delete eveything between two non alpha numeric chars
this one helps. I have the following string: , You may use this gnu sed:
TAG : bash
Date : October 28 2020, 07:41 AM , By : Michael Green
How do I escape text in autoconf/m4?
How do I escape text in autoconf/m4?
Hope that helps Found it! From this tutorial:
TAG : bash
Date : October 27 2020, 03:37 PM , By : Evgeniya Taran
Add spaces to the end of some Bash autocomplete options, but not to others?
Add spaces to the end of some Bash autocomplete options, but not to others?
Hope this helps The feature in in scp's bash completion mentioned by C4H5As that retains the added space is not the ampersand, that is just sed syntax for "replace with match".You have to change the IFS so compgen does not split the input on spaces b
TAG : bash
Date : October 22 2020, 11:12 PM , By : user3849478
Concatenate strings in bash
Concatenate strings in bash
seems to work fine I have in a bash script: , You should try
TAG : bash
Date : October 16 2020, 11:12 AM , By : rosawa
Shell script that asks user to continue with a y/n
Shell script that asks user to continue with a y/n
this one helps. I have a shell script that I want to ask the user if they want to continue. If they type 'n' and press enter the script will exit. , Use an infinity loop and case/esac like this:
TAG : bash
Date : October 15 2020, 01:20 AM , By : Sen
Bash+cron: Redirecting, and restoring, stdout and stderr produces permission denied
Bash+cron: Redirecting, and restoring, stdout and stderr produces permission denied
this will help I've got a script that calls out to a bunch of commands, some of which are noisy to stdout, some to stderr, some to both. I intend the script to be run by cron, so I don't want it to be noisy and mail me every day -- only in error cond
TAG : bash
Date : October 14 2020, 01:07 PM , By : user3853242
Escaping 'echo' in batch files
Escaping 'echo' in batch files
To fix the issue you can do I'm trying to create a bash command file on the fly from within an Windows 7 DOS shell: , I just tried@echo echo %TMP%
TAG : bash
Date : October 14 2020, 01:07 PM , By : user3853408
shadow
Privacy Policy - Terms - Contact Us © bighow.org