You can also resort to awk to format:
echo "0.1 + 0.1" | bc | awk '{printf "%f", $0}'
or with awk itself doing the math:
echo "0.1 0.1" | awk '{printf "%f", $1 + $2}'
More Related Contents:
- Some troubles with using sed and awk [closed]
- What does 2>&1 mean here?
- Can I export a variable to the environment from a Bash script without sourcing it?
- Bash command line and input limit
- Delete all but the most recent X files in bash
- How do I check if a directory exists in a Bash shell script?
- Checking from shell script if a directory contains files
- How to determine the current interactive shell that I’m in (command-line)
- How to use ‘find’ to search for files created on a specific date? [closed]
- Removing colors from output
- How to represent multiple conditions in a shell if statement?
- How to provide password to a command that prompts for one in bash?
- How to search filenames by regex with “find”
- How does this bash fork bomb work? [duplicate]
- Piping tail output though grep twice
- What is a unix command for deleting the first N characters of a line?
- How to go to each directory and execute a command?
- Reading filenames into an array
- Hiding secret from command line parameter on Unix
- What’s a concise way to check that environment variables are set in a Unix shell script?
- executing shell command in background from script [duplicate]
- Waiting for background processes to finish before exiting script
- Variables as commands in Bash scripts
- How to split a file into equal parts, without breaking individual lines? [duplicate]
- Copy all files with a certain extension from all subdirectories
- How can I convert tabs to spaces in every file of a directory?
- File content into unix variable with newlines
- escaping newlines in sed replacement string
- How to wait on all child (and grandchild etc) process spawned by a script
- Subtract two variables in Bash