I have 2 files test.part1.rar and test.part2.rar
When extracting them using command
7z x -o* test.part1.rar
The output directory is a folder with test.part1 name
I want the output directory to be a folder with name test (archive name without '.part1')
From 7z documantation
-o{dir_path}
{dir_path}
This is the destination
directory path. It's not required to end with a backslash. If you specify * in {dir_path}, 7-Zip substitutes that * character to archive name.
Maybe using parameter expansion will do what you seek.
You may want to use the 7z e command if you don't want to extract with the full paths within the archive.
The
*can be used within the output directory to be replaced by the archive name. It doesn't sound like you need that.