Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120548511
tools.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jul 5, 03:55
Size
1 KB
Mime Type
text/x-shellscript
Expires
Mon, Jul 7, 03:55 (2 d)
Engine
blob
Format
Raw Data
Handle
27205112
Attached To
R1066 amc-cape
tools.sh
View Options
#!/bin/bash
function get_file_encoding() {
local filename=$1
local output=$(file --brief $filename)
case $output in
*ASCII*)
echo "unicode"
return 0;;
*UTF-8*)
echo "unicode"
return 0;;
*8859*)
echo "iso"
return 0;;
"*")
echo "unknown";;
esac
return 1
}
function function_exists() {
if [ $(type "$1" 2>&1 | grep -c "$1"' is a function') -eq 1 ]; then
return 0
else
return 1
fi
}
function check_OS() {
OS=$(uname | tr "[A-Z]" "[a-z]")
if [ "$OS" == "linux" ]; then return 0; fi
OS="unknown"
return 1
}
function check_OS_subtype() {
OS_SUBTYPE="unknown"
if [ -r /etc/gentoo-release ]; then OS_SUBTYPE="gentoo"; return 0; fi
return 1
}
function check_AMC_version() {
AMC_VERSION="unknown"
which auto-multiple-choice > /dev/null 2>&1
if [ $? -gt 0 ]; then
AMC_VERSION="none"
return 1
fi
case $OS in
"linux")
case $OS_SUBTYPE in
"gentoo")
AMC_VERSION=$(eix --xml auto-multiple-choice | grep 'installed="1"' | tr " " "\n" | grep '^id' | cut -d '"' -f 2)
return 0;;
esac
esac
return 1
}
# EOF
Event Timeline
Log In to Comment