Tagged Questions
0
votes
3answers
89 views
How to create an interactive bash script to collect arguments for a command in linux?
I'm trying to create an interactive bash script where I can collect user input variables to be used as arguments in another command. Can someone provide me an example of this?
Currently i want to do:
...
1
vote
1answer
203 views
Convert mysql count(*) to int in bash?
I'd like to execute this and check if count is 0, 1 or > 1 in bash.
mysql -e "select count(*) from mydb.mydb;"
The output is:
+----------+
| count(*) |
+----------+
| 0 |
+----------+
I ...
2
votes
3answers
2k views
How can I check if mysql is installed using a bash script?
I need to check if mysql is installed from within a bash script. What would be an efficient way of doing that? I thought I could do this:
if [ ! -f `which mysql` ] ; then
echo "foo"
fi
But I ...
3
votes
2answers
487 views
Get a progress indicator when importing mysql databases
I often import MySQL databases, and this can take a while. There is no progress indicator whatsoever. Can one be shown, somehow? Either records imported, MB imported, or tables imported... anything is ...
1
vote
2answers
309 views
Script that uses MySQL query to automatically remove output
I have this query that outputs updates older than 7 days from a database. How would I make a script that takes the MySQL statement and puts it into a script to be executed by cron.
echo "select name, ...
2
votes
2answers
122 views
List files that occur lexically after/greater than a given prefix (or, run database upgrade scripts in a proper order)
I'm trying to create a shell script that runs through a bunch of SQL scripts.
I've these files:
$ ls upgrade/
01-foo.sql 02-bar.sql 02-baz.sql 03-foo1.sql 04-buz.sql
And I've got the version of ...