Jump to content

Problem with formatting strings in Bash script

Recommended Posts

Not sure if I should file this under "bug report", so let me try here first, maybe I'm misunderstanding something...


I created a very simple workflow with one "Script Filter" as an input:



(pasting script as a text for easier reproducing if needed)



cat << EOB
{"items": [{"title": "Result: $(printf "%'.2f" $(( query * val )))"}]}



However, the workflow results don't appear formatted as I would expect it, specifically, it's missing the thousands separator.


This is how result looks like in Alfred popup:



This is how it looks in the debug window:



And this is how the same script looks like if I run it in my Terminal (with "query" value hardcoded instead of using an argument):



My question here is: why Alfred doesn't respect the formatting rules and in this case displays my result as "7006652.00" instead of "7,006,652.00"?


I'm using Alfred 4.6.4 (Build 1294) on macOS Monterey 12.3 (21E230).


Thanks for any info in advance!

Edited by errata
Added software versions
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...