LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-27-2016, 04:53 AM   #1
skathir1
LQ Newbie
 
Registered: Jul 2016
Posts: 5

Rep: Reputation: Disabled
Question setenv: Variable name must contain alphanumeric characters


In RHEL 6.7 su - newuser getting following error.

setenv: Variable name must contain alphanumeric characters

It is not getting user .cshrc information

Last edited by skathir1; 07-27-2016 at 04:55 AM.
 
Old 07-27-2016, 06:22 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,319
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
And do you know the .cshrc line or variable name set attempt which is causing this? Show the line where the complaint has been given. Typically there's an illegal character in the attempted variable name.
 
Old 07-29-2016, 07:46 AM   #3
skathir1
LQ Newbie
 
Registered: Jul 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
# --- tcsh settings
set prompt="%B%n@%m%b [%~]# "
set autolist
set autoexpand
set autocorrect
set color
set history=5000
set savehist=5000
set notify
set complete="enhance"
set savehist
set correct=cmd
set autologout=0
set color
set colorcat
# --- Oracle settings
setenv ORACLE_HOME /export/home/oracle/product/12.1.0/db_1
setenv ORACLE_BASE /export/home/oracle
setenv ORACLE_SID mcdb
setenv NLS_LANG AMERICAN_AMERICA.AL32UTF8
setenv LD_LIBRARY_PATH /lib
setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/export/home/oracle/product/12.1.0/db_1/bin:/export/home/oracle/product/12.1.0/db_1/OPatch:/usr/ccs/bin:/usr/ucb
setenv TMP /export/home/oracle/tmp_a/tmp
setenv TMPDIR /export/home/oracle/tmp_a/tmp
setenv SSH_DEBUG 0
setenv IS_CLONE 1
# --- alias
alias ec "env echo -ne "
alias dc cd
alias r rlogin
alias ~ cd ~
alias / cd /
alias more less
alias x \'chmod +x\'
alias cpd \'cp -Rp\'
alias ll \'ls -ltr\'
alias .. \'cd ..\'
alias - less
alias back \'set back=; set old=;cd ; unset back\'
alias s ssh
~
~
 
Old 07-29-2016, 10:11 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,907

Rep: Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510
I suspect the line "alias / cd /"; but without a trace with the error message I can't tell; and it could be any of the other special characters used as an alias name.

The problem these (or at least SOME of these) cause is that a shell normally processes the line for substitutions BEFORE they are used to identifies what is to be used as a variable. Thus things like "~" get replaced with the users home directory... then the command processing starts.

I've never seen special characters used as an alias...
 
Old 07-30-2016, 02:13 AM   #5
skathir1
LQ Newbie
 
Registered: Jul 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Question

Thanks But it is happening only RHEL 6.7 machine same is working fine in RHEL 6.5.

is there any difference between both version?
 
Old 07-30-2016, 05:22 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,907

Rep: Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510
could be a bug fix.

After all, that is why the minor version changes...

Just for testing, you could try copying tcsh from the 6.5 machine and try it out.

I gave up on csh/tcsh a LONG time ago - scripts were much less portable, and bash works better (and gets a LOT more testing). Bash is what gets used for the most.

Last edited by jpollard; 07-30-2016 at 05:30 AM.
 
Old 07-30-2016, 06:12 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
alias - less
alias ~ cd ~
are certainly interesting, to me.

compare to
Code:
su - <newuser>
also try
Code:
\su - <newyuser>
Remove or comment
Code:
# --- alias
alias ec "env echo -ne "
alias dc cd
alias r rlogin
alias ~ cd ~
alias / cd /
alias more less
alias x \'chmod +x\'
alias cpd \'cp -Rp\'
alias ll \'ls -ltr\'
alias .. \'cd ..\'
alias - less
alias back \'set back=; set old=;cd ; unset back\'
alias s ssh
and try the operation again.

Last edited by Habitual; 08-03-2016 at 09:05 AM. Reason: added alias ~ cd ~
 
1 members found this post helpful.
Old 08-02-2016, 02:11 AM   #8
skathir1
LQ Newbie
 
Registered: Jul 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
As a root user when i issue command "tcsh" getting same error

setenv: Variable name must contain alphanumeric characters

it is happening only in RHEL 6.7.

please suggest me
 
Old 08-02-2016, 06:46 AM   #9
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,319
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
Quote:
Originally Posted by skathir1 View Post
As a root user when i issue command "tcsh" getting same error

setenv: Variable name must contain alphanumeric characters

it is happening only in RHEL 6.7.

please suggest me
There's been a number of suggestions. One which has excellent merit and can be expanded upon is to follow Habitual's recommendation above, but to go further. Comment out everything except the first line. Verify that the first line is OK, then uncomment out the next line, verify that the first and second line are OK, and continue. Eventually you'll figure out which line is causing this problem. Another thing to do here is to enable debug by placing "set -vx" at the top of your script. The final option might be to contact RedHat considering you're using RHEL and that should contain support.
 
