Thread: : bad substitution, bash script
hello all,
i'm trying write script install conky , check if .conkyrc exists, if not append code ~/.conkyrc file. when run part of script receive error " :bad substitution" here code.
thankscode:echo "checking if .conkyrc exists..." if [ -f .conkyrc ]; echo ".conkyrc exists , executable!" exit else clear echo ".conkyrc not exist, create it?" fi echo "enter yes create .conkyrc" echo "enter no exit program" read choice case $choice in yes) cat <<eof > ~/.conkyrc; # static's .conkyrc # comprehensive conky script, configured use on # ubuntu / debian gnome, without need external scripts. # # based on conky-jc , default .conkyrc. # # create own window instead of using desktop (required in nautilus) own_window yes own_window_hints undecorated,below,skip_taskbar background no # use double buffering (reduces flicker, may not work everyone) double_buffer yes # fiddle window use_spacer true use_xft true # update interval in seconds update_interval 1.0 # minimum size of text area minimum_size 400 5 # draw shades? draw_shades yes # text stuff draw_outline no # amplifies text if yes draw_borders no uppercase yes # set yes if want text in uppercase # stippled borders? stippled_borders 8 # border margins border_margin 4 # border width border_width 1 # default colors , border colors, grey90 == #e5e5e5 default_color white default_shade_color black default_outline_color white own_window_colour brown own_window_transparent yes # text alignment, other possible values commented #alignment top_left #alignment top_right #alignment bottom_left alignment bottom_right # gap between borders of screen , text gap_x 10 gap_y 50 # stuff after 'text' formatted on screen override_utf8_locale no xftfont terminus:size=8 xftalpha 0.8 text ${offset 240}${color #ddaa00}${time %a, } ${color }${time %e %b %g} ${offset 240}${color #ddaa00}${time %z, }${color }${time %h:%m:%s} ${offset 240}${color #ddaa00}uptime: ${color }$uptime ${offset 240}${color #ddaa00}kern:${color }$kernel ${offset 240}${color #ddaa00}cpu:${color } $cpu% ${acpitemp}c ${offset 240}${cpugraph 20,130 #ddaa00} ${offset 240}${color #ddaa00}load: ${color }$loadavg ${offset 240}${color #ddaa00}processes: ${color }$processes ${offset 240}${color #ddaa00}running: ${color }$running_processes ${offset 240}${color #ddaa00}highest cpu processes: ${offset 240}${color lightgrey} ${top name 1}${top_mem cpu 1} ${offset 240}${color lightgrey} ${top name 2}${top cpu 2} ${offset 240}${color lightgrey} ${top name 3}${top cpu 3} ${offset 240}${color lightgrey} ${top name 4}${top cpu 4} ${offset 240}${color #ddaa00}highest ram processes: ${offset 240}${color lightgrey} ${top_mem name 1}${top_mem mem 1} ${offset 240}${color lightgrey} ${top_mem name 2}${top_mem mem 2} ${offset 240}${color lightgrey} ${top_mem name 3}${top_mem mem 3} ${offset 240}${color lightgrey} ${top_mem name 4}${top_mem mem 4} ${offset 240}${color #ddaa00}ram: ${color } $memperc% $mem/$memmax ${offset 240}${membar 3,100} ${offset 240}${color #ddaa00}swap: ${color }$swapperc% $swap/$swapmax ${offset 240}${swapbar 3,100} ${offset 240}${color #ddaa00}root: ${color }${fs_free /}/${fs_size /} ${offset 240}${fs_bar 3,100 /} ${offset 240}${color #ddaa00}home: ${color }${fs_free /home}/${fs_size /home} ${offset 240}${fs_bar 3,100 /home} #ppp0 interface graphs ${offset 240}${color #ddaa00}net ppp0: ${offset 240}${color}up: ${color }${upspeed ppp0} k/s ${offset 240}${upspeedgraph eth0 20,130 000000 ffffff} ${offset 240}${color}down: ${color }${downspeed ppp0}k/s${color} ${offset 240}${downspeedgraph ppp0 20,130 000000 ffffff} #wlan0 interface graphs ${offset 240}${color #ddaa00}net wlan0: ${offset 240}${color}up: ${color }${upspeed wlan0} k/s ${offset 240}${upspeedgraph wlan0 20,130 000000 ffffff} ${offset 240}${color}down: ${color }${downspeed wlan0}k/s${color} ${offset 240}${downspeedgraph wlan0 20,130 000000 ffffff} #mon0 interface graphs ${offset 240}${color #ddaa00}net mon0: ${offset 240}${color}up: ${color }${upspeed mon0} k/s ${offset 240}${upspeedgraph mon0 20,130 000000 ffffff} ${offset 240}${color}down: ${color }${downspeed mon0}k/s${color} ${offset 240}${downspeedgraph mon0 20,130 000000 ffffff} #eth0 interface graphs ${offset 240}${color #ddaa00}net eth0: ${offset 240}${color}up: ${color }${upspeed eth0} k/s ${offset 240}${upspeedgraph eth0 20,130 000000 ffffff} ${offset 240}${color}down: ${color }${downspeed eth0}k/s${color} ${offset 240}${downspeedgraph eth0 20,130 000000 ffffff} eof esac
slashwannabe94
any pointers on how make code more readable please share. i'm still developing own style of coding , appreciate veteran tips.
thanks
slashwannabe94
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk : bad substitution, bash script
Ubuntu
Comments
Post a Comment