urxvt-bash-systax-error

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
belham2
Posts: 1715
Joined: Mon 15 Aug 2016, 22:47

urxvt-bash-systax-error

#1 Post by belham2 »

Hi all,

Can anyone see the problem in line 10 of this 22 line code bash for qt4.csh? Every time I open urxvt in Slacko 6.9.6.4, I see the following two lines in urxvt: (pic is last):


Code: Select all

bash: /etc/profile.d/qt4.csh: line 10: syntax error near unexpected token `('
bash: /etc/profile.d/qt4.csh: line 10: `             foreach qtd ( /usr/lib/qt-*)'
#
Here's the full 22 lines of the qt4.csh bash:

Code: Select all

#!/bin/csh
# Environment path variables for the Qt package:
if ( ! $?QT4DIR ) then
    # It's best to use the generic directory to avoid
    # compiling in a version-containing path:
    if ( -d /usr/lib/qt ) then
        setenv QT4DIR /usr/lib/qt
    else
        # Find the newest Qt directory and set $QT4DIR to that:
        foreach qtd ( /usr/lib/qt-* )
            if ( -d $qtd ) then
                setenv QT4DIR $qtd
            endif
        end
    endif
endif
set path = ( $path $QT4DIR/bin )
if ( $?CPLUS_INCLUDE_PATH ) then
    setenv CPLUS_INCLUDE_PATH $QT4DIR/include:$CPLUS_INCLUDE_PATH
else
    setenv CPLUS_INCLUDE_PATH $QT4DIR/include
endif
Attachments
error-when-opening-urxvt-in-Slacko-6.9.6.4.png
(114.27 KiB) Downloaded 165 times

User avatar
Keef
Posts: 987
Joined: Thu 20 Dec 2007, 22:12
Location: Staffordshire

#2 Post by Keef »

I think this is one that pops up every so often.

Code: Select all

#!/bin/csh 
csh is a different shell not included in Puppy. Try changing it to sh or bash.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#3 Post by amigo »

Neither setenv nor foreach are in bash or sh.
Here's a quick translation into shell/bash code -should be pretty close, but I haven't checked it:

Code: Select all

#!/bin/bash
# Environment path variables for the Qt package:
if [ -z $QT4DIR ] ; then
    # It's best to use the generic directory to avoid
    # compiling in a version-containing path:
    if [ -d /usr/lib/qt ] ; then
        export QT4DIR=/usr/lib/qt
    else
        # Find the newest Qt directory and set $QT4DIR to that:
        for qtd in `echo /usr/lib/qt-*` ; do
            if [ -d $qtd ] ; then
                export QT4DIR=$qtd
            fi
        done
    fi
fi
export PATH=$PATH:$QT4DIR/bin
if [ -n $CPLUS_INCLUDE_PATH ] ; then
    export CPLUS_INCLUDE_PATH=$QT4DIR/include:$CPLUS_INCLUDE_PATH
else
    export CPLUS_INCLUDE_PATH=$QT4DIR/include
fi

belham2
Posts: 1715
Joined: Mon 15 Aug 2016, 22:47

#4 Post by belham2 »

Thanks, Keef and Amigo,

Read your guys replies, and once you made me realize .csh isn't part of shell/bash code, I re-looked in the folder where the "#####.csh" resided, and sure enough, the shell/bash version of it was there (and basically just as you wrote it, Amigo). So, I deleted the .csh file completely, and problem solved. Urxvt opens with no error messages at top, and even upon bootup, the complaint about the ",csh" is gone.

Thanks a lot guys!

Post Reply