我正在制作一个 shell 脚本来限制某人在程序上花费的时间,但它给了我以下错误:
./time_limit: line 26: $Log: ambiguous redirect
./time_limit: line 16: [: root: unary operator expected
Run Code Online (Sandbox Code Playgroud)
这是代码:
#!/bin/bash
config (){
ImageViewer=/ 2> /dev/null
AllowedTime=30 #in minutes
AllowedPlays=1
cmd=sol #for demonstration, I use sol installed by default in Ubuntu. Set to your liking
AllowedUser=root #Set to your liking.
ImageViewer=eog #I set this to the Eye of GNOME image viewer. If no GUI or if you don't want an explosion (really?) comment out.
#If you have another desktop change to yor …
Run Code Online (Sandbox Code Playgroud)