![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To give the "unzip" permissions & "create" file permissions | Mike1234 | HP-UX | 3 | 03-02-2008 05:34 PM |
| execute a .jil file | OSD | Shell Programming and Scripting | 4 | 10-05-2007 12:20 AM |
| execute a .jil file | OSD | UNIX for Advanced & Expert Users | 1 | 10-03-2007 05:11 AM |
| help with permissions - execute but not delete | reldb | UNIX for Dummies Questions & Answers | 2 | 06-01-2007 03:30 PM |
| Need to execute 2 scripts, wait, execute 2 more wait, till end of file | halo98 | Shell Programming and Scripting | 1 | 08-01-2006 04:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Please explain this strange behavior to me
Code:
bash-2.03$ ls -l abc -rw------- 1 bashboy users 319 Sep 21 18:02 abc bash-2.03$ ./abc bash: ./abc: Permission denied bash-2.03$ . abc Successfully run I wanted to ask how the file executes without the execute permissions when we source the file. Thank you |
|
||||
|
Quote:
Executing means "exec()" was called, which, in this case, is not the case. |
|
||||
|
Isnt this the same case, when a script without execute bit set and passed to the base shell as an argument ?
Code:
zsh script.zsh |
|
||||
|
Sourcing a script
Unix programming Learning the Korn Shell, p 25, O'Reilly
There are three ways to run a script in Korn Shell (ksh): 1) $ . scriptname Here you are running the script without creating a subshell, meaning that the new settings will be still in this shell after running the script. It's like copy/paste each line of the script in the shell. This is also called sourcing because in csh and tcsh this is executed by running: $ sourse scriptname. Also to run a script this way the script do not need execution permissions. 2) $ ./scritpname Run the script in a subshell, after the script executes the shell will not have the new settings. Script need execution permissions. 3) $ scriptname Run the script in a subshell, if . (current dir) is part of your cmd, searches in $PATH. The script needs execution permissions. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|