Skip to content

Instantly share code, notes, and snippets.

@paulojeronimo
Created January 23, 2025 09:12
Show Gist options
  • Select an option

  • Save paulojeronimo/2096b95e31340d0732fbd466883f07ac to your computer and use it in GitHub Desktop.

Select an option

Save paulojeronimo/2096b95e31340d0732fbd466883f07ac to your computer and use it in GitHub Desktop.
Cursor start script
#!/usr/bin/env bash
set -eou pipefail
cursor_dir=${cursor_dir:-~/Downloads}
cursor_prefix=cursor-
cursor_suffix=.AppImage
cursor_files=($(echo $cursor_dir/$cursor_prefix*$cursor_suffix))
log() {
local level=${level:-INFO}
local ts=$(date +%c)
local cursor_log=${cursor_log:-~/.cursor/cursor.log}
echo "[$level] $ts" - "$@" | tee -a $cursor_log
}
! [[ ${#cursor_files[@]} -gt 1 ]] || {
echo Multiple Cursor versions found in $cursor_dir!
echo Move the old Cursor versions to another directory to continue ...
exit 1
}
cursor_file=${cursor_files[0]}
cursor_version=${cursor_file#$cursor_dir/$cursor_prefix}
cursor_version=${cursor_version%$cursor_suffix}
mkdir -p ~/.cursor
cursor_log=~/.cursor/$cursor_version.log
cursor_args="$@"
echo Cursor Log file: $cursor_log
log Starting Cursor $cursor_version with \"$cursor_args\" arguments ...
[ -f $cursor_file ] || {
level=ERROR log File $cursor_file not found!
exit 1
}
[ -x $cursor_file ] || chmod +x $cursor_file
nohup setsid $cursor_file --no-sandbox "$cursor_args" &>> $cursor_log &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment