mirror of
				https://github.com/xdtianyu/scripts.git
				synced 2025-11-01 07:05:21 +08:00 
			
		
		
		
	Create cmurl
Example: cmurl http://download.cyanogenmod.org hammerhead.zip /var/iso
This commit is contained in:
		
							
								
								
									
										36
									
								
								cmurl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								cmurl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| #!/bin/bash | ||||
| URL=$1 | ||||
| TARGET=$2 | ||||
| DIRECTORY=$3 | ||||
|  | ||||
| URL=$(curl -k -s $URL |grep $TARGET |grep -v html| sed -n "s|.*href=\"\([^\"]*\).*|$URL\1|p") | ||||
|  | ||||
| if [ -z "$URL" ];then | ||||
|     echo "ERROR" | ||||
|     exit 0 | ||||
| fi | ||||
|  | ||||
| echo $URL | ||||
| ZIP="${URL##*/}" | ||||
| echo $ZIP | ||||
|  | ||||
| if [ -f "$DIRECTORY/$ZIP" ];then | ||||
|     echo "DOWNLOADED" | ||||
|     exit 0 | ||||
| fi | ||||
|  | ||||
| if [ ! -d "$DIRECTORY" ];then | ||||
|     echo "ERROR DIR" | ||||
|     exit 0 | ||||
| fi | ||||
|  | ||||
| cd $DIRECTORY | ||||
|  | ||||
| wget $URL > $ZIP.wget.log 2>&1 | ||||
|  | ||||
| md5sum $ZIP > $ZIP.md5 | ||||
|  | ||||
| alias bypy='/root/bypy/bypy.py' | ||||
| bypy -v -s 10MB syncup | ||||
|  | ||||
| cd - | ||||
		Reference in New Issue
	
	Block a user