Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem with a shell script [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Elleni
Apprentice
Apprentice


Joined: 23 May 2006
Posts: 220

PostPosted: Wed Jul 03, 2013 7:21 am    Post subject: Problem with a shell script [solved] Reply with quote

I tried installing fop2 for asterisk, and they have autoconfiguation scripts for freepbx which on my gentoo box execute with errors.

When trying to execute them manually I get:

cd /usr/local/fop2
sh autoconfig-users-freepbx.sh

autoconfig-users-freepbx.sh: line 32: syntax error near unexpected token `<'
autoconfig-users-freepbx.sh: line 32: `done < <( mysql -NB -u $DBUSER -p$DBPASS -h $DBHOST $DBNAME -e "SHOW tables FROM \`$DBNAME\` LIKE 'fop2users'" )'

following the mentioned script:
http://bpaste.net/show/111570/

Is there a way to execute this script successfully?


Last edited by Elleni on Wed Jul 03, 2013 2:34 pm; edited 1 time in total
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7804
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed Jul 03, 2013 11:23 am    Post subject: Reply with quote

It probably means that you have some other shell than Bash installed as your /bin/sh. Line 32 is valid Bash syntax. Try running the script under Bash. :wink:

- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
Elleni
Apprentice
Apprentice


Joined: 23 May 2006
Posts: 220

PostPosted: Wed Jul 03, 2013 1:45 pm    Post subject: Reply with quote

Well the strange thing is, that I did not - at least not intentionally - change my bash.

emerge bash -pv

These are the packages that would be merged, in order:

Calculating dependencies ... done!
[ebuild R ] app-shells/bash-4.2_p45 USE="afs mem-scramble net nls plugins (readline) -bashlogger -examples -vanilla"

I come from emerging bash with some more useflags, but that did not help eather, so I will delete added useflags and revert back to standard bash installation. Can you help me fixing this? I do not really know, how to fix... :oops:

I removed afs mem-scramble and plugins use again. In /etc/password root and my user have /bin/bash entry.

Code:
emerge --info
Portage 2.1.12.2 (hardened/linux/x86/selinux, gcc-4.6.3, glibc-2.15-r3, 3.9.5-hardened i686)
=================================================================
System uname: Linux-3.9.5-hardened-i686-Intel-R-_Core-TM-2_Duo_CPU_E8400_@_3.00GHz-with-gentoo-2.2
KiB Mem:     2004816 total,    455008 free
KiB Swap:    2000088 total,   1997764 free
Timestamp of tree: Wed, 03 Jul 2013 13:00:01 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p45
dev-lang/python:          2.7.5, 3.2.5-r1
dev-util/cmake:           2.8.10.2-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.7 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo lokal
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-march=i686 -O2 -pipe"
FEATURES="assume-digests binpkg-logs candy config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch xattr"
FFLAGS="-march=i686 -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="de_DE.utf8"
LC_ALL="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="alaw alsa apache2 asterisk berkdb bindist bzip2 calendar caps cgi cli cluster cracklib crypt ctype curl curlwrappers cxx dri encode esd ffmpeg flac force-cgi-redirect freetds g722 gd gdbm gif gpm gtalk h323 hardened iconv ilbc imap ipv6 jabber jbig jpeg ldap logrotate lua mbrola mmx modules mp3 mpeg mudflap mysql ncurses nls nptl nptlonly odbc offensive ogg open_perms openmp openntpd osplookup oss pam pax_kernel pcre php pic png portaudio posix radius readline sdl selinux session sockets span speex spell sqlite srtp sse sse2 sse3 ssl syslog tcltk tcpd threads tiff truetype unicode urandom vorbis wav win32codecs x86 xml zaptel zip zlib" ABI_X86="32" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de en fr it" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="vesa intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON


My next thought was, that perhaps it is a problem with mysql so I emerged it with all useflags, I found :lol: (try and error approach) :) but I had no success eather, so I reverted back.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7804
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed Jul 03, 2013 1:49 pm    Post subject: Reply with quote

Could you post the output of
Code:
ls -l /bin/sh
and
Code:
which sh
please?

- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
Elleni
Apprentice
Apprentice


Joined: 23 May 2006
Posts: 220

PostPosted: Wed Jul 03, 2013 1:58 pm    Post subject: Reply with quote

wow that was fast response :D

ls -l /bin/sh

lrwxrwxrwx. 1 root root 4 Jul 3 14:29 /bin/sh -> bash

which sh

/bin/sh
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7804
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed Jul 03, 2013 2:16 pm    Post subject: Reply with quote

Sorry; I was led astray by a feature of Bash that I didn't understand. :oops: Bash apparently tries to comply with the original Bourne shell syntax (which did not include the type of temporary file creation the script uses) when it is invoked as sh. Just run the script like this
Code:
cd /usr/local/fop2
./autoconfig-users-freepbx.sh
and you'll be fine.

- John

Edit: Typo.
_________________
This space intentionally left blank.


Last edited by John R. Graham on Wed Jul 03, 2013 2:42 pm; edited 2 times in total
Back to top
View user's profile Send private message
Elleni
Apprentice
Apprentice


Joined: 23 May 2006
Posts: 220

PostPosted: Wed Jul 03, 2013 2:34 pm    Post subject: Reply with quote

great stuff. Thank you very much!! That way it works :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum