0

I have a bash script (script.sh) that acts on a file called 12345.txt that currently produces an output file named "12345.txt_output":

Command line:

bash script.sh 12345.txt

Last line of script.sh:

> "${1}_output" 

How do I change the output command (while still using $1) to name the file 12345_output (instead of 12345.txt_output)?

1 Answer 1

1

bash string functions

> "${1%.*}_output" 
Sign up to request clarification or add additional context in comments.

1 Comment

karakfa to the rescue!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.