Jump to content

click execute file copy pls debug my file


derda
 Share

5 posts in this topic

Recommended Posts

on linux a bash script can be executed by a simply click. on osx $pwd seems messed ie files not found in: cp filea ../blbl/blbl/ when not executed alike ./script but with a click as *.command or *.sh

someone could fix my work below? i calculated 2 min and already spent moren than an hour on such ...:-(

Thanks

 

----------

tell application "Finder" to set f to POSIX path of ((container of (path to me)) as alias)

tell application "Terminal"

activate

set t to (make new terminal)

tell t

tell (make new session at the end of sessions)

do shell script "echo

echo Copying files

echo

sleep 5

 

cp -r -v &f&/a.txt &f&/../bl/blala/a.txt

exit 0"

end tell

end tell

end tell

Link to comment
Share on other sites

Thanks, but i get an error with that. "line 6 could not cd" or alike.

Yes simplest to only use bash? I only need to copy alike:

 

cp -r -v bla.txt ../Long\ Winglets/xx/plugins/b1/

 

any idea on how to handle $pwd difference on osx? (with a mouseclick on *.command)

Regards Michael

Link to comment
Share on other sites

many thanks. Regards

 

 

#!/bin/bash

echo ""

echo "Copying files"

sleep 1

 

# 2. for each file in the current directory listing

for file in `ls`

do

# 3. Skip it if it's a directory...

if [ -d $file ]

then

echo $file " is a directory."

else

if [ "$file" = "cfile.txt" ]; then

cp $file ../bl\ blbla/ccc/aaaeb/asbg

cp $file ../ee/dsdfadf/asdfasdfa

echo "Copying " $file

sleep 1

fi

if [ "$file" = "file3.ini" ]; then

cp $file ../dfaf\ bdds/S6sfsdfas/sdfsf/fsfsdf

echo "Copying " $file

sleep 1

fi

fi

done

Link to comment
Share on other sites

 Share

×
×
  • Create New...