Old 06-28-2017, 10:30 AM   #10
Fishmed
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Rep: Reputation: Disabled
Lightbulb Posible Resolution

Quote:
Originally Posted by rtmistler View Post
There's been a number of suggestions. One which has excellent merit and can be expanded upon is to follow Habitual's recommendation above, but to go further. Comment out everything except the first line. Verify that the first line is OK, then uncomment out the next line, verify that the first and second line are OK, and continue. Eventually you'll figure out which line is causing this problem. Another thing to do here is to enable debug by placing "set -vx" at the top of your script. The final option might be to contact RedHat considering you're using RHEL and that should contain support.
I was moving a script from UNIX to Linux and experienced the error as the OP. In my search for a cause/resolution, I stumbled on this forum/thread. I used the "set -vx" to find the source of my problem. I found that by replacing the "setenv" command with "export", the issue cleared up. I see the script above has several "setenv" commands that may have needed to be replaced. The resulting error message really does not identify the cause.

Thank you rtmistler for your debug tip!
 
Old 06-28-2017, 12:15 PM   #11
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,319
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
Quote:
Originally Posted by Fishmed View Post
I was moving a script from UNIX to Linux and experienced the error as the OP. In my search for a cause/resolution, I stumbled on this forum/thread. I used the "set -vx" to find the source of my problem. I found that by replacing the "setenv" command with "export", the issue cleared up. I see the script above has several "setenv" commands that may have needed to be replaced. The resulting error message really does not identify the cause.

Thank you rtmistler for your debug tip!
Hi Fishmed and welcome to LQ!

I'm glad the thread was of some help to you. Typically for some bash questions I also recommend my blog on that subject, but see I hadn't here. Either case, it is an old blog which describes a lot about how to debug bash scripts in general. The LQ link for it is here. Happy scripting!
 
Old 06-28-2017, 12:27 PM   #12
Fishmed
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by Fishmed View Post
I was moving a script from UNIX to Linux and experienced the error as the OP. In my search for a cause/resolution, I stumbled on this forum/thread. I used the "set -vx" to find the source of my problem. I found that by replacing the "setenv" command with "export", the issue cleared up. I see the script above has several "setenv" commands that may have needed to be replaced. The resulting error message really does not identify the cause.

Thank you rtmistler for your debug tip!
To add to my post. I found that I had to leave the "set -vx" command in place with the other changes for the script to work.
 
Old 07-01-2017, 03:43 AM   #13
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
The real csh is notoriously buggy, you shouldn't even be using it. If you're using tcsh, that tried to fix most of the bugs but some were simply unfixable. You really you should be using bash, it is really best shell out there among the commonly used ones. Maybe ksh and zsh etc. are OK but they're not commonly used.

The only reason csh ever got any traction is because it was written by Bill Joy, a cofounder of Sun Microsystems.

Last edited by Laserbeak; 07-01-2017 at 03:49 AM.
 
Old 07-01-2017, 05:56 AM   #14
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,907

Rep: Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510Reputation: 1510
Quote:
Originally Posted by Laserbeak View Post
The real csh is notoriously buggy, you shouldn't even be using it. If you're using tcsh, that tried to fix most of the bugs but some were simply unfixable. You really you should be using bash, it is really best shell out there among the commonly used ones. Maybe ksh and zsh etc. are OK but they're not commonly used.

The only reason csh ever got any traction is because it was written by Bill Joy, a cofounder of Sun Microsystems.
I never did like cshell for anything except the history option.

Always used the Bourne shell as that was the only (and still is) portable scripting shell. Bash comes close, but now you have to avoid so many things to make the scripts portable.
 
Old 07-01-2017, 06:58 AM   #15
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,510

Rep: Reputation: 5552Reputation: 5552Reputation: 5552Reputation: 5552Reputation: 5552Reputation: 5552Reputation: 5552Reputation: 5552Reputation: 5552Reputation: 5552Reputation: 5552
would be nice to know the version of tcsh
also you can insert set echo; set verbose to see what's happening (and you will see the lines as they executed).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] Generate SPECIAL alphanumeric WORDLIST - no repeating characters side-by-side Stanley_212 Programming 30 08-17-2013 11:39 AM
Generate SPECIAL alphanumeric WORDLIST - no characters appearing more than X times Stanley_212 Programming 4 01-20-2013 07:46 PM
[SOLVED] Bugzilla 4.0 not recognizing SetEnv variable for Virtual Host boomer42812 Linux - Newbie 1 05-28-2011 12:43 AM
[SOLVED] apg password without non-alphanumeric characters raceman Programming 2 04-26-2010 04:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:22 PM.

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