Generating shell script with Qwen2.5-Coder-14b-Instruct Large Language Model (LLM)
This page provides instructions on creating a shell script that selects a file from a specified directory and creates a symbolic link to it. The primary purpose is to set up an environment where users can easily choose their preferred default system prompt for interacting with Large Language Models (LLMs).
User’s configuration
This is my hardware configuration as of 12 March 2025:
- CPU: 13th Gen Intel® Core™ i7-13700T (24) @ 4.90 GHz
- GPU: NVIDIA GeForce RTX 3090 [Discrete]
- Memory: 8.75 GiB / 125.51 GiB (7%)
Large Language Model (LLM) in memory
Following large language models run in the memory:
/usr/local/bin/llama-server -c 8192 -ngl 999 -v --log-timestamps --host 192.168.1.68 -m /mnt/data/LLM/Qwen/quantized/qwen2.5-coder-14b-instruct-q6_k.gguf/usr/local/bin/llama-server -ngl 999 -v -c 8192 -ub 8192 --embedding --log-timestamps --host 192.168.1.68 --port 9999 -m /mnt/data/LLM/nomic-ai/quantized/nomic-embed-text-v1.5-Q8_0.gguf
User’s prompt
Sample dmenu options to use:
selected_model=$(basename -a "${!MODELS[@]}" | dmenu -fn "DejaVu:pixelsize=24" -l 10 -i -b -p "Select a model:" -nf blue -nb cyan)
I want to define PROMPT_DIR in shell script as /home/data1/protected/Programming/emacs-lisp/llm/prompts
Then dmenu to choose all files there that end in *.system but not the default.system
Then once dmenu selected the file to make symlink to default.system, no matter if it exists or not
Response by the Qwen2.5-Coder-14b-Instruct Large Language Model (LLM)
To accomplish the task of selecting a file from a directory using dmenu, then creating a symlink to default.system, you can use the following shell script. This script defines the PROMPT_DIR, lists the files that end with .system but not default.system, and then creates a symlink to default.system.
#!/bin/bash
# Define the directory containing the files
PROMPT_DIR="/home/data1/protected/Programming/emacs-lisp/llm/prompts"
# Change to the directory
cd "$PROMPT_DIR" || exit
# List all .system files but not default.system
files=($(find . -maxdepth 1 -type f -name "*.system" ! -name "default.system"))
# Use dmenu to select a file
selected_file=$(printf "%s\n" "${files[@]}" | dmenu -fn "DejaVu:pixelsize=24" -l 10 -i -b -p "Select a file:" -nf blue -nb cyan)
# Check if a file was selected
if [ -z "$selected_file" ]; then
echo "No file selected."
exit 1
fi
# Create a symlink to default.system, replacing it if it already exists
ln -sf "$selected_file" default.system
echo "Symlink created: default.system -> $selected_file"
Explanation:
- Define
PROMPT_DIR: The script starts by defining the directory where the files are located. - Change Directory: It changes to the specified directory using
cd. - List Files: It uses
findto list all files that end with.systembut excludesdefault.system. - dmenu Selection: The
dmenucommand is used to let the user select a file from the list. - Check Selection: The script checks if a file was selected. If not, it exits with a message.
- Create Symlink: It creates a symlink named
default.systempointing to the selected file, replacing it if it already exists.
To use this script:
1. Save it to a file, for example, create_symlink.sh.
2. Make it executable: chmod +x create_symlink.sh.
3. Run it: ./create_symlink.sh.
This script will prompt you to select a .system file using dmenu and create a symlink named default.system pointing to the selected file, replacing any existing default.system symlink.
Final result
The model Qwen2.5-Coder-14b-Instruct Large Language Model (LLM) generated shell script that works without necessity to modify anything.