You are not logged in.

#1 2011-09-18 20:21:01

kasl33
Member
Registered: 2011-09-09
Posts: 13

[SOLVED] I need your /etc/profile file

I'm not sure what happened, but my /etc/profile is corrupted (and I didn't touch it). The only things I have done to my fresh Arch install are install apps and create aliases in my .bashrc which I copied from /etc/skel.

If somebody could please post the contents of their /etc/profile file here, It will be much appreciated.

In case you're interested, here's my corrupted file (that I never touched):

\n# /etc/profile\n\n#Set our umask\numask 022\n\n# Set our default path\nPATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"\nexport PATH\n\n# Load profiles from /etc/profile.d\nif test -d /etc/profile.d/; then\nfor profile in /etc/profile.d/*.sh; do\ntest -r "$profile" && . "$profile"\ndone\nunset profile\nfi\n\n# Source global bash config\nif test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then\n. /etc/bash.bashrc\nfi\n\n# Termcap is outdated, old, and crusty, kill it.\nunset TERMCAP\n\n# Man is much better than us at figuring this out\nunset MANPATH\nPT5HOME=/usr/local/PacketTracer5\nexport PT5HOME

Last edited by kasl33 (2011-10-03 00:26:00)

Offline

#2 2011-09-18 20:32:49

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] I need your /etc/profile file

'\n' means newline. I don't know what happened but here you go:

[karol@black ~]$ echo -e "\n# /etc/profile\n\n#Set our umask\numask 022\n\n# Set our default path\nPATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"\nexport PATH\n\n# Load profiles from /etc/profile.d\nif test -d /etc/profile.d/; then\nfor profile in /etc/profile.d/*.sh; do\ntest -r "$profile" && . "$profile"\ndone\nunset profile\nfi\n\n# Source global bash config\nif test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then\n. /etc/bash.bashrc\nfi\n\n# Termcap is outdated, old, and crusty, kill it.\nunset TERMCAP\n\n# Man is much better than us at figuring this out\nunset MANPATH\nPT5HOME=/usr/local/PacketTracer5\nexport PT5HOME"

produces

# /etc/profile

#Set our umask
umask 022

# Set our default path
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -r  && . 
done
unset profile
fi

# Source global bash config
if test \[\][\u@\h \W]\$\[\]  && test /bin/bash && test -r /etc/bash.bashrc; then
. /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH
PT5HOME=/usr/local/PacketTracer5
export PT5HOME

My /etc/profile doesn't have the last two lines

PT5HOME=/usr/local/PacketTracer5
export PT5HOME

Last edited by karol (2011-09-18 20:35:05)

Offline

#3 2011-09-18 20:35:42

kasl33
Member
Registered: 2011-09-09
Posts: 13

Re: [SOLVED] I need your /etc/profile file

Wow thanks! I never knew that echo had the option to format text like that!

I knew about the newline character but it never donned on me to actually run it through a program... Simple problem made hard, then made easy.

Offline

#4 2011-09-18 20:36:46

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] I need your /etc/profile file

Wait a second, I think some parts are missing.

Offline

#5 2011-09-18 20:38:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] I need your /etc/profile file

Try this:

# /etc/profile

#Set our umask
umask 022

# Set our default path
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
	for profile in /etc/profile.d/*.sh; do
		test -r "$profile" && . "$profile"
	done
	unset profile
fi

# Source global bash config
if test \[\][\u@\h \W]\$\[\]  && test /bin/bash && test -r /etc/bash.bashrc; then
	. /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP


# Man is much better than us at figuring this out
unset MANPATH
PT5HOME=/usr/local/PacketTracer5
export PT5HOME

The problem with my first attempt was that

		test -r "$profile" && . "$profile"

got changed into

test -r  && . 

because $profile was not defined and therefore empty.

Last edited by karol (2011-09-18 20:49:57)

Offline

#6 2011-09-18 20:42:40

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED] I need your /etc/profile file

Offline

#7 2011-09-18 20:50:04

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] I need your /etc/profile file

You're absolutely right and it avoids many issues I managed to get OP into by acting first, thinking later.

Last edited by karol (2011-09-18 21:16:58)

Offline

#8 2011-09-18 21:11:08

kasl33
Member
Registered: 2011-09-09
Posts: 13

Re: [SOLVED] I need your /etc/profile file

Karol - you are absolutely correct. Something got messed up in there and the help you have given me has left me with all but one error (after your second observation (first one had a whole book of errors)).

It's now complaining about: -bash: test: [][u@h: unary operator expected

I replaced the

if test \[\][\u@\h \W]\$\[\]  && test /bin/bash && test -r /etc/bash.bashrc; then

with the

# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
	. /etc/bash.bashrc
fi

and it seems to be working fine with no errors.

I figure since $PS1 is the same thing as the \[\][\u@\h \W]\$\[\] but just represents it, then it is less of a hassle to just use the variable in the file and bash doesn't complain about it.

Thank you both for your help!

Last edited by kasl33 (2011-09-18 21:12:32)

Offline

#9 2011-09-18 21:15:47

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] I need your /etc/profile file

Ughhh .. That error was due me being an idiot and not realizing that "$PS1" will get expanded into my $PS1 - kinda obvious but I somehow missed it. Sorry about this.

Last edited by karol (2011-09-18 21:17:56)

Offline

Board footer

Powered by FluxBB