[bash] Manipulate dir name

Hi

as output i get a directory (i don't know its name) with many files inside.
Now i need to find the directory name and change it as i need.

I can found a directory name with this command:

find -maxdepth 1 -type d | grep out

Now i'd like to assign it to a variable and change it.
for example (i know that's not correct) something like:

if the directory name is "dir.out"

name=find -maxdepth 1 -type d | grep out

#now name=dir.out and i change it as a string

name[0]=k
#now name should be name=kir.out

Can anyone suggest a solution

thanks

D

What do you know about the directory that is created?

  • Is it always in the same root directory?
  • Does it always contain a file name that you can predict?
  • Is it owned by a unique user or group?

Hi

thanks for reply.

about your questions

The directory change accordly the date and time .
Yes is always in the same directory.
I can control the permits and who owned the dir.

I'm trying to solve the problem also with python.

D.

Before advancing into variables, can you run the command below to achieve your expected result?

mv `find -maxdepth 1 -type d | grep out` kir.out

I solved the problem.
I Added some flag to the C program, in order to give me the directory name i need.

Thanks for help