Computing.Net > Forums > Unix > need it badly

need it badly

Reply to Message Icon

Original Message
Name: atifharun
Date: March 28, 2005 at 03:16:08 Pacific
Subject: need it badly
OS: Windows & Linux
CPU/Ram: 246
Comment:

I have two function in a shell script in bash and from one of these function i need to call another script...any idea how to do that??

Cheers-
Atif


Report Offensive Message For Removal


Response Number 1
Name: David Perry
Date: March 28, 2005 at 04:49:18 Pacific
Subject: need it badly
Reply: (edit)

Does sourcing the file work?

. /some/other/script


Report Offensive Follow Up For Removal

Response Number 2
Name: atifharun
Date: March 28, 2005 at 05:45:42 Pacific
Subject: need it badly
Reply: (edit)

Thanks David for ur reply..sorry that the sourcing not working...any other ideas.. have two recursive functions in a shell script in bash and from one of these function i need to call another script...any idea how to do that??
Cheers-



Report Offensive Follow Up For Removal

Response Number 3
Name: Jim Boothe
Date: March 28, 2005 at 15:23:56 Pacific
Subject: need it badly
Reply: (edit)

I guess I do not understand the issue. To call another script, just run it from within your function. Why does that not work?


Report Offensive Follow Up For Removal

Response Number 4
Name: atifharun
Date: March 28, 2005 at 16:40:59 Pacific
Subject: need it badly
Reply: (edit)

Hi Nails,
Thanks a lot for your kind reply.


Hi Guys,
Here is the details what i am trying to do.What I am trying to do is i have made a script in bash called search.sh which recursively goes through the directories and finds any pattern of files and for this i have made two functions one for the matching files and one for searching the directories recursively.
I have another script called permissions.sh which checks the file's or directorie's permissions and changes it if the input permission is not matched.

Now i need to call permissions.sh from search.sh.Please give me suggestion how to do sourcing...whats the command..

Thanks a lot again....
Regards
Atif


Report Offensive Follow Up For Removal

Response Number 5
Name: gurubit
Date: March 29, 2005 at 01:49:01 Pacific
Subject: need it badly
Reply: (edit)

I guess you are passing the file or directory as argument to the permissions.sh which changes the permission if it is not set.
As others told, try to use the full path of the file inside the script and you should be able to execute.

Else you can use the following alternative.

Use find command to list the directories as well as files as below. It gives you the full list recursively under the directory.

find <DIRNAME> -type f,d -print

Use the output of the above in a loop and check for the permission and set it.

find also has the option for checking the permission using -perm option.

If you want to use the -perm option, then in a single command you can also set the file permission if it doesn't match.

Use the command as below:

find <DIRNAME> -type f,d -perm <PERMS> | xargs chmod <NEWPERMS>

Example:

find ./ -type f,d -perm 644 | xargs chmod 755

The above command will set all the files and directories permission in the current directory matching 644 permission to 755. You can use it for other permission levels.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: need it badly

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge