unhide unix files in SOLARIS

I have a SOLARIS UNIX folder that has files, both hidden and visible

[root@hermes test]# ls -Al
total 0
-rw-r--r--. 1 root root 0 Oct  9 09:48 .test1
-rw-r--r--. 1 root root 0 Oct  9 09:48 .test2
-rw-r--r--. 1 root root 0 Oct  9 09:57 test3
-rw-r--r--. 1 root root 0 Oct  9 09:57 test4
[root@hermes test]#

Open in new window

Is there a way, in a bash script to "unhide" test1 and test2?
Evan CutlerVolunteer Chief Information OfficerAsked:
Who is Participating?
arnoldConnect With a Mentor Commented:
Before going any further, what is the issue you are looking to address?

Here is an example.
ls -a| grep '^\.'| sed -e 's/^.//' | while read a; do
mv ".$a" "$a"
Rename them from .test1 to test1 and similarly for .test2.
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
Thank you so much,
What I'm looking to do is try to this en masse in a shell script.
So, let's say I have four hidden files, I need to "unhide" all four in a script.
The filenames are dynamic.

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

skullnobrainsConnect With a Mentor Commented:
rename in batch

find . -name .\* | sed 's,^\(.*\)/\.\([^/]*\)$,mv "\1/.\2" "\1/\2",' | sh

but renaming hidden files might break lots of working stuff and instructing your file browser to display hidden files is trivial. likewise you can alias ls="ls -a" so hidden files are not hidden any more on the command line.
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
so I have a folder, where another machine drops files into that folder.
It's the first line of defense for receiving files as the machine is from an outside entity.

For some reason, we are receiving hidden files from that machine.
files that start with the period(.).

test3, etc....

This folder is where I do checks to see what I want to process, and throw out the rest.
most commands ignore the hidden files.

I want to make sure they are not something I shouldn't have...
therefor, I need to "unhide" those, so I can do my work against them.

That's what's going on....on SOLARIS
most commands ignore the hidden files

yes : but they usually provide switches that will instruct them not to ignore hidden files

if needed i'll help you to figure out how to change any existing code to deal with hidden files properly

if not, both arnold and myself gave proper batch renaming code that will work properly on solaris. ask if there is anything these commands do that you do not understand or post back if something does not work as expected including which solaris version and which shell you are using. both are supposed to be run in the directory where those files reside. mine is recursive.
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
Thank you very much.
I will go ahead and award points on this.
If I have further questions, I will as for more.
feel free to post in this thread if they relate
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.