Missing period files in ksh


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Missing period files in ksh
# 1  
Old 10-29-2014
Linux Missing period files in ksh

Hi Guys Smilie

while trying to set the paths for Oracle, sqlplus etc. I have been trying to find dot files (.profile or .kshrc or .bashrc or .cshrc or .login or .bash_profile or similar files) to append new paths so that I can connect to oracle from a shell script (RedHat 6.3 with KSH shell). But I am not able to find out any of above files.

Could someone please help me on how come none of these files are present there at my home directory Smilie and what shall I do in this case Smilie
# 2  
Old 10-29-2014
How have you been trying to find them?
Any of the following commands would show you all files in the current directory with names starting with a period:
Code:
ls -d .*
printf '%s\n' .*

The following command will list all files in the current directory:
Code:
ls -a

And, the following command will list all regular files in the file hierarchy rooted in the current directory:
Code:
find . -type f

Note that files like .profile, .kshrc, .bashrc, .cshrc, .login, and .bash_profile do not exist in every directory; they only appear in a user's home directory.
# 3  
Old 10-29-2014
Thanks for the commands but I had tried all these options (obviously in home directory) but there is no sign of .profile or .login files. These are the only files coming as result of ls -d .* ->
. .. .bash_history .sh_history .snapshot

I have been thinking about creating new profile file but I'm scared if it overwrote any of the existing paths so don't want to take chances.
On top of it, still confused why these files are not available and how the shell is working properly. Is there something which I am not aware of..!
# 4  
Old 10-29-2014
Depending on how your system admin set up your account not all or even any of those files will exist. The shell does NOT need them!
Give it a try: create the one for your shell containing a single command like echo "my profile" and login. If that works, try sth like PATH=$PATH":newpathelement" and check the PATH variable afterwards.
# 5  
Old 10-29-2014
ksh does not use a .kshrc file, but the environment variable ENV.
Create a .kshrc file with a 1st line
Code:
echo hello .kshrc

and put the following in the .profile:
Code:
#ksh reads this startup file:
ENV=$HOME/.kshrc; export ENV

You will find that each interactive ksh reads the .kshrc first; a ksh login shell reads .kshrc after .profile.
# 6  
Old 10-29-2014
Quote:
Originally Posted by Pradeep Jangra
Thanks for the commands but I had tried all these options (obviously in home directory) but there is no sign of .profile or .login files. These are the only files coming as result of ls -d .* ->
. .. .bash_history .sh_history .snapshot

I have been thinking about creating new profile file but I'm scared if it overwrote any of the existing paths so don't want to take chances.
On top of it, still confused why these files are not available and how the shell is working properly. Is there something which I am not aware of..!
Are you sure you're using ksh? To get a .bash_history file, you had to have used bash as an interactive shell at some time.

If you look at the man page for your shell on your system, you'll probably find a section on startup files or initialization files. There is probably something like /etc/profile that contains common initiaization settings created for all ksh users on your system by your system's administrator. If you need more specialized settings or want to override the defaults you sysadmin created, then you need to create your own $HOME/.profile file.
# 7  
Old 10-29-2014
Quote:
Originally Posted by MadeInGermany
ksh does not use a .kshrc file, but the environment variable ENV.
Create a .kshrc file with a 1st line
Code:
echo hello .kshrc

and put the following in the .profile:
Code:
#ksh reads this startup file:
ENV=$HOME/.kshrc; export ENV

You will find that each interactive ksh reads the .kshrc first; a ksh login shell reads .kshrc after .profile.
It is a bit more complicated than that. It depends on if the shell is a login or an interactive shell. From the current ksh93 manpage:
Quote:
If the shell is invoked by exec(2), and the first character of argument zero ($0) is -, then the shell is assumed to be a login shell and commands are read from /etc/profile and then from either .profile in the current directory or $HOME/.profile, if either file exists. Next, for interactive shells, commands are read from the file named by performing parameter expansion, command substitution, and arithmetic substitution on the value of the environment variable ENV if the file exists. If the -s option is not present and arg and a file by the name of arg exists, then it reads and executes this script. Otherwise, if the first arg does not contain a /, a path search is performed on the first arg to determine the name of the script to execute. The script arg must have execute permission and any setuid and setgid settings will be ignored. If the script is not found on the path, arg is processed as if it named a built-in command or function.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Error in ksh script: missing right bracket

I have no idea how to write ksh script, but i'm really in need of help with this. I using fedora 30 and in attempt of runnig attached script i getting those errors, i solved first error by removing excess bracket, but i do not know what should i do with other. Pls sorry for trash post. (8 Replies)
Discussion started by: NullPtr
8 Replies

2. Shell Programming and Scripting

Line count of trace files for 24 period

Hi, Using solaris 10 5.10 o/s I am learning awk as I work here on the job. What I need to do is isolate the trace file for the last 24 hours. After that I need to open those trace files and search for 'TNS-|ORA-' message from each one. These trace files MAY HAVE an occurance of them. I... (5 Replies)
Discussion started by: bdby
5 Replies

3. Shell Programming and Scripting

To get the Files between Time Period

All, How to get the list of files through a unix command which exists / created / updated between 8 PM to 11:59 PM from a particular location. Regards Oracle User (3 Replies)
Discussion started by: Oracle_User
3 Replies

4. Shell Programming and Scripting

How to take the missing files

Hi all , am using unix ksh I have a lots of files in /prb directory in the format as .. .. .. .. MMRR0607.DAT_2012 MMRR0707.DAT_2012 MMRR0907.DAT_2012 MMRR1107.DAT_2012 ... .. MMRR3107.DAT_2012 MMRR0208.DAT_2012 .. I need the output as Missing files are:- MMRR0807.DAT_2012 (note... (4 Replies)
Discussion started by: Venkatesh1
4 Replies

5. Shell Programming and Scripting

Removal of files/folders created during a period of time

Hi, I have some folders (containing files) which gets created daily and names start with 'TT_' . I would like to remove these folders every month end. Could you please provide me the commands and also the syntax to schedule through crontab. Thanks, Archana (3 Replies)
Discussion started by: archana.n
3 Replies

6. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

7. UNIX for Dummies Questions & Answers

Help with command to find all newly created files in a given time period

Hi all! Can someone please help me create a command to accomplish the following task. I have a parent directory called ex. /var/www/parent and it has a bunch of sub-directories called /var/www/parent/1, var/www/parent/1/xyz/ and etc. What I would like to do is to count the number of files... (2 Replies)
Discussion started by: bbzor
2 Replies

8. Shell Programming and Scripting

ksh/awk help - output missing numbers

Here is what I am trying to do: I have a list of numbers that I pulled from an awk command in a column like so: 1 3 4 7 8 I want to find which numbers in the list are missing out of a range. So let's say I want to find out from the list above which numbers are missing from the... (6 Replies)
Discussion started by: afavis
6 Replies

9. Shell Programming and Scripting

UNIX Shell script to chec timeout period when collecting files in directory - HELP

Hi, I have a shell script which is to perform a check if all 4 particular type of files exists in a directory. If ALL 4 files are present within a specific Timeframe, then tar these files and zip it. If not all 4 files are present in the directory after the specific timeframe, then tar... (1 Reply)
Discussion started by: Danny Fang
1 Replies

10. UNIX for Dummies Questions & Answers

files missing

a few of some live payroll files have been deleted / missing ... i've restored last nites backup ... what could be the possibilities of this strange occurance ... users have menus to work on and use these live files ... we run an aix box with a ksh shell. Where do I start ?? Thanks (4 Replies)
Discussion started by: cubicle^dweller
4 Replies
Login or Register to Ask a Question