0

Sup guys. How I can make terminal to show the text that I want ? And how to edit the text that is already displayed For example terminal is showing now:

user@host: sudo writetext 
bash: writetext: command not found

How to edit this text to be displayed like this

user@host: sudo writetext  5
 writelext line 1 executed
 writelext line 2 executed
 writelext line 3 executed
 writelext line 4 executed
 writelext line 5 executed

I don't need the program to work, i just need to know how to display random text in terminal

fuxase
  • 1
  • 1

4 Answers4

1

You can add an alias to the bashrc

  1. vim ~/.bashrc
  2. Go to the end of the file
  3. add line: alias writeText='echo "write text executed"'
  4. Then reload the bashrc with: source ~/.bashrc

After this you should be able to call the alias by typing in writeText

Here you can also add a more advanced echo function.

If you want to pass parameters you have to write a separate function as described here: Passing argument to alias in bash

Fabwoofer
  • 111
  • 4
1

Write a shell script and add echo commands inside to display whatever u want to display

Nithees balaji
  • 148
  • 1
  • 11
1

There are many ways to print text to stdout, you should read some man pages:

man echo
man print
man printf

more powerful tools:

sed, awk ...

Examples:

seq

kent$  seq -f "whatever %g" 5
whatever 1
whatever 2
whatever 3
whatever 4
whatever 5

awk

kent$  awk -v v=5 'BEGIN{for(i=1;i<=v;i++)print "whatever "i}' 
whatever 1
whatever 2
whatever 3
whatever 4
whatever 5
Kent
  • 189,393
  • 32
  • 233
  • 301
0

If you're trying "make the terminal display text that I will type."

You could try read, assign a variable to the read and then echo it

read text
echo "${text}"