â$(basename â$fâ .sh).mdâ and â$fâ â$f%.txt.shâ
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'd like to change extensions of multiple files, I learned two methods:
$ ls
bath.md breakfast.md brush.md test.sh
Solution 1:
# Rename all *.md to *.sh
for f in *.md
do
mv "$f" "$f%.txt.sh"
done
Solution 2:
#Rename all *.md to *.sh
for f in *.sh
do
mv "$f" "$(basename "$f" .sh).md"
done
Personally, I prefer the programming solution, except it's trick of %
in "$f%.txt.sh" and .sh).md
in "$(basename "$f" .sh).md"
I searched for rename extensions which return more tricky answers without explanations.
Could you please give a hint?
bash
New contributor
add a comment |Â
up vote
0
down vote
favorite
I'd like to change extensions of multiple files, I learned two methods:
$ ls
bath.md breakfast.md brush.md test.sh
Solution 1:
# Rename all *.md to *.sh
for f in *.md
do
mv "$f" "$f%.txt.sh"
done
Solution 2:
#Rename all *.md to *.sh
for f in *.sh
do
mv "$f" "$(basename "$f" .sh).md"
done
Personally, I prefer the programming solution, except it's trick of %
in "$f%.txt.sh" and .sh).md
in "$(basename "$f" .sh).md"
I searched for rename extensions which return more tricky answers without explanations.
Could you please give a hint?
bash
New contributor
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'd like to change extensions of multiple files, I learned two methods:
$ ls
bath.md breakfast.md brush.md test.sh
Solution 1:
# Rename all *.md to *.sh
for f in *.md
do
mv "$f" "$f%.txt.sh"
done
Solution 2:
#Rename all *.md to *.sh
for f in *.sh
do
mv "$f" "$(basename "$f" .sh).md"
done
Personally, I prefer the programming solution, except it's trick of %
in "$f%.txt.sh" and .sh).md
in "$(basename "$f" .sh).md"
I searched for rename extensions which return more tricky answers without explanations.
Could you please give a hint?
bash
New contributor
I'd like to change extensions of multiple files, I learned two methods:
$ ls
bath.md breakfast.md brush.md test.sh
Solution 1:
# Rename all *.md to *.sh
for f in *.md
do
mv "$f" "$f%.txt.sh"
done
Solution 2:
#Rename all *.md to *.sh
for f in *.sh
do
mv "$f" "$(basename "$f" .sh).md"
done
Personally, I prefer the programming solution, except it's trick of %
in "$f%.txt.sh" and .sh).md
in "$(basename "$f" .sh).md"
I searched for rename extensions which return more tricky answers without explanations.
Could you please give a hint?
bash
bash
New contributor
New contributor
New contributor
asked 1 min ago
avirate
34429
34429
New contributor
New contributor
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
avirate is a new contributor. Be nice, and check out our Code of Conduct.
avirate is a new contributor. Be nice, and check out our Code of Conduct.
avirate is a new contributor. Be nice, and check out our Code of Conduct.
avirate is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478210%2fbasename-f-sh-md-and-f-f-txt-sh%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password