这个是简单的代码 #!/bin/sh # func1 #function hello () hello() { echo "Hello there todays date is" } echo "now going to the function hello" hello echo "back from the function" 这个是出错的显示,有没有高人指点一下? 'unc1.txt: line 4: syntax error near unexpected token ` 'unc1.txt: line 4: `hello()
请问KSH中是否有将文件中的数据导入表中的函数,将表中的数据导入文件的函数,两个文件进行差分的函数,如果哪位高人知道请指教,放几个例子上来,谢了
大家在使用linux时,相信只要进入一个目录,十有八九都会敲ls来显示当前目录里的文件。所以为什么不写一个小函数来实现“进入一个目录后,马上自动执行ls”的操作呢。 我们自己写个shell函数,暂取名为cdls(),如下: $cdls() { cd $1; ls; } 大家可以把它直接放在命令行里试试。如果想永远生效,就把这个函数放在用户的配置文件.bash_profile里。
问一个在linux下用system函数调用一个shell命令或应用程序的问题。 我现在用c语言编了一个程序: 比如:int i = system("snort -vde "); 现在snort程序已经在运行,但我现在想通过c编程实现停止snort的运行。但我不想通过ps、kill这类shell命令来实现,请问各位有什么好的解决方法吗?谢谢!!!
#!/bin/bash #func2 char_name() { _LETTERS_ONLY =$1 #4 _LETTERS_ONLY =`echo $1|awk '{if($1 ~/^[a-z A-Z]/)print "1"}'`#5 if test "$_LETTERS_ONLY" != "" then return 1 else return 0 fi } name_error() { echo "$@ contains errors,it must be contain only letters!" } while : do echo -n "what is your first...
ssftp@ch407bk : /tmp/zx > more fun1 hello () { echo "today is `date`" } hello 运行fun1 可以得到结果 我看书上写道可以运行hello ,也可以得到结果,但必须把此函数迁入到shell中,怎么嵌入呢?怎么嵌出呢? 我知道unset可以迁出。但我想知道具体的语句,谢谢
我有一个FTP上传脚本。 echo "ftp upload" ftp -inv << EEND open 192.168.1.04 user username passwd binary prompt off put $filename 这样是正常的,可以正常上传文件。 我想把这段代码放在函数里面使用, function ftp_upload () { echo "ftp upload" ftp -inv << EEND open 192.168.1.04 user username passwd binary prompt off put $filename } 但执行时,就会提示说没有合适的结尾,为什么啊?
请问HP-UX 的shell中(sh,ksh)中是否包含一些时间函数 可以用于 1 两个时间比较 2 将字符串标准化为时间值 如ll 之后的时间需要和一个时间常量进行比较,如何进行? 多谢!
如果有如下函数 ffttpp () { ftp -n ipadress << ! user $user $pwd get file by ! } 如果在一个shell里,我想多次的用这个函数 我怎么把ipadress,user,pwd的变量送进去呢?