cirandas.net

ref: master

script/change-theme


#!/bin/bash

t_ini="$1"

cd "$( dirname $0 )/../public/designs/themes/"

test -L default && rm default

echo 'Select Theme:'
n=0
ls -1 | while read theme; do
  let n++
  echo "  [$n] $theme"
done

ok=false
while ! [ -L default ]; do
  
  if [ "$t_ini" = "" ]; then
    read t
  else
    t="$t_ini"
    t_ini=""
  fi
  n=0
  ls -1 | while read theme; do
    let n++
    if [ "$t" = "$n" ]; then
      echo "Theme selected: $theme"
      ln -s "$theme" default
    fi
  done
  
  if ! [ -L default ]; then
    echo "Invalid number $t"
  fi
  
done