You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error you are encountering is due to incorrect syntax in the script. It seems that the script is trying to compare strings using the == operator, which is not supported by the sh shell. Instead, you should use the = operator to compare strings.
Here is the corrected script:
#!/bin/bashset -e
DIFFS_DIR="ldap-overleaf-sl/sharelatex_diff"
ORI_DIR="ldap-overleaf-sl/sharelatex_ori"
PATCHED_DIR="ldap-overleaf-sl/sharelatex"fordiff_filein"$DIFFS_DIR"/*.diff;do
filename=$(basename "$diff_file"".diff")if [ "$filename"=".gitkeep" ];thencontinuefi
original_file="$ORI_DIR/$filename"
patched_file="$PATCHED_DIR/$filename"if [ -f"$original_file" ];then
cp "$original_file""$patched_file"
patch "$patched_file""$diff_file"elseecho"No original file for $filename in $ORI_DIR."fidone
Explanation of Corrections:
Comparison Operator:
Replaced == with = in the line if [ "$filename" = ".gitkeep" ]; then.
Shebang:
Ensure the script uses #!/bin/bash to guarantee it is interpreted by Bash, which supports array syntax and other advanced shell features.
How to Run the Script:
To run the script, use the bash command instead of sh:
sudo bash scripts/apply_diffs.sh
This ensures that the script is interpreted by Bash, which supports array syntax and other advanced shell features.
Verification of Patches:
To verify if the patches were applied correctly, you can compare the original files with the patched files. For example, you can use the diff command to compare the files:
diff "$ORI_DIR/$filename" "$PATCHED_DIR/$filename"
If the patches were applied correctly, you should see the differences between the original files and the patched files.
The text was updated successfully, but these errors were encountered:
Using Ubuntu Budgie
The error you are encountering is due to incorrect syntax in the script. It seems that the script is trying to compare strings using the == operator, which is not supported by the sh shell. Instead, you should use the = operator to compare strings.
Here is the corrected script:
Explanation of Corrections:
Comparison Operator:
Replaced == with = in the line if [ "$filename" = ".gitkeep" ]; then.
Shebang:
Ensure the script uses #!/bin/bash to guarantee it is interpreted by Bash, which supports array syntax and other advanced shell features.
How to Run the Script:
To run the script, use the bash command instead of sh:
sudo bash scripts/apply_diffs.sh
This ensures that the script is interpreted by Bash, which supports array syntax and other advanced shell features.
Verification of Patches:
To verify if the patches were applied correctly, you can compare the original files with the patched files. For example, you can use the diff command to compare the files:
diff "$ORI_DIR/$filename" "$PATCHED_DIR/$filename"
If the patches were applied correctly, you should see the differences between the original files and the patched files.
The text was updated successfully, but these errors were encountered: