我正在尝试在FreeBSD机器上安装SDKMAN软件包管理器。 我成功执行了:
var bookingTime = ["10:00-12:00"]
var bookedTime = {
"room1": ["11:00-12:00", "12:00-13:00", "13:00-14:00"],
"room2": ["12:00-13:00"],
"room3": ["12:00-13:00"]
}
function isBooked(bookingTime, bookedTime) {
//Convert the start and end times to integers - se we can compare easily
var bookingStartInt = parseInt(bookingTime.split('-')[0].replace(':', '')); //Produces int 1000
var bookingEndInt = parseInt(bookingTime.split('-')[1].replace(':', '')); //Produces int 1000
return Object.keys(bookedTime).some(aRoom => {
return bookedTime[aRoom].every(aSlot => {
//Convert each slot to start and end integers
var slotStartInt = parseInt(aSlot.split('-')[0].replace(':', ''));
var slotEndInt = parseInt(aSlot.split('-')[1].replace(':', ''));
//Compare if booking time overlaps with the current time slot
return !(bookingStartInt < slotStartInt && bookingEndInt <= slotStartInt || bookingStartInt >= slotEndInt && bookingEndInt > slotEndInt);
})
})
}
console.log(isBooked(bookingTime[0], bookedTime));
当我尝试运行时出现问题:
curl -s "https://get.sdkman.io" | bash
我在终端中遇到以下错误:
source "/root/.sdkman/bin/sdkman-init.sh"
答案 0 :(得分:1)
FreeBSD默认没有bash
,因此您可能正在运行其他Shell。尝试先运行bash
以输入bash提示符,然后运行该source ...
命令。