In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
< $TMP_DIR_CONTENT_FILE rm -fr $TMP_DIR_CONTENT_FILE #It's a file elif [[ $TYPE == "FILE" ]]; then #Checking DST if [[ $DST == "" ]]; then DST=$(basename "$SRC") fi #If the destination is a directory, the file will be download into if [[ -d $DST ]]; then DST="$DST/$SRC" fi db_download_file "$SRC" "$DST" #Doesn't exists else print " > < "$TEMP_FILE" #Looking for the biggest file size #to calculate the padding to use local padding=0 while read -r line; do local FILE=${line%:*} local META=${line##*:} local SIZE=${META#*;} if [[ ${#SIZE} -gt $padding ]]; then padding=${#SIZE} fi done < "$RESPONSE_FILE" #For each entry, printing directories... while read -r line; do local FILE=${line%:*} local META=${line##*:} local TYPE=${META%;*} local SIZE=${META#*;} #Removing unneeded / FILE=${FILE##*/} if [[ $TYPE != "false" ]]; then FILE=$(echo -e "$FILE") $PRINTF " [D] %-${padding}s %s\n" "$SIZE" "$FILE" fi done < "$RESPONSE_FILE" #For each entry, printing files... while read -r line; do local FILE=${line%:*} local META=${line##*:} local TYPE=${META%;*} local SIZE=${META#*;} #Removing unneeded / FILE=${FILE##*/} if [[ $TYPE == "false" ]]; then FILE=$(echo -e "$FILE") $PRINTF " [F] %-${padding}s %s\n" "$SIZE" "$FILE" fi done < "$RESPONSE_FILE" #It's a file else print "FAILED: $DIR_DST is not a directory!\n" ERROR_STATUS=1 fi else print "FAILED\n" ERROR_STATUS=1 fi}#Share remote file#$1 = Remote filefunction db_share{ local FILE_DST=$(normalize_path "$1") $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_SHARES_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&short_url=false" 2>/ dev/null check_http_response # Check if grep-Q "^ HTTP/1.1 200 OK"$RESPONSE_FILE" Then print "> Share link:" echo $(sed-n's CONFIG_FILE. * "url": "\ ([^"] *\). * /\ 1else print "FAILED\ n" ERROR_STATUS=1 fi} # SETUP # CHECKING FOR AUTH FILEif [[- e $CONFIG_FILE]] Then # Loading data... And change old format config if necesary. Source "$CONFIG_FILE" 2 > / dev/null | | {sed-ibis' source CONFIG_FILE'& & source "$CONFIG_FILE" 2 > / dev/null} # Checking the loaded data if [[$APPKEY = "" | $APPSECRET = = "" | $OAUTH_ACCESS_TOKEN_SECRET = = "" | | $OAUTH_ACCESS_TOKEN = = "]] Then echo-ne "Error loading data from $CONFIG_FILE...\ n" echo-ne "It is recommended to run $0 unlink\ n" remove_temp_files exit 1 fi # Back compatibility with previous Dropbox Uploader versions if [[$ACCESS_LEVEL = = "]] Then ACCESS_LEVEL= "dropbox" fi#NEW SETUP...else echo-ne "\ n This is the first time you run this script.\ n\ n" echo-ne "1) Open the following URL in your Browser, and log in using your account: $APP_CREATE_URL\ n" echo-ne "2) Click on\" Create App\ ", then select\" Dropbox API app\ "\ n" echo-ne "3) Select\" Files and datastores\ "\ n" echo-ne "4) Now go on with the configuration Choosing the app permissions and access restrictions to your DropBox folder\ n "echo-ne" 5) Enter the\ "App Name\" that you prefer (e.g. MyUploader$RANDOM$RANDOM$RANDOM)\ n\ n "echo-ne" Now, click on the\ "Create App\" button.\ n\ n "echo-ne" When your new App is successfully created, please type the\ n "echo-ne" App Key, App Secret and the Permission type shown in the confirmation page:\ n\ n "# Getting the app key and secret from the user while (true) Do echo-n "# App key:" read APPKEY echo-n "# App secret:" read APPSECRET echo-n "# Permission type, App folder or Full Dropbox [a bank f]:" read ACCESS_LEVEL if [[$ACCESS_LEVEL = = "a"]] Then ACCESS_LEVEL= "sandbox ACCESS_MSG=" App Folder "else ACCESS_LEVEL=" dropbox "ACCESS_MSG=" Full Dropbox "fi echo-ne"\ n > App key is $APPKEY, App secret is $APPSECRET and Access level is $ACCESS_MSG. Looks ok? ]: "read answer if [[$answer = =" y "]]; then break; fi done # TOKEN REQUESTS echo-ne"\ n > Token request... "$CURL_BIN $CURL_ACCEPT_CERTIFICATES-s-- show-error-- globoff-I-o" $RESPONSE_FILE "--data" oauth_consumer_key=$APPKEY&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26&oauth_timestamp=$ (utime) & oauth_nonce=$RANDOM "$API_REQUEST_TOKEN_URL" 2 > / dev/null check_http_response OAUTH_TOKEN_SECRET=$ (sed-n's API_REQUEST_TOKEN_URL) 1 sed p' "$RESPONSE_FILE") OAUTH_TOKEN=$ (sed-n's OAUTH_TOKEN_SECRET. Authentic OAUTH_TOKEN_SECRET) if [[$OAUTH_TOKEN! = "& $OAUTH_TOKEN_SECRET! ="]] Then echo-ne "OK\ n" else echo-ne "FAILED\ n\ n Please, check your App key and secret...\ n\ n" remove_temp_files exit 1 fi while (true) Do # USER AUTH echo-ne "\ n Please open the following URL in your browser, and allow Dropbox Uploader\ n" echo-ne "to access your DropBox folder:\ n\ n-> ${API_USER_AUTH_URL}? oauth_token=$OAUTH_TOKEN\ n" echo-ne "\ nPress enter when done...\ n" read # API_ACCESS_TOKEN_URL echo-ne "> Access Token request... "$CURL_BIN $CURL_ACCEPT_CERTIFICATES-s-- show-error-- globoff-I-o" $RESPONSE_FILE "--data" oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26 $OAUTH_TOKEN_SECRET&oauth_timestamp=$ (utime) & oauth_nonce=$RANDOM "" $API_ACCESS_TOKEN_URL "2 > / dev/null check_http_response OAUTH_ACCESS_TOKEN_SECRET=$ (sed-n's sed Z Amurz 0-9] *\) &. * /\ 1Universe p' "$RESPONSE_FILE") OAUTH_ACCESS_TOKEN=$ (sed-n's RESPONSE_FILE) OAUTH_ACCESS_UID=$ (sed-n] *\) /\ 1RESPONSE_FILE p' "$RESPONSE_FILE") If [[$OAUTH_ACCESS_TOKEN! = "& & $OAUTH_ACCESS_TOKEN_SECRET! ="& & $OAUTH_ACCESS_UID! ="]] Then echo-ne "OK\ n" # Saving data in new format, compatible with source command. Echo "APPKEY=$APPKEY" > "$CONFIG_FILE" echo "APPSECRET=$APPSECRET" > > "$CONFIG_FILE" echo "ACCESS_LEVEL=$ACCESS_LEVEL" > > "$CONFIG_FILE" echo "OAUTH_ACCESS_TOKEN=$OAUTH_ACCESS_TOKEN" > > "$CONFIG_FILE" echo "OAUTH_ACCESS_TOKEN_SECRET=$OAUTH_ACCESS_TOKEN_SECRET" > > "$CONFIG_FILE" echo-ne "\ n Setup completed!\ n" break else print "FAILED\ n" ERROR_STATUS=1 fi done Remove_temp_files exit $ERROR_STATUSfi# START # COMMAND=$ {@: $OPTIND:1} ARG1=$ {@: $OPTIND+1:1} ARG2=$ {@: $OPTIND+2:1} let argnum=$#-$OPTIND#CHECKING PARAMS VALUEScase $COMMAND in upload) if [[$argnum-lt 2]]; then usage fi FILE_DST=$ {@: $#: 1} for
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.