0
아주 큰 스크립트를 실행하는 동안 문제가 있습니다. 중간 출력에서 말한다 :사례 - 예기치 않은 토큰 근처에 sythax 오류가 발생했습니다.
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" ;;'
난 당신이 lonng하기 (스크립트가 260 선을 계산) 그래서 난 단지 관련 부분을 게시 할 예정 만들 싶지 않은 :
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
출력 말한다 그것은 관련 뭔가 내 주요 사건으로 나는 그것이 무엇이 잘못되었는지 알 수 없다. 나는 "0"과 "1") 따옴표없이 괄호 안에 시도했지만, 나는 같은 오류가 발생했습니다.
도와주세요!
[mcve] 작성에 대한 설명서를 참조하십시오. 코드 샘플은 주어진 문제를 생성하기 위해 테스트 된 ** 가능한 가장 짧은 ** 코드 여야합니다. 아무 것도 제거 할 수 있고 문제가 계속 발생하면 질문을하기 전에 제거해야합니다 *. –
(여기에 질문하기 전에 코드가 http://shellcheck.net/에서 깨끗하게 실행되는지 확인하는 것이 좋습니다). –
신비한 구문 오류는 거의 파서에 의해 플래그가 지정된 줄 앞에 표시됩니다. – chepner