Reputation: 115
What I try:
player=tester111
id=$(mysql -h "127.0.0.1" -u "myuser" -ppassword "database" -e \
"SELECT id FROM login WHERE name='$player';")
echo $id
The following output appears:
id 223
How to get ONLY 223
as output?
I am new to stackoverflow, feel free to comment so I can improve my asking skills.
Upvotes: 1
Views: 33
Reputation: 77876
Use the -N
switch when executing your query. -N
is for skipping column name and thus you will get only values returned (that is 223
returned) like
id=$(mysql -N -h "127.0.0.1" -u "myuser" -ppassword "database" -e \
"SELECT id FROM login WHERE name='$player';")
Upvotes: 3