Sponsored Content
Top Forums Shell Programming and Scripting Problem in .bash_profile Linux Post 302368177 by NIMISH AGARWAL on Wednesday 4th of November 2009 09:34:19 AM
Old 11-04-2009
We had below code in our .bash_profile
:

in the starting of teh script we are just calling teh .bashrc script in the same directory

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

then we are exporting some of teh variables which are also not working.

Part of .bash_profile

TEST="testing" ; export TEST

and after login when we do echo $TEST that is returning a blank

---------- Post updated at 07:53 PM ---------- Previous update was at 07:51 PM ----------

so how can we check that if the user is not having a shell ?

Note: we are able to execute the other scripts after login.
Even we are able to execute the . .bash_profile

---------- Post updated at 08:04 PM ---------- Previous update was at 07:53 PM ----------

or if tehre is any other way to provide a welcome/information message to the user then please share that
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

numbers on permanently through .bash_profile

Hi Can anyone tell me if it is at all possible to edit ones .bash_profile, to make the setting on of line numbers (in vi/vim), permanent? I've been to a few IRC channels and people keep telling me it is more of a vi/vim thing and to use something called ".vimrc", however I heard that it is... (3 Replies)
Discussion started by: zorrokan
3 Replies

2. Shell Programming and Scripting

.bash_profile problem

Hi Guys, I modified my .bash_profile script , and tried to change the prompt. Following is the line of code in my .bash_profile script. export PS1=" \W " But I get the output as: \W This appears to be my prompt now. Any idea what should be done.. Thanks! (0 Replies)
Discussion started by: nua7
0 Replies

3. Shell Programming and Scripting

question in .bash_profile

We are more users using the oracle account, and people want to include theyr own files in .bash_profile. Like this: while ; do echo -n "LOGNAME is '$LOGNAME' (no sens), who are you? " >/dev/stderr read ln export LOGNAME=$ln done This works well when logging in to... (1 Reply)
Discussion started by: hannem
1 Replies

4. UNIX for Dummies Questions & Answers

bash_profile does not working

