curs_inwstr - Linux


Overview

curs_inwstr is a terminal utility for interacting with stdin and stdout. It allows setting the cursor position, writing text at specific locations on the screen, and performing input and output operations with enhanced cursor control.

Syntax

curs_inwstr [-h] [-d DELAY] [-c COLORS] [-p] [-o] [-m MODE] [-s] [-n]

Options/Flags

  • -dDELAY: Specify the delay in microseconds between cursor movements.
  • -cCOLORS: Enable color output. Supported colors: red, green, blue, yellow, cyan, magenta, black, white.
  • -pNO_PADDING: Disable padding of output.
  • -oOVERRIDE_NEWLINE: Suppress the default newline character at the end of output.
  • -mMODE: Set cursor movement mode. Options: absolute (default), relative.
  • -sSILENT: Disable error messages.
  • -nNO_CURSOR: Disable cursor rendering.

Examples

Setting Cursor Position and Writing Text:

echo "Hello, World!" | curs_inwstr -c -d 100000

Moving Cursor Relative to Current Position:

curs_inwstr -m relative -o
UP 2
RIGHT 5
echo "Cursor moved up 2 and right 5"

Advanced Scripting:

# Example script to create a progress bar
while true; do
  curs_inwstr -d 10000 -o
  LEFT 10
  echo "Loading..." | tr -d '\n' | cut -c1-10
  HOME
  sleep 1
done

Common Issues

  • Errors may occur if the terminal does not support cursor control.
  • Color output may not work on all terminals.
  • Relative cursor movements may not function correctly in some shells.

Integration

curs_inwstr can be integrated with other commands using pipes or scripts. For example:

printf "Text" | curs_inwstr -d 100000 -c | cat -

pipes the output from printf through curs_inwstr and displays it slowly using cat.

Related Commands

  • tput: Terminal output formatting
  • printf: Formatted output
  • cat: Concatenate files and print on stdout