Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 将各种bash命令转换为tcsh_Linux_Bash_Shell_Unix_Tcsh - Fatal编程技术网

Linux 将各种bash命令转换为tcsh

Linux 将各种bash命令转换为tcsh,linux,bash,shell,unix,tcsh,Linux,Bash,Shell,Unix,Tcsh,我正在尝试将一些.bash_配置文件转换为兼容的,或者在tcsh环境中工作。以下是我想翻译/转换的内容: # Define the IDL base path # Note: I actually source a setup routine that defines these, but if they # are not found, I have the IF statement below to handle that export IDL_LOC ; IDL_

我正在尝试将一些.bash_配置文件转换为兼容的,或者在tcsh环境中工作。以下是我想翻译/转换的内容:

#  Define the IDL base path
#  Note:  I actually source a setup routine that defines these, but if they
#           are not found, I have the IF statement below to handle that
export IDL_LOC ; IDL_LOC=/Applications/itt/idl
export IDL_DIR ; IDL_DIR=/Applications/itt/idl71

unset IDL_PATH
if [ ${IDL_DIR:-0} != 0 ] ; then
  export IDL_PATH ; IDL_PATH=$IDL_DIR
  ##  Make sure to recursively search subdirectories
  IDL_PATH=${IDL_PATH}:$(find $IDL_DIR -type d | tr '\n' ':' | sed 's/:$//')
  ##  Add my directories  (extra routines that you probably won't need)
  IDL_PATH=$IDL_PATH:+.:+$HOME/example/directory/one
else
  export IDL_PATH ; IDL_PATH=:+.:+/example/directory/two:+$HOME/example/directory/one
fi

################################################################################
# Set up a function
function themis {
   # unset the IDL_PATH to avoid potential conflicts... (kludgy, I know)
   unset IDL_PATH
   #  Define the TDAS path
   export EXAMPLE_PATH_1=/example/directory/three
   #  source the setup IDL file
   source ${IDL_LOC}/bin/idl_setup.bash
   #  source the another setup paths
   source $EXAMPLE_PATH_1/example/directory/four/setup_file.bash
   #  start IDL (i.e., a programming language environment)
   idl
   #  redefine defaults upon exit from IDL
   source $HOME/.bash_profile
}
我并没有被setenv和export之间的差异弄糊涂,而是对一些事情的实现感到困惑。例如:

1) 我可以不使用递归搜索语法(即find命令)吗

2) 如何将目录连接到tcsh中已定义的环境变量上

3) 连接是否与bash中的相同

4) 我可以从tcsh中获取bash文件吗

5) 如果该函数可以转换为别名,那么如何分离各种命令,以便按顺序执行所有命令

6) 是否有一个等效的。tcsh中的命令(即当前工作目录)


非常感谢您的帮助。

tcsh
没有函数,您无法翻译。尽管函数不带任何参数,但您可以将其转换为别名。脚本的第一部分有什么问题?难道你不知道
setenv
是如何设置环境变量的,类似于bash中的
export
。@Barmar,我对setenv和export之间的区别并不感到困惑,而是对一些事情的实现感到困惑。例如,我可以不使用递归搜索语法吗?如何将目录连接到tcsh中已定义的环境变量上?与bash中的相同吗?我可以从tcsh中获取一个bash文件吗?最好是在问题中提出这些具体问题,而不是向我们抛出大量代码并要求翻译。