LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

TheOuterLinux Mμse - An interesting way to make a text-based game using catimg and play

Posted 06-22-2020 at 05:30 PM by TheOuterLinux

Cross-posted from: https://theouterlinux.gitlab.io/Publ...CatimgGame.txt
RSS for website version: https://theouterlinux.gitlab.io/Publ...ticleFeed.atom

The following is a BASH script that with the help of 'catimg' and the 'play' command, you can create a classic text-adventure game but have an image shown just above the text. See notes inside of the script.

Code:
#Discussion URL: https://www.reddit.com/r/TheOuterLinux/comments/esgvmf/catimg_and_play_to_for_textbased_games/.compact
...
LQ Newbie
Posted in Uncategorized
Views 170 Comments 0 TheOuterLinux is offline
Old

BASH replace a line in file

Posted 04-05-2020 at 05:20 PM by karanis
Tags bash

sed "s|a dumb string|$lan|g" file.txt

sed "s|#dns_server\t\t10.0.0.1:53|#dns_server 192.168.1.1:53|g" /tmp/baresip_config
LQ Newbie
Posted in Uncategorized
Views 143 Comments 0 karanis is offline
Old

BASH extract fields from string

Posted 04-05-2020 at 05:19 PM by karanis
Tags awk, bash

https://en.wikibooks.org/wiki/Cut

link above have nice examples

Examples of use of similar tools in cut's domain:

echo a b|awk '{print $2}'
Displays "b", separating fields by any number of tabs or spaces. Thus, for awk, "b" is the 2nd field, while for cut -d" ", "b" is the 3rd field.
echo a b|awk '{print $2 $1}'
Displays "ba", preserving the order of the fields as specified....
LQ Newbie
Posted in Uncategorized
Views 159 Comments 0 karanis is offline
Old

BASH read file

Posted 04-05-2020 at 05:17 PM by karanis
Tags bash

https://www.cyberciti.biz/faq/unix-h...ine-from-file/

https://www.computerhope.com/unix/bash/read.htm

https://www.shellhacks.com/bash-read...ead-line-loop/

----------

while read USER; do echo "Hello $USER!"; done < users.txt

----------

#!/bin/ksh
file="/home/vivek/data.txt"
while IFS= read line
do
# display $line...
LQ Newbie
Posted in Uncategorized
Views 194 Comments 0 karanis is offline
Old

BASH datetime for scripts

Posted 04-05-2020 at 05:16 PM by karanis
Tags bash, time

#!/bin/bash
dt=`date '+%d/%m/%Y %H:%M:%S'`
echo "$dt"
LQ Newbie
Posted in Uncategorized
Views 159 Comments 0 karanis is offline

  



All times are GMT -5. The time now is 11:36 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration