Saya mempunyai masalah saat menjalankan skrip yang cukup besar. Di tengah output mengatakan:
linuxMint_post-install.sh: line 131: syntax error near unexpected token `)'
linuxMint_post-install.sh: line 131: ` "1") echo -e "\e[0;32m you have hdd, skipping to the next step... \e[0m" ;;'
Saya tidak ingin Anda membuat ini menjadi panjang (skrip berjumlah 260 baris) jadi saya hanya akan memposting bagian terkait:
echo -e "\e[0;32m First we will check if you have ssd or hdd drive \e[0m"
ssd_check="$( cat /sys/block/sda/queue/rotational )"
case "$ssd_check" in
"0") echo -e "\e[0;32m you have ssd drive, so we will optimaze that \e[0m" ;
# noatime
#TODO add noatime automaticly with sed, use code bellow for check (look at I/O scheduler as example)
echo -e "\e[0;32m fstab file will open in xed text editor. Add \"noatime,\" right before \"errors=remount-ro 0 1\" \e[0m" ;
echo -e "\e[0;32m This line has to look like this: \e[0m" ;
echo -e "\e[0;32m UUID=xxxxxxx / ext4 noatime,errors=remount-ro 0 1 \e[0m" ;
echo -e "\e[0;32m When you finish, save file, close text editor and continue \e[0m" ;
gksudo xed /etc/fstab ;
read -n1 -r -p "Press any key to continue..." key ;
# trimming
echo -e "\e[0;32m Now we will change trimming from weekly to daily schedule in cron \e[0m" ;
sudo mv -v /etc/cron.weekly/fstrim /etc/cron.daily ; # if you want to undo this operation simply: sudo mv -v /etc/cron.daily/fstrim /etc/cron.weekly
# swap limit
echo -e "\e[0;32m Now we will chaeck if the swap limit is set to correct value for not overusing SSD \e[0m"
swap_check="$( head -1 /proc/sys/vm/swappiness )"
if [ "$swap_check" -gt 1 ]; then
#MANUAL VERSION v
echo -e "\e[0;32m Swap limit is set to "$swap_check" which is to high. We have to reduce it to 1 \e[0m"
echo -e "\e[0;32m To do so, we will open /proc/sys/vm/swappiness file and please write those two lines at the end of this file: \e[0m"
echo -e "\e[0;32m # Sharply reduce the inclination to swap \e[0m"
echo -e "\e[0;32m vm.swappiness=1 \e[0m"
gksudo xed /proc/sys/vm/swappiness
echo -e "\e[0;32m When you finish, save file, close text editor and continue \e[0m"
read -n1 -r -p "Press any key to continue..." key ;
#AUTOMATIC version - not working! v
#sudo echo "# Sharply reduce the inclination to swap" >> /proc/sys/vm/swappiness #add this lines to reduce swap
#sudo echo "vm.swappiness=1" >> /proc/sys/vm/swappiness
#TODO ^ sudo echo doesn't work, I have tried with command: echo "some text here" | sudo tee -a /proc/.../swappiness with no success to
else
:
fi
# disable hibernation https://sites.google.com/site/easylinuxtipsproject/bugs#TOC-Hibernate-and-suspend-don-t-always-work-well:-they-make-some-computers-malfunction-or-even-enter-a-coma
echo -e "\e[0;32m this step will disable hibernation which will reduce hdd usage, you will be still able to use \"suspend\", \e[0m"
echo -e "\e[0;32m it takes more energy in compare to \"hibernate \", but saves your ssd. You can olways undo this operation later or skip this step \e[0m"
echo -e "\e[0;32m would you like to procede? [y/n] \e[0m"
while read y_n; do
case "$y_n" in
[Yy]* ) sudo mv -v /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla / # com.ubuntu.enable-hibernate.pkla will be moved to / to undo simply move it back again to /etc/polkit-1/localauthority/50-local.d/
echo -e "\e[0;32m hibernation disabled \e[0m" ;;
[Nn]* ) echo -e "\e[0;32m hibernation remains enabled \e[0m";;
*) echo -e "\e[0;31m Wrong input! Type y or n \e[0m" ;
esac
done
# I/O scheduler setting to deadline http://www.techrepublic.com/article/how-to-change-the-linux-io-scheduler-to-fit-your-needs/
echo -e "\e[0;32m First we will check if I/O is already set to \"deadline\" \e[0m"
IO_check="$ ( cat /sys/block/sda/queue/scheduler )" #TODO Make some kind of check if linux is realy installed on sda
case "$IO_check" in
*[deadline]* ) echo -e "\e[0;32m I/O scheduler is already set to \"deadline\", moving to the next step \e[0m";;
*) sudo sed -i 's/\quiet splash\b/& elevator=deadline/' /etc/default/grub ;
sudo update-grub ;
IO_check="$ ( cat /sys/block/sda/queue/scheduler )" #Checking if operation ended propperly
case "$IO_check" in
*[deadline]* ) echo -e "\e[0;32m I/O scheduler has been successfully set to \"deadline\", moving to the next step \e[0m";;
*) echo -e "\e[0;32m I/O something went wrong, please add manually \"elevator=deadline\" right after \"quiet splash\" \e[0m";
echo -e "\e[0;32m It has to look like this: GRUB_CMDLINE_LINUX_DEFAULT=\"quiet splash elevator=deadline\" \e[0m";
gksudo xed /etc/default/grub ;
echo "When you finish, save file, close text editor and continue" ;
read -n1 -r -p "Press any key to continue..." key ;;
esac
esac
"1") echo -e "\e[0;32m you have hdd, skipping to the next step... \e[0m" ;;
*) echo echo -e "\e[0;31m ERROR!!! Wrong output from disc type check \e[0m" ;
esac
Output mengatakan Itu adalah sesuatu yang berhubungan dengan kasus utama saya. Saya tidak tahu apa yang salah dengan itu. Saya telah mencoba "0") dan "1") tanpa tanda kutip dan juga dalam tanda kurung, tetapi saya mendapatkan kesalahan yang sama.
Tolong bantu!