The following script yielded an unexpected output: printf "escaped slash: \\ \n" printf "2 escaped slashes: \\\\ \n" printf "3 escaped slashes: \\\\\\ \n" prin
I am trying to add a variable to the middle of a variable, so for instance in PHP I would do this: $mystring = $arg1 . '12' . $arg2 . 'endoffi
I would like a quick keyboard command sequence to copy the current command at a bash prompt to the clipboard. So that, for example, to copy the last bash comm
We all know arrays in Bash are indexed from zero, and in zsh are indexed from one. How can the script know it should use 0 or 1 if I can't ensure the running en
We all know arrays in Bash are indexed from zero, and in zsh are indexed from one. How can the script know it should use 0 or 1 if I can't ensure the running en
How can I convert a Windows dir path (say c:/libs/Qt-static) to the correct POSIX dir path (/c/libs/Qt-static) by means of standard msys features? And vice vers
I want to remove some n lines from the end of a file. Can this be done using sed? For example, to remove lines from 2 to 4, I can use $ sed '2,4d' file But
I am trying to output a string that contains everything between two words of a string: input: "Here is a String" output: "is a" Using: sed -n '/Here/,/
Related, but not a duplicate of: How to define hash tables in Bash? I can define and use a bash hash, but I am unable to export it, even with the -x flag. For
I have some aliases for ssh, example: alias buildWork="ssh work '~/build_app'" The problem is that the ssh command passes some variables like $LC_CTYPE that ca
im running a docker container as shown below, after the sh files are executed the container terminate by default, how i can keep the container working in backgr
Here are a series of cases where echo $var can show a different value than what was just assigned. This happens regardless of whether the assigned value was "do
I have this variable: A="Some variable has value abc.123" I need to extract this value i.e abc.123. Is this possible in bash?
I'm trying to make a key mapping in vim that (a) saves current file (b) performs a git action, using shell (c) quits current vim editor. I've tried the followi
using ulimit command, i set core file size. ulimit -c unlimited and I compiled c source code using gcc - g option. then a.out generated. after command ./a.o
Let's say I have two variables: a="AAA" b="BBB" I read a string from a file. This string is the following: str='$a $b' How to create a new string from the
I can't seem to use a variable in a sed command, for example: sed "24s/.*/"$ct_tname"/" file1.sas > file2.sas I want $ct_tname the varia
I want add shell or bash to my image to execute installation command. I have copied the /bin/bash on my VM on to my image on Dockerfile: COPY /bin/bash /bin/
How can I output a multipline string in Bash without using multiple echo calls like so: echo "usage: up [--level <n>| -n <levels>][--help][--versio
I wonder if there is an alternative to the psql command to test the connection to a postgresql database using bash. I'm setting up a Core OS cluster and have a