From fef976bfece2bc47d9a794552b723e53e9d52aa2 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Thu, 12 Mar 2020 07:51:48 +0100 Subject: [PATCH] =?UTF-8?q?Add=20function=20to=20get=20the=20content=20typ?= =?UTF-8?q?e=20(file,=20url,=E2=80=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- send.to.0x0.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/send.to.0x0.sh b/send.to.0x0.sh index eddeda2..665fb7c 100755 --- a/send.to.0x0.sh +++ b/send.to.0x0.sh @@ -31,6 +31,22 @@ debug_message() { [ "${debug}" = "true" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG ${_message}" } # ]]] +# Function to get content type [[[ +determine_content_type() { + _content="${1}" + + _content_nb_line=$(printf -- '%s\n' "${_content}" | wc -l) + debug_message "− Determine type : Content has ${_content_nb_line} line(s) to send." + + ## If it's a one line content + if [ "${_content_nb_line}" -eq "1" ]; then + ### Verify if it's a path to a existent file + flag_file="" + ### Verify it it's a remote URL + flag_url="" + fi +} +# ]]] # Verify argument [[[ case "$#" in @@ -62,6 +78,9 @@ fi debug_message "− Get Content : content to be sended : ${content_to_send}" # ]]] +# Try to determine the type of the content (file, remote URL or text) +determine_content_type "${content_to_send}" + content_url="" # Manage the result [[[