Visit Our UNIX and Linux User Community


test and .test in same directory


 
Thread Tools Search this Thread
Operating Systems Solaris test and .test in same directory
# 8  
Old 12-27-2007
Quote:
Originally Posted by vikashtulsiyan
buddy ls -a is for viewing hidden files. my question is that is there any way we can make ".file" a normal visible file.. one u can see wid ls command
a quick way to solve your prob is you can customize your .profile to add an ls alias which lists all files including hidden by default.
# 9  
Old 12-27-2007
1) to make the file visible. Please remove the . from the file name.
2) when you remove . the file name turns to file.
3) but there is already a file with the name "file".
4) So you have to rename the .file to some other name.

so try

mv .file file1

it should be working !!!

Thx,
Siva.
# 10  
Old 12-27-2007
I Hope there is no other soln. than renaming.
Because Unix directory does not supports 2 files with same name
so you can append a symbol like % infront of .file like %file
or you can rename to another file.
to make it visible.

Thx,
siva.
# 11  
Old 12-27-2007
In PC-DOS and hence OS/2 and Windows, hidden is an attribute of a directory entry.

In UNIX there is merely a convention to treat files with a leading period as hidden.
# 12  
Old 12-28-2007
Quote:
Originally Posted by porter
In PC-DOS and hence OS/2 and Windows, hidden is an attribute of a directory entry.

In UNIX there is merely a convention to treat files with a leading period as hidden.
Exactly! test and .test are totally different filenames. They have nothing to do with each other except that they are in the same filesystem and in the same directory.

Code:
bash-3.00# cd /tmp
bash-3.00# touch test .test
bash-3.00# ls -lid test .test
  37946100 -rw-r--r--   1 root     other          0 Dec 28 03:41 .test
  36778413 -rw-r--r--   1 root     other          0 Dec 28 03:41 test

As you can see, the inode numbers are different, making these different files, not representations of the same file.
# 13  
Old 12-28-2007
then doesnt it sound like an error in UNIX system. that we actually have to change file names to make them visible.

like suppose one installed program reads from the file /home/vik/impdata

then one day i find that i have confidential data in impdata and want to make it hidden. in that case. in that case that program too will stop working as the file name has changed.

some of you might think am dragging this issue a little too further but i really believe that this is not the correct way( rename) to make a file hidden
# 14  
Old 12-28-2007
It does not seem like an error in the filesystem to me.

Previous Thread | Next Thread
Test Your Knowledge in Computers #890
Difficulty: Easy
In sed, the REGEX dot (.) matches exactly one character.
True or False?

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Test if a script can cd into a directory

Is there a way for a bash script to test if it can cd into a directory without actually attempting to cd into it? I am looking for something along the lines of: if ;then #code to execute fi except in this case I don't want to test if the directory exists; what I want is to test... (8 Replies)
Discussion started by: dexdex200
8 Replies

2. Shell Programming and Scripting

Prefixing test case methods with letter 'test'

Hi, I have a Python unit test cases source code file which contains more than a hundred test case methods. In that, some of the test case methods already have prefix 'test' where as some of them do not have. Now, I need to add the string 'test' (case-sensitive) as a prefix to those of the... (5 Replies)
Discussion started by: royalibrahim
5 Replies

3. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

4. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

5. UNIX for Advanced & Expert Users

test if there are files in directory

Hi, I am trying to test if there are files in a directory and if theres i want to get a list. Any ideas? Thanks in advance (1 Reply)
Discussion started by: RSAM2007
1 Replies

6. HP-UX

How to test directory availibility

Hello, I'm trying to test if a directory specified in a script parameter is available or not. I wrote a little code to do so, but there's a problem because I receive an error message. My code: #Verify command parameter if then echo 'Incorrect command parameter' echo... (3 Replies)
Discussion started by: santuna
3 Replies

Featured Tech Videos