LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2015, 07:38 AM   #1
NAMACHEVAYAM
LQ Newbie
 
Registered: Jun 2015
Posts: 3

Rep: Reputation: Disabled
hi i want to the profile for my linux redhat 6


hi i am using the redhat linux 6.. my profile file which is located as etc/profile was deleted by mistake ,, but i replace that file from my backup but i received in this lines in my command terminal

: command not found
: command not found
: command not found
'ash: /etc/profile: line 11: syntax error near unexpected token `{
'ash: /etc/profile: line 11: `pathmunge () {


pls help me to solve this problem,,,


this is my back up profile file contains

# /etc/profile



# System wide environment and startup programs, for login setup

# Functions and aliases go in /etc/bashrc



# It's NOT good idea to change this file unless you know what you

# are doing. Much better way is to create custom.sh shell script in

# /etc/profile.d/ to make custom changes to environment. This will

# prevent need for merging in future updates.



pathmunge () {

case ":${PATH}:" in

*:"$1":*)

;;

*)

if [ "$2" = "after" ] ; then

PATH=$PATH:$1

else

PATH=$1:$PATH

fi

esac



}



if [ -x /usr/bin/id ]; then

if [ -z "$EUID" ]; then

# ksh workaround

EUID=`id -u`

UID=`id -ru`

fi

USER="`id -un`"

LOGNAME=$USER

MAIL="/var/spool/mail/$USER"

fi



# Path manipulation

if [ "$EUID" = "0" ]; then

pathmunge /sbin

pathmunge /usr/sbin

pathmunge /usr/local/sbin

else

pathmunge /usr/local/sbin after

pathmunge /usr/sbin after

pathmunge /sbin after

fi



HOSTNAME=`/bin/hostname 2>/dev/null`

HISTSIZE=1000

if [ "$HISTCONTROL" = "ignorespace" ] ; then

export HISTCONTROL=ignoreboth

else

export HISTCONTROL=ignoredups

fi



export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL



for i in /etc/profile.d/*.sh ; do

if [ -r "$i" ]; then

if [ "$PS1" ]; then

. $i

else

. $i >/dev/null 2>&1

fi

fi

done

unset i

unset pathmunge
 
Old 06-22-2015, 12:38 PM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Xubuntu, Manjaro
Posts: 745
Blog Entries: 3

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
Well, as it is stated in the file itself:
Code:
# Functions and aliases go in /etc/bashrc
And you have a function in your
Code:
/etc/profile
Called pathmunge

Not that I'm an expert on RHEL, but that seems to be the obvious.

Last edited by HMW; 06-22-2015 at 12:51 PM. Reason: Typo...
 
Old 06-22-2015, 02:48 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Please place your code in [code][/code] tags to preserve formatting.

Quote:
Originally Posted by HMW
Well, as it is stated in the file itself:
Code:
# Functions and aliases go in /etc/bashrc
And you have a function in your
Code:
/etc/profile
Called pathmunge

Not that I'm an expert on RHEL, but that seems to be the obvious.
That's normal.
 
1 members found this post helpful.
Old 06-22-2015, 04:25 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,818

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
Quote:
my profile file which is located as etc/profile was deleted by mistake
have to ask

how did you delete a system file owned by root ?

a copy of my sl6.6 file
Code:
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT good idea to change this file unless you know what you
# are doing. Much better way is to create custom.sh shell script in
# /etc/profile.d/ to make custom changes to environment. This will
# prevent need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`id -u`
        UID=`id -ru`
    fi
    USER="`id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /sbin
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
    pathmunge /sbin after
fi

HOSTNAME=`/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi


export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL 

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        if [ "$PS1" ]; then
            . $i
        else
            . $i >/dev/null 2>&1
        fi
    fi
done

unset i
unset pathmunge
MAKE 100 SURE!!!!! that there is a BLANK LINE AT THE END OF THIS FILE !!!!!
there must be a "new line" on the end of the file --- old habits but


by chance did you edit this file using Microsoft wordpad on a windows os ?

that will cause problems

Last edited by John VV; 06-22-2015 at 04:28 PM.
 
1 members found this post helpful.
Old 06-23-2015, 01:46 AM   #5
NAMACHEVAYAM
LQ Newbie
 
Registered: Jun 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
thank you so so much i get clear my problem mr john thanks lot
 
Old 06-23-2015, 02:19 AM   #6
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Xubuntu, Manjaro
Posts: 745
Blog Entries: 3

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
Quote:
Originally Posted by suicidaleggroll View Post
That's normal.
Thanks, I learnt from this thread as well!
 
  


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
redhat 5.2 login/profile-script ? jonaskellens Red Hat 5 08-07-2008 08:56 AM
Is there a .profile in RedHat 9? juszuf7 Red Hat 1 01-07-2004 02:53 PM
Profile file for redhat? KaktusKnight Linux - General 3 06-19-2003 01:17 AM
redhat 8.0 and CDC/Foundation profile moeminhtun Linux - General 3 12-27-2002 02:50 AM
login profile problum in windows 2000 to redhat 7.3 prashu_bvp Linux - Networking 3 10-22-2002 09:22 AM


All times are GMT -5. The time now is 02:40 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration