I'm writing a little wrapper script for a JPEG-to-ASCII program, and it defaults to 80 characters wide, so I'm trying to get it to read $COLUMNS to be as wide as the terminal.
Unfortunately, $COLUMNS exists only in the terminal, scripts don't have it set, and I can't think of any way to get it from within the script.
Several minutes of Google searches turned up only this, which isn't helpful.
Here's the line in question:
...but, as I've said, $COLUMNS evaluates to nothing, so it ends up with "width=" and is ignored by the program.
EDIT: Solution found. "tput cols" returns the number of columns.
Unfortunately, $COLUMNS exists only in the terminal, scripts don't have it set, and I can't think of any way to get it from within the script.
Several minutes of Google searches turned up only this, which isn't helpful.
Here's the line in question:
Code:
java -jar ./jave5/jave5.jar image2ascii $@ "width=$COLUMNS"
EDIT: Solution found. "tput cols" returns the number of columns.
Comment