LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 853|回复: 3

请问如何修改脚本的工作目录

[复制链接]
发表于 2006-1-8 21:29:06 | 显示全部楼层 |阅读模式
假如脚本在目录A, 脚本里的程序在目录B,而程序必须在B才能执行,而脚本也必须要求在A
请问如何解决该问题
for example:


#!/bin/sh
#somescript in the A directory
#someprogram in the B directory
someprogram   parameter1  parameter2


then when I excute somescript, the A directory is set as the working directory,
whereas someprogram in B directory cann't be done

Please tell me how to resolve this problem

thanks a lot
 楼主| 发表于 2006-1-8 22:40:46 | 显示全部楼层
最好不要设置环境变量

而且好像环境变量跟这个没有太大关系吧

3x
回复 支持 反对

使用道具 举报

发表于 2006-1-9 23:07:16 | 显示全部楼层
Post by nfs21cn
假如脚本在目录A, 脚本里的程序在目录B,而程序必须在B才能执行,而脚本也必须要求在A
请问如何解决该问题
for example:


#!/bin/sh
#somescript in the A directory
#someprogram in the B directory
someprogram   parameter1  parameter2


then when I excute somescript, the A directory is set as the working directory,
whereas someprogram in B directory cann't be done

Please tell me how to resolve this problem

thanks a lot


脚本里cd到B然后执行就行。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-1-10 09:23:38 | 显示全部楼层
It's ok
thanks a lot
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表