The default shell (/bin/sh
) under Ubuntu points to dash
, not bash
.
me@pc:~$ readlink -f $(which sh) /bin/dash
So if you chmod +x your_script_file.sh
and then run it with ./your_script_file.sh
, or if you run it with bash your_script_file.sh
, it should work fine.
Running it with sh your_script_file.sh
will not work because the hashbang line will be ignored and the script will be interpreted by dash
, which does not support that string substitution syntax.
Related Posts:
- Extract substring in Bash
- “[ ]” vs. “[[ ]]” in Bash shell
- How to trim whitespace from a Bash variable?
- How to trim whitespace from a Bash variable?
- Extract filename and extension in Bash
- What is lexicographical order?
- Regex not operator
- working of \n in python [duplicate]
- Regex not operator
- Extract a substring using PowerShell
- Regex not operator
- How to compare strings in Bash
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- What is the difference between \r\n, \r, and \n? [duplicate]
- string to string array conversion in java
- What is the difference between \r\n, \r, and \n? [duplicate]
- Multi-line string with extra space (preserved indentation)
- Regex how to match an optional character
- How to remove punctuation in python?
- Multi-line string with extra space (preserved indentation)
- How do I properly compare strings in C?
- How to remove .html from URL?
- What is the difference between a “line feed” and a “carriage return”?
- How to convert an int to string in C?
- Python: TypeError: cannot concatenate ‘str’ and ‘int’ objects
- “sed” command in bash
- Ignoring upper case and lower case in Java
- How to replace all double quotes to single quotes using jquery?
- Convert character to ASCII numeric value in java
- What does strcmp() exactly return in C?
- Generate random string/characters in JavaScript
- How to get the filename without the extension from a path in Python?
- sprintf like functionality in Python
- C – The %x format specifier
- Lua string.format options
- n-grams in python, four, five, six grams?
- Alphabet range in Python
- Delete all local git branches
- How can I match a string with a regex in Bash?
- What is the difference between ‘ and ” in JavaScript?
- Center text in fixed-width field with stream manipulators in C++
- C# – Illegal characters in path
- \n or \n in php echo not print [duplicate]
- Mips how to store user input string
- PadLeft function in T-SQL
- How to convert a string to lower case in Bash?
- How to assign multiple lines string in Powershell Console
- LC-3 STR with R1 as offset
- Lua read beginning of a string
- How do I remove the file suffix and path portion from a path string in Bash?
- How do I print my Java object without getting “SomeType@2f92e0f4”?
- How can I process each letter of text using Javascript?
- PHP to write Tab Characters inside a file?
- Haskell: Converting Int to String
- How to split one string into multiple strings separated by at least one space in bash shell?
- Passing string to a function in C – with or without pointers?
- Lua String replace
- Trim a string in C [duplicate]
- How to remove first character from C-string?
- Standard function to replace character or substring in a char array?
- Difference between char* and char** (in C)
- Meaning of #{ } in Ruby?
- Taking a new line using printf in java? Is %n correct?
- How to count instances of character in SQL Column
- What are the functional differences between .profile .bash_profile and .bashrc
- How can I edit the welcome message when ssh start?
- How do I lowercase a string in Python?
- Why the switch statement cannot be applied on strings?
- How does strtok() split the string into tokens in C?
- How to read a file line-by-line into a list?
- How to convert string to char array in C++?
- How can I convert a std::string to int?
- Check if a string has a certain piece of text [duplicate]
- How to concatenate string variables in Bash
- How to print like printf in Python3?
- Convert int to string?
- Difference between wait and sleep
- Check string “None” or “not” in Python 2.7
- What’s the best way to convert a number to a string in JavaScript?
- How to split a string in Java
- How to copy a string of std::string type in C++?
- Pass variable from one Jenkins stage to others in sh
- How do I lowercase a string in C?
- How to clear all the elements of array in C?
- standard_init_linux.go:178: exec user process caused “exec format error”
- How to find char in string and get all the indexes?
- Getting The ASCII Value of a character in a C# string
- choosing between $0 and BASH_SOURCE
- Create a new file in git bash
- Difference between String replace() and replaceAll()
- How does str(list) work?
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- When I run `npm install`, it returns with `ERR! code EINTEGRITY` (npm 5.3.0)
- RVM is not a function, selecting rubies with ‘rvm use …’ will not work
- How to verify if nginx is running or not?
- variable or field declared void
- Why can’t I print to terminal with my python script?
- Error handling in Bash
- how to search for a directory from the terminal in ubuntu
- Why are there two different getline() functions (if indeed there are)?