LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-31-2010, 09:02 AM   #1
Squall90
Member
 
Registered: Oct 2009
Distribution: Currently several distros :S
Posts: 148

Rep: Reputation: 29
.bash_profile, "-bash: export: command not found"


Hi there,

I was trying to get rid of qtconfig's error message "QGtkStyle was unable to detect the current GTK+ theme.".

So I created the file ~/.gtkrc-2.0 with this content:
Code:
gtk-theme-name="Xfce"
Then I had to read this file after logging in (or at least, when I start X. So I created a ~/.bash_profile file with the following line:
Code:
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
When I now login, I get this message:
Code:
-bash: export: command not found
Any idea what could cause this problem?

I am running Slackware 13.1.
 
Old 12-31-2010, 09:15 AM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,910

Rep: Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026Reputation: 5026
export is a shell built-in command. It should be impossible to not find it. I'd be inclined to check your profile file for any non-printable/control-characters that may have crept in.
grep export < ~/.bash_profile | od -tx1c
 
Old 01-01-2011, 05:11 AM   #3
Squall90
Member
 
Registered: Oct 2009
Distribution: Currently several distros :S
Posts: 148

Original Poster
Rep: Reputation: 29
This file is UTF-8 encoded. Could this the problem?
Code:
christian@tux-netbook:~$ grep export < ~/.bash_profile | od -tx1c
0000000  ef  bb  bf  65  78  70  6f  72  74  20  47  54  4b  32  5f  52
        357 273 277   e   x   p   o   r   t       G   T   K   2   _   R
0000020  43  5f  46  49  4c  45  53  3d  22  24  48  4f  4d  45  2f  2e
          C   _   F   I   L   E   S   =   "   $   H   O   M   E   /   .
0000040  67  74  6b  72  63  2d  32  2e  30  22  0a
          g   t   k   r   c   -   2   .   0   "  \n
0000053
"less" prints this:
Code:
<U+FEFF>export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
So there's the UTF-8 notion? Is bash not UTF-8 compatible?
 
Old 01-02-2011, 04:36 PM   #4
Squall90
Member
 
Registered: Oct 2009
Distribution: Currently several distros :S
Posts: 148

Original Poster
Rep: Reputation: 29
I still don't know what caused this problems but I now added this line in my /etc/profile:
Code:
#  GTK QT Support
if [ -r "$HOME/.gtkrc-2.0" ]; then
        export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
fi
 
Old 05-14-2012, 09:38 PM   #5
amadeov
LQ Newbie
 
Registered: Mar 2007
Posts: 1

Rep: Reputation: 0
I know that this thread is a bit old, but I had the same problem running a script that I downloaded (check_snmp_printer from exchange.nagios.org) and ran on Ubuntu Server.

Somehow, the encoding at the start of the file was messed up. Though no extraneous characters appeared there in nano, the problem persisted after I had opened the file. I removed the first line, then replaced it by typing "#!/bin/bash" and inserting a line of space below it.

After doing so, the script ran fine. Hope this helps others!
 
Old 05-15-2012, 12:31 AM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Odds are that the file had Windows/DOS end-of-line characters. (That's CRLF or 0x0d 0x0A in hex). See "man fromdos" to see how to fix such a file.
 
Old 05-15-2012, 08:39 AM   #7
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
No, it wasn't the line endings, it was a byte order mark. You can see it in the output in post #3. MS programs sometimes add them to text files.

http://en.wikipedia.org/wiki/Byte_order_mark
 
Old 05-16-2012, 02:59 PM   #8
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Even Vim, under certain configurations, writes the BOM. To make sure it never does, put "set nobomb" in your .vimrc file.
 
Old 05-16-2012, 03:07 PM   #9
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
The BOM shown above denotes UTF-16 encoding. You can easily convert to UTF-8 using iconv:
Code:
iconv -f UTF-16 -t UTF-8 file > newfile
and then rename the resulting file as the original.
 
Old 05-16-2012, 03:45 PM   #10
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
I'd say chances are they actually are UTF-8 files, just with BOMS inserted.

The Wikipedia entry says that while the BOM is not necessary for UTF-8, it's not actually invalid, and so some programs add them anyway. But most *nix applications choke on it in some way or another, so you really need to remove them when encountered.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] "bash : links :command not found" error in apache server piyusharora420 Linux - Newbie 2 11-07-2010 01:16 AM
1st script attempt; cygwin; fails "bash: myscript : command not found" engineerd1 Linux - Newbie 8 11-08-2009 04:03 PM
build Cinelerra 2.1 for x86_64, bash "arch" command not found? newtovanilla Linux - Newbie 4 07-08-2008 05:28 PM
"bash: rpm: command not found" errom when trying to install any package sandeepchau123 Linux - General 16 07-06-2008 03:58 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration