• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Question Unix - Changing directory from within a script

HikingLife

Junior Member
Hi,

This is a unix bash shell scripting question.

I have been trying to execute the below command by changing directory and then copying contents of one directory to another by doing some file name manipulations in between. However this isnt working since as soon as the statement completes it goes back to the original folder. Can someone help in telling me how to change a directory in a script so I can execute subsequent steps within it using and modifying a variable through the steps.

This fine works from command line, however gives bad substitution error from the script because of the issue explained above

for file in ABC/DEF/*.done; do file="${file%.*}"; file="${file##*.}"; cp "${file:0:31}"*.* /ABC/EDG/; done
 
Back
Top