Hi all. when i connect as user megaguru i have a problem my .bash_profile does not working^:( if i do: . ./.bash_profile all enviroment variables are in place. How can i force linux to use .bash_profile before logon process? thanx in advance. (1 Reply)
Discussion started by: smallman
1 Replies

5. UNIX for Advanced & Expert Users

bash_profile or .profile

Hi, happy new year. on AIX 6.1 , for user oracle , there are two files : bash_profile and .profile I do not know which one is executed when login ? How to know , More over in both of them we have : in .profile : ORACLE_HOME=/appli/oracle/product/10.2.0/db_1... (5 Replies)
Discussion started by: big123456
5 Replies

6. Red Hat

.bash_profile file corrupted

Hi, Unexpectedly i entered wrong entries in .bash_profile for my user which has administrative permissions. So, i am getting errors for every command. I dont have backup file also, so any body can help me how to recover it. Regards, Mastan (7 Replies)
Discussion started by: mastansaheb
7 Replies

7. Shell Programming and Scripting

Is there a way to organize bash_profile across different platforms

I want to have one .bash_profile works on multiple platform, ubuntu, debian, redhat, cygwin, osx. So how should I organize .bash_profile? It can be multiple files in some subdir Let me brief you: what i want is a way to organize bash_profile across platforms so I can use one set of profiles... (2 Replies)
Discussion started by: John_Peter
2 Replies

8. UNIX for Dummies Questions & Answers

Bash_profile versus bashrc

Hi All Please can you tell , what is the difference between bash_profile and bashrc. How to create them? (8 Replies)
Discussion started by: fretagi
8 Replies

9. UNIX for Dummies Questions & Answers

.bash_profile question

Hello everyone, I'm trying to set my .bash_profile to change my primary prompt from this: banbatchtest1v:MCPPRD:~>to this: banbatchtest1v:MCPPRD:/home/rcarvall> Here's what my .bash_profile looks like right now: # .bash_profile # Get the aliases and functions if ; then .... (2 Replies)
Discussion started by: galileo1
2 Replies

10. Linux

Renaming .bash_profile to .profile

Hi Gurus, Recently we have migrated our servers from AIX to Linux. Most of the scripts written in AIX server are sourcing environment variables using .profile file. Now we have the following options: 1. Change all the scripts where ever .profile is being used and replace it with... (14 Replies)
Discussion started by: svajhala
14 Replies
LESSOPEN(1)						      General Commands Manual						       LESSOPEN(1)

NAME
lessfile, lesspipe - "input preprocessor" for less. SYNOPSIS
lessfile, lesspipe DESCRIPTION
This manual page documents briefly the lessfile, and lesspipe commands. This manual page was written for the Debian GNU/Linux distribution because the input preprocessor scripts are provided by Debian GNU/Linux and are not part of the original program. lessfile and lesspipe are programs that can be used to modify the way the contents of a file are displayed in less. What this means is that less can automatically open up tar files, uncompress gzipped files, and even display something reasonable for graphics files. lesspipe will toss the contents/info on STDOUT and less will read them as they come across. This means that you do not have to wait for the decoding to finish before less shows you the file. This also means that you will get a 'byte N' instead of an N% as your file posi- tion. You can seek to the end and back to get the N% but that means you have to wait for the pipe to finish. lessfile will toss the contents/info on a file which less will then read. After you are done, lessfile will then delete the file. This means that the process has to finish before you see it, but you get nice percentages (N%) up front. USAGE
Just put one of the following two commands in your login script (e.g. ~/.bash_profile): eval "$(lessfile)" or eval "$(lesspipe)" FILE TYPE RECOGNITION
File types are recognized by their extensions. This is a list of currently supported extensions (grouped by the programs that handle them): *.a *.arj *.tar.bz2 *.bz *.bz2 *.deb, *.udeb *.doc *.gif, *.jpeg, *.jpg, *.pcd, *.png, *.tga, *.tiff, *.tif *.iso, *.raw, *.bin *.lha, *.lzh *.tar.lz, *.tlz *.lz *.7z *.pdf *.rar, *.r[0-9][0-9] *.rpm *.tar.gz, *.tgz, *.tar.z, *.tar.dz *.gz, *.z, *.dz *.tar *.jar, *.war, *.xpi, *.zip *.zoo USER DEFINED FILTERS
It is possible to extend and overwrite the default lesspipe and lessfile input processor if you have specialized requirements. Create an executable program with the name .lessfilter and put it into your home directory. This can be a shell script or a binary program. It is important that this program returns the correct exit code: return 0 if your filter handles the input, return 1 if the standard lesspipe/lessfile filter should handle the input. Here is an example script: #!/bin/sh case "$1" in *.extension) extension-handler "$1" ;; *) # We don't handle this format. exit 1 esac # No further processing by lesspipe necessary exit 0 FILES
~/.lessfilter Executable file that can do user defined processing. See section USER DEFINED FILTERS for more information. BUGS
When trying to open compressed 0 byte files, less displays the actual binary file contents. This is not a bug. less is designed to do that (see manual page less(1), section INPUT PREPROCESSOR). This is the answer of Mark Nudelman <markn@greenwoodsoftware.com>: "I recognized when I designed it that a lesspipe filter cannot output an empty file and have less display nothing in that case; it's a side effect of using the "no output" case to mean "the filter has nothing to do". It could have been designed to have some other mechanism to indicate "nothing to do", but "no output" seemed the simplest and most intuitive for lesspipe writers." Sometimes, less does not display the contents file you want to view but output that is produced by your login scripts (~/.bashrc or ~/.bash_profile). This happens because less uses your current shell to run the lesspipe filter. Bash first looks for the variable $BASH_ENV in the environment expands its value and uses the expanded value as the name of a file to read and execute. If this file produces any out- put less will display this. A way to solve this problem is to put the following lines on the top of your login script that produces output: if [ -z "$PS1" ]; then exit fi This tests whether the prompt variable $PS1 is set and if it isn't (which is the case for non-interactive shells) it will exit the script. SEE ALSO
less(1) AUTHOR
This manual page was written by Thomas Schoepf <schoepf@debian.org>, for the Debian GNU/Linux system (but may be used by others). Most of the text was copied from a description written by Darren Stalder <torin@daft.com>. LESSOPEN(1)
All times are GMT -4. The time now is 02:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy