linuxgurugamer / SXTContinued

Lack's Stock eXTension
Other
17 stars 26 forks source link

Bash script to copy files does not work. #83

Open Ruedii opened 2 years ago

Ruedii commented 2 years ago

The bash script to copy files does not work.

Here is the console output:

/n/nThis batch file will copy the missing textures from the inaccessable
Squad/zDeprecated directory 
/n/n
Press return to continue

./BashCopyTextures.sh: line 17: [: too many arguments
./BashCopyTextures.sh: line 18: cd: too many arguments
cp: cannot stat '../../Squad/zDeprecated/Parts/FuelTank/fuelTankT800_v1/model000.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/FuelTank/fuelTankT800_v1/model001.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/FuelTank/fuelTankT400_v1/model000.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/FuelTank/fuelTankJumbo-64/model000.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/FuelTank/fuelTankJumbo-64/model001.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/Structural/Size3Decoupler/decoupler_and_adaptor_cm.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/FuelTank/fuelTankX200-32/model000.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/FuelTank/fuelTankX200-32/model001.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/Aero/protectiveRocketNoseMk7_v1/model000.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/Command/probeStackSphere_v1/model000.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/Engine/liquidEngine48-7S_v1/*.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/Engine/liquidEngineSkipper_v1/*.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/Utility/dockingPort_v1/*.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/Utility/dockingPortSr_v1/*.dds': No such file or directory
cp: cannot stat '../../Squad/zDeprecated/Parts/Utility/rcsBlockRV-105_v1/rcs.dds': No such file or directory
/n/nThe files have been copied/n
Press return to continue

From what I can tell, the operation to change directory is failing. It might be better to presume that you are in the SXT directory, and work relative to there with fixed values instead of using a variable.

linuxgurugamer commented 2 years ago

Please post on the forum and not here, this is not a support site.

You also didn't give any other information, so it's rather hard to know whats going on

Ruedii commented 2 years ago

I'm sorry if I was not clear. I'm not seeking support. I'm reporting that the bash script is broken. It's reporting syntax errors from bash which is a bug.

Most notable are the two syntax errors:

./BashCopyTextures.sh: line 17: [: too many arguments
./BashCopyTextures.sh: line 18: cd: too many arguments

There is no way that a script giving these errors would be a system specific issue, or a need for support.

This is the script you run to copy the files. Have you tested the script? I gave you the logs, there are obviously syntax errors in the script file. I executed it as the readme instruction files. While in GameData/SXT I execute the script with "bash BashCopyTextures.sh"

All relevant information: GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu)

The KSP version is latest installed from Steam SXT was installed via CKAN.

Only the bash version could be responsible for any syntax errors. The output of BASH is in the first post.

linuxgurugamer commented 2 years ago

Yes, I did test it using Cygwin.

Is the command "dirname" installed on your system? If not, it won't work, that line needs that command.

What kind of OS do you have installed? and how is it installed (ie: if you remember, what options did you use to install it)?

What's the default shell that is running the script? It's a bash script, I don't know if it will work using any other shell.

If you aren't sure, then add the following line near the top of the script (after the "clear" line) and let me know:

echo $SHELL

Ruedii commented 2 years ago

I gave you the log, it is clear that "dirname" is executing properly.

According to the two lines there are spaces in the shell script where there shouldn't be. This is what "too many arguments" means.

The errors are on the "[" function and the "cd"

I have no clue why you are using a complex function in the line with the "[" function.

There are also several other places where there are simpler, more fault-tolerant, ways to do things.