BASH throw entries in array

  • (2 Pages)
  • +
  • 1
  • 2

27 Replies - 1769 Views - Last Post: 23 August 2019 - 02:19 PM Rate Topic: -----

#16 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 286
  • Joined: 13-March 18

Re: BASH throw entries in array

Posted 22 August 2019 - 05:19 PM

yes right click. but im putting in this script in bash

	echo -e "[\e[32m▣\e[37m]Installed	PHP		$msg"


Was This Post Helpful? 0
  • +
  • -

#17 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2745
  • View blog
  • Posts: 4,405
  • Joined: 21-June 11

Re: BASH throw entries in array

Posted 22 August 2019 - 05:23 PM

But that's not the circle from my post. That's a square inside another square.
Was This Post Helpful? 0
  • +
  • -

#18 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 286
  • Joined: 13-March 18

Re: BASH throw entries in array

Posted 22 August 2019 - 05:26 PM

yea i know i put in your symbol but its the same thing. i was changing the symbol to see if it was just that one. the picture you see should have shown your circle.
Was This Post Helpful? 0
  • +
  • -

#19 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2745
  • View blog
  • Posts: 4,405
  • Joined: 21-June 11

Re: BASH throw entries in array

Posted 22 August 2019 - 05:34 PM

Okay, so I'm still not clear regarding my question. Does the circle turn into the empty square when you paste it into Putty? Or does the pasting work fine, but you still get the empty square when you run your script? Does the circle display properly when you cat the script?
Was This Post Helpful? 0
  • +
  • -

#20 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 286
  • Joined: 13-March 18

Re: BASH throw entries in array

Posted 22 August 2019 - 05:37 PM

i got the outline of a circle. its not a solid color...which is what i was looking for, sorry for the confusion.
Was This Post Helpful? 0
  • +
  • -

#21 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2745
  • View blog
  • Posts: 4,405
  • Joined: 21-June 11

Re: BASH throw entries in array

Posted 22 August 2019 - 05:44 PM

When do you get the outline? Right after you paste it? Or only when you run the script? And does it look fine when you cat the script?
Was This Post Helpful? 0
  • +
  • -

#22 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 286
  • Joined: 13-March 18

Re: BASH throw entries in array

Posted 23 August 2019 - 04:02 AM

no it doesnt look fine. it looks exactly as you put it. but its not what i was looking for.

doesnt look right in the script or in putty.

This post has been edited by Bobby_Bubbles: 23 August 2019 - 04:15 AM

Was This Post Helpful? 0
  • +
  • -

#23 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2745
  • View blog
  • Posts: 4,405
  • Joined: 21-June 11

Re: BASH throw entries in array

Posted 23 August 2019 - 06:17 AM

Wait, it looks exactly as I put it, but it doesn't look fine? So you're saying that my circle looks like only an outline to you even if you view it in the browser? Not like it does in the attached image?

In that case, that might either be a font issue in both your browser and Putty or you've manually set the encoding in your browser to something other than UTF-8. What happens about the circle from the systemctl output? If the issue is a font issue, that circle is probably a different character, so what happens when you copy and paste that one into your script?

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#24 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 286
  • Joined: 13-March 18

Re: BASH throw entries in array

Posted 23 August 2019 - 07:51 AM

Here, this is what i see.

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#25 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2745
  • View blog
  • Posts: 4,405
  • Joined: 21-June 11

Re: BASH throw entries in array

Posted 23 August 2019 - 07:57 AM

That looks like your Browser is using a font that doesn't contain the circle character. If it still looks the same way after copying it into Putty, Putty is probably using the same font (or at least a font that also doesn't contain the character). If that's the case, but Putty still displays the systemctl output correctly, that would mean that the circle in systemctl's output is a different character. In that case copy-and-pasting that character instead of the one from my post should work.
Was This Post Helpful? 0
  • +
  • -

#26 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6816
  • View blog
  • Posts: 31,414
  • Joined: 10-May 07

Re: BASH throw entries in array

Posted 23 August 2019 - 08:38 AM

If you are using an escape code to create the color, why stop there? Use the escape code for the character instead of relying on the terminal to do it for you. They are standards for a reason, after all ;)

Ascii Code & Reference sheet
Was This Post Helpful? 0
  • +
  • -

#27 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 286
  • Joined: 13-March 18

Re: BASH throw entries in array

Posted 23 August 2019 - 11:44 AM

i found out what went wrong.

Another question.

cd /home/
	cmd=$(ls -d */ | cut -d '/' -f 1 2>&1)
	echo "User	WWW	MySQL"
	for i in $cmd; do
		#echo "Value for" $i
		if [ -z "$i" ]; then
			www="\e[31mNo\e[37m"
		else
			www="\e[32mYES\e[37m"
		fi
		query=$(mysql -s -N -uroot -ppass mysql -e "SELECT count(*) FROM user WHERE user='$i';" | 2>&1)
		if [ "$query" != 0 ]; then
			sql="\e[32mYES\e[37m"
		else
			sql="\e[31mNo\e[37m"
		fi
		echo -e "$i	$www	$sql"
	done



im trying to get a list of directories in my /home folder for my web server. the thing is, i created a test folder and so the query is suppose to check for a "test" user. but there is none. So it SHOULD show up as No but shows up as Yes instead.

This post has been edited by Bobby_Bubbles: 23 August 2019 - 01:32 PM

Was This Post Helpful? 0
  • +
  • -

#28 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 286
  • Joined: 13-March 18

Re: BASH throw entries in array

Posted 23 August 2019 - 02:19 PM

issue resolved.

query=$(mysql -s -N -uroot -ppass mysql -e "SELECT count(*) FROM user WHERE user='$i';")
		if [[ $query > '0' ]] ; then
			sql="\e[32mYES\e[37m"
		else
			sql="\e[31mNo\e[37m"
		fi


since im coding all day, i encountered another one not sure to look for in key terms. when you do a case and you make your selection how do you loop back to the main case?

This post has been edited by Bobby_Bubbles: 24 August 2019 - 06:35 AM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2