Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: de_la_espada
Posted By de_la_espada
Aligning Characters in Bash/Beautiful Screens

Supposing I want to output the following code to the screen in a bash script, this works fine until you use variables as below, because the variable could be of any length, meaning the...
Posted By de_la_espada
Thanks for taking the trouble to reply. If...
Thanks for taking the trouble to reply.
If anyone can think of any easy way to do what I want to do then let me know.
Curently traawling through the mountain of find and replace postings on the...
Posted By de_la_espada
Thanks to all for posting. Have ended up...
Thanks to all for posting.

Have ended up using this code, corona688's for time being.

if [[ "$STR" =~ ^[0-9][0-9][0-9]$ ]]
echo "Three digits"

if [[ ! $inputPin =~...
Posted By de_la_espada
Expanding variables with Ed Bash 3.2.33

The following code finds the line containing fruits in test.txt and replaces instances of apple with banana.

ed -s test.txt <<< $'/fruits/s/apple/banana/g\nw'

What I want to do...
Posted By de_la_espada
Testing Var for 3 digits in a row only

I want to test a var, $inputPin to see if is 3 digits in a row or not in a Bash script.
I am getting stuck on the regex to do this.
And the equality test if it is in an if statement as...
Posted By de_la_espada
Hi, Thanks for your prompt reply. You are...

Thanks for your prompt reply.
You are right. should be charArray[$i]

cut -c$i seems obvious now. But I couldn't see it for the life of me at the time.

thanks again.

Posted By de_la_espada
Use loop var i within Cut Command

In the following bash code rather than cutting at a predefined character I would like to cut at position i (i var from loop).
Is this possible? I have tried eval, but either it's not possible...
Showing results 1 to 7 of 7


Featured Tech Videos

All times are GMT -4. The time now is 11:58 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy