A
A
Anatoly2019-01-14 13:03:40
bash
Anatoly, 2019-01-14 13:03:40

Is there a function that displays the current directory?

Is there a function that displays the current directory, such as pwd.
The problem is, is it possible to optimize this:

for y in `find / -name "*_test.jpg" `;do
  x=`basename $y`
  echo ${y:: -${#x}}
done

those. now the task is solved so, and everything works. Is there a function like basename but for a folder?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Ratkin, 2019-01-14
@Tolly

If I understand correctly, then

for y in `find / -name "*_test.jpg" `;do
  file=$(basename "$y")
  dir=$(dirname "$y")
done

And, these are not functions, but unix utilities.

V
Viktor Taran, 2019-01-14
@shambler81

https://google.gik-team.com/?q=%D1%82%D0%B5%D0%BA%...
pwd

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question