machetes

Databases / mysql

Mysql DB create and Grant User
--------------
Four commands to create a mysql Database, create user and grant privileges on the created DB

**Replace dbname, username and host with your own values:**

1. login to mysql (entering root password)

mysql -u root -p

2. Create DB

Filename manipulation scripts

Bash script to convert filenames to lowercase and spaces in hypens

#!/bin/bash

for x in ./*; do
  if [ -f "$x" ]; then
    lc=${x,,}            # convert all letters to lowercase
    y=${lc// /-}         # replace spaces by hyphens
    if [ "$x" != "$y" ]; then
      mv "$x" "$y"
    fi
  fi
done

Bash script to capitalise filenames recursively

Subscribe to RSS - machetes