Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Conky script Pushing Back sh: 1: Bad Substitution Error

  1. #1
    Join Date
    Sep 2012
    Beans
    88

    Question Conky script Pushing Back sh: 1: Bad Substitution Error

    Hello everyone,

    I've been trying to build a conky for a few days now, and after passing my first few hurdles I am stuck, and have not been able to find some documentation about this, nor a thread for my issue.

    when I try to run my conky from the terminal I get a sh: 1: Bad Substitution message. Last night i tried revamping my conky to run with accuweather because I learned that conkyForecast is now a monthly paying subscription, so perhaps that is the issue? Not sure.

    Here is my conkyrc

    Code:
    background no
    update_interval 1
    total_run_times 0
    own_window yes
    own_window_transparent yes
    own_window_class Conky
    own_window_hints undecorate,sticky,skip_pager,skip_taskbar,below
    double_buffer yes
    no_buffers yes
    text_buffer_size 2048
    cpu_avg_samples 2
    net_avg_samples 2
    override_utf8_locale yes
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders yes
    use_spacer none
    minimum_size 1000 0
    alignment top_left
    gap_x 12
    gap_y 12
    uppercase no
    use_xft yes
    xftfont DejaVu Sans:size=12
    xftalpha 0.8
    default_color 000
    
    TEXT
    ${voffset 400}${font DejaVu Sans:size=24}${time %A}, ${time %d} ${time %B} ${time %Y}${font}
    ${battery_bar 8,720 BAT0}
    ${voffset -8}${fs_bar 8,720 /}
    ${voffset -8}${goto 400}${cpubar 8,310 cpu}
    ${voffset -8}${goto 400}${font saxMono:size=9}${top pid 1}${font DejaVu Sans:size=8}${voffset -1} ${top name 1}${voffset 1}${goto 660}${font saxMono:size=9}${top cpu 1}
    ${goto 400}${font saxMono:size=9}${top pid 2}${font DejaVu Sans:size=8}${voffset -1} ${top name 2}${voffset 1}${goto 650}${font saxMono:size=9}${top cpu 2}
    ${goto 400}${font saxMono:size=9}${top pid 3}${font DejaVu Sans:size=8}${voffset -1} ${top name 3}${voffset 1}${goto 640}${font saxMono:size=9}${top cpu 3}
    ${goto 400}${font saxMono:size=9}${top pid 4}${font DejaVu Sans:size=8}${voffset -1} ${top name 4}${voffset 1}${goto 620}${font saxMono:size=9}${top cpu 4}
    ${goto 400}${membar 8, 260}
    ${goto 400}${font saxMono:size=9}${top_mem pid 1}${font DejaVu Sans:size=8}${voffset -1} ${top_mem name 1}${voffset 1}${goto 620}${font saxMono:size=9}${top_mem mem 1}
    ${goto 400}${font saxMono:size=9}${top_mem pid 2}${font DejaVu Sans:size=8}${voffset -1} ${top_mem name 2}${voffset 1}${goto 630}${font saxMono:size=9}${top_mem mem 2}
    ${goto 400}${font saxMono:size=9}${top_mem pid 3}${font DejaVu Sans:size=8}${voffset -1} ${top_mem name 3}${voffset 1}${goto 640}${font saxMono:size=9}${top_mem mem 3}
    ${goto 400}${font saxMono:size=9}${top_mem pid 4}${font DejaVu Sans:size=8}${voffset -1} ${top_mem name 4}${voffset 1}${goto 650}${font saxMono:size=9}${top_mem mem 4}${font}
    ${voffset -90}${font route3:size=160}${time %l}${font route3:size=100}${voffset -80}${goto 230}${time %M}${font}
    ${voffset -500}${execpi 360 ${color 48bcff}CHICAGO WEATHER${hr 2}$color${execi 600 bash $Home/1d_accuweather_rss/1d}
    ${font conkyweather:size=30}${execpi 600  sed -n '2p' $Home/1d_accuweather_rss/weather}${font}${goto 75}${voffset -25}${execpi 600 sed -n '1p' $Home/1d_accuweather_rss/weather|cut -c1-20}
    ${goto 75}${execpi 600 sed -n '1p' $Home/1d_accuweather_rss/weather|cut -c21-40}
    ${goto 75}${execpi 600 sed -n '1p' $Home/1d_accuweather_rss/weather|cut -c41-60}
    
    ${execi 600  sed -n '3p' $Home/1d_accuweather_rss/weather}
    ${font conkyweather:size=30}${execpi 600  sed -n '5p' $HOME/1d_accuweather_rss/weather}${font}${goto 75}${voffset -25}${execpi 600 sed -n '4p' $Home/1d_accuweather_rss/weather|cut -c1-20}
    ${goto 75}${execpi 600 sed -n '4p' $Home/1d_accuweather_rss/weather|cut -c21-40}
    ${goto 75}${execpi 600 sed -n '4p' $Home/1d_accuweather_rss/weather|cut -c41-60}
    
    ${execi 600  sed -n '6p' $Home/1d_accuweather_rss/weather}
    ${font conkyweather:size=30}${execpi 600  sed -n '8p' $Home/1d_accuweather_rss/weather}${font}${goto 75}${voffset -25}${execpi 600 sed -n '4p' $Home/1d_accuweather_rss/weather|cut -c1-20}
    ${goto 75}${execpi 600 sed -n '7p' $Home/1d_accuweather_rss/weather|cut -c21-40}
     ${goto 75}${execpi 600 sed -n '7p' $Home/1d_accuweather_rss/weather|cut -c41-60}
    this is my 1d accuweather script

    Code:
    #!/bin/bash
    
    #function: test_image
    test_image () {
        case $1 in
         1|01)
           echo a
         ;;
         2|02)
           echo b
         ;;
         3|03)
           echo c
         ;;
         4|04)
           echo c
         ;;
         5|05)
           echo c
         ;;
         6|06)
           echo d
         ;;
         7|07)
           echo e
         ;;
         8|08)
           echo e
         ;;
         11)
           echo 0
         ;;
         12)
           echo h
         ;;
         13|14)
           echo g
         ;;
         15)
           echo l
         ;;
         16|17)
           echo k
         ;;
         18|26)
           echo i
         ;;
         19)
           echo p
         ;;
         20|21|23)
           echo o
         ;;
         22)
           echo r
         ;;
         24|31)
           echo E
         ;;
         25)
           echo u
         ;;
         29)
           echo v
         ;;
         30)
           echo 5
         ;;
         32)
           echo 6
         ;;
         33)
           echo A
         ;;
         34|36|37)
           echo B
         ;;
         35|38)
           echo C
         ;;
         39|40)
           echo G
         ;;
         41|42)
           echo K
         ;;
         43|44)
           echo O
         ;;
        esac
    } 
    
    #put your accuweather rss address here
    address="http://rss.accuweather.com/rss/liveweather_rss.asp?locCode=%2060510"
    
    killall wget
    wget -O $Home/1d_accuweather_rss/weather_raw $address
    
    
    if [[ -s $Home/1d_accuweather_rss/weather_raw ]]; then
    
        egrep 'Currently|Forecast<\/title>|_31x31.gif' $Home/1d_accuweather_rss/weather_raw > $Home/1d_accuweather_rss/weather
        sed -i '/AccuWeather\|Currently in/d' $Home/1d_accuweather_rss/weather
        sed -i -e 's/^[ \t]*//g' -e 's/<title>\|<\/title>\|<description>\|<\/description>//g' $Home/1d_accuweather_rss/weather
        sed -i -e 's/&lt;img src="/\n/g' $Home/1d_accuweather_rss/weather
        sed -i '/^$/d' $Home/1d_accuweather_rss/weather
        sed -i -e 's/_31x31.*$//g' -e 's/^.*\/icons\///g' $Home/1d_accuweather_rss/weather
        sed -i -e '1s/.$//' -e '3s/.$//' -e '6s/.$//' $Home/1d_accuweather_rss/weather
        for (( i=2; i<=8; i+=3 ))
            do
                im=$(sed -n ${i}p $Home/1d_accuweather_rss/weather)
                sed -i $i"s/^.*$/$(test_image $im)/" $Home/1d_accuweather_rss/weather
            done
    
     fi
    Last edited by Myst1234; June 4th, 2013 at 08:11 PM.

  2. #2
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,469
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    could you change [quote] tags to [code] ? thanks.

    shouldn't $HOME be all caps?
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  3. #3
    Join Date
    Sep 2012
    Beans
    88

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    Sorry, code tags wrapped.

    I wasn't sure if HOME should be caps since my home dir is not. But I will try and report back

  4. #4
    Join Date
    Sep 2012
    Beans
    88

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    I capitalized HOME and got the same exact error

  5. #5
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,469
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    Code:
    TEXT
    ${voffset 400}${font DejaVu Sans:size=24}${time %A}, ${time %d} ${time %B} ${time %Y}${font}
    ${battery_bar 8,720 BAT0}
    ${voffset -8}${fs_bar 8,720 /}
    ${voffset -8}${goto 400}${cpubar 8,310 cpu}
    ${voffset -8}${goto 400}${font saxMono:size=9}${top pid 1}${font DejaVu Sans:size=8}${voffset -1} ${top name 1}${voffset 1}${goto 660}${font saxMono:size=9}${top cpu 1}
    ${goto 400}${font saxMono:size=9}${top pid 2}${font DejaVu Sans:size=8}${voffset -1} ${top name 2}${voffset 1}${goto 650}${font saxMono:size=9}${top cpu 2}
    ${goto 400}${font saxMono:size=9}${top pid 3}${font DejaVu Sans:size=8}${voffset -1} ${top name 3}${voffset 1}${goto 640}${font saxMono:size=9}${top cpu 3}
    ${goto 400}${font saxMono:size=9}${top pid 4}${font DejaVu Sans:size=8}${voffset -1} ${top name 4}${voffset 1}${goto 620}${font saxMono:size=9}${top cpu 4}
    ${goto 400}${membar 8, 260}
    ${goto 400}${font saxMono:size=9}${top_mem pid 1}${font DejaVu Sans:size=8}${voffset -1} ${top_mem name 1}${voffset 1}${goto 620}${font saxMono:size=9}${top_mem mem 1}
    ${goto 400}${font saxMono:size=9}${top_mem pid 2}${font DejaVu Sans:size=8}${voffset -1} ${top_mem name 2}${voffset 1}${goto 630}${font saxMono:size=9}${top_mem mem 2}
    ${goto 400}${font saxMono:size=9}${top_mem pid 3}${font DejaVu Sans:size=8}${voffset -1} ${top_mem name 3}${voffset 1}${goto 640}${font saxMono:size=9}${top_mem mem 3}
    ${goto 400}${font saxMono:size=9}${top_mem pid 4}${font DejaVu Sans:size=8}${voffset -1} ${top_mem name 4}${voffset 1}${goto 650}${font saxMono:size=9}${top_mem mem 4}${font}
    ${voffset -90}${font route3:size=160}${time %l}${font route3:size=100}${voffset -80}${goto 230}${time %M}${font}
    ${voffset -500}${execpi 360 ${color 48bcff}CHICAGO WEATHER${hr 2}$color${execi 600 bash $Home/1d_accuweather_rss/1d}
    ${font conkyweather:size=30}${execpi 600  sed -n '2p' $Home/1d_accuweather_rss/weather}${font}${goto 75}${voffset -25}${execpi 600 sed -n '1p' $Home/1d_accuweather_rss/weather|cut -c1-20}
    ${goto 75}${execpi 600 sed -n '1p' $Home/1d_accuweather_rss/weather|cut -c21-40}
    ${goto 75}${execpi 600 sed -n '1p' $Home/1d_accuweather_rss/weather|cut -c41-60}
    this can't be right
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  6. #6
    Join Date
    Sep 2012
    Beans
    88

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    Why?

    And

    What would be right?

  7. #7
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,469
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    you tell me. It's not closed which is a syntax error that does who knows what to the end result and it lacks actual content to execpi - in other places ${exexpi} looks like this ${execpi 600 sed -n '2p' $Home/1d_accuweather_rss/weather} and here it ends with the interval.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  8. #8
    Join Date
    Dec 2011
    Location
    Atlanta, Georgia USA
    Beans
    48
    Distro
    Xubuntu

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    Hello Vaphell,
    Myst1234 is totally correct. In that line;

    Code:
    ${voffset -500}${execpi 360 ${color 48bcff}CHICAGO WEATHER${hr 2}$color${execi 600 bash $Home/1d_accuweather_rss/1d}
    the execpi 360 is supposed to parse a command every 360 conky updates, but there is no command to parse. If you look at the last object on that line, you can see the bash command following the execi and interval.

    I would try removing the;

    Code:
    ${execpi 360
    then try running from terminal again and see what errors come up.

    Hope this helps
    Ubuntu User #35429 | Linux User #558865

  9. #9
    Join Date
    Sep 2012
    Beans
    88

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    Oh ok, I see now. I'm new to the conky world, and have been trying to piece things together.

    I will report back after the change, thanks

  10. #10
    Join Date
    Jun 2009
    Location
    Land of Paranoia and Guns
    Beans
    194
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: Conky script Pushing Back sh: 1: Bad Substitution Error

    Your Accuweather script seems to be reacting to the exclamation point in your hash bang, hence the "Bad substitution" error. I have no clue why it's doing that or how to fix it. Check for non-printable characters, maybe?
    Last edited by epicoder; June 8th, 2013 at 01:22 PM.
    Don't use W3Schools as a resource! (Inconsequential foul language at the jump)
    Open Linux Forums (More foul language, but well worth it for the quality of support and good humor.)
    If you want to discuss W3Schools, please PM me instead of posting.

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •