LinuxÒÁµéÔ°ÂÛ̳'s Archiver

jackjones ·¢±íÓÚ 2007-1-24 14:29

СµÜµÚÒ»´Î½Ó´¥SHELL £¬Çó½â

дSHELL³Ì¹Òµ½LINUXϵͳÉÏ¡£È»ºóÔÚдһ¸ö
Íê³ÉºóÐ¶ÔØ¡£
:p

dearvoid ·¢±íÓÚ 2007-1-24 14:37

welcome to shell@linuxeden :)
ΪÁ˱ãÓÚÄú¸üºÃµÄÀûÓñ¾ÂÛ̳, ·¢ÌûǰÇëÏÈä¯ÀÀһϱ¾°æÖö¥µÄ¼¸¸öÌû×Ó

li-jiahuan ·¢±íÓÚ 2007-1-24 15:29

²»ÖªËùÔÆ......

²»¹ý¿´µ½Ð¶ÔØÁ½¸ö×Ö
ËÆºõÊÇÓÐ¹Ø mount, umountµÄ
¿É²Î¿¼ÎÒÕâÆª¿´¿´
[url]http://www.linuxeden.com/forum/showthread.php?t=154178[/url]

¶Ô¶þÂ¥µÄÌû×ÓÒªÈÏÕæÁì»áÆä¾«Éñ£¬Îû

fitren ·¢±íÓÚ 2007-1-25 09:22

;) ÓÖ¿¿²Â!

li-jiahuan ·¢±íÓÚ 2007-1-25 09:27

û°ì·¨Ñ½
dearvoidÔÙÈýÇ¿µ÷Öö¥/¾«»ªÌû
´ó»ï¾ÍÊDz»Àí

hahazhu ·¢±íÓÚ 2007-3-8 23:52

[0 No.2053 huan@huan ~/svn_bash/running]$ cat mynce.sh  
#! /bin/bash
# set -n
# set -x

# where to copy to  
dst="/media/usb"

# where to copy from  
src="/home/huan/study/nce3/"

# default device to copy to
dev=/dev/sda1

# run as root to use mount/umount, not a good idea :)
if (( $(id -u) != 0 )); then  
        sudo $0 "$@"
        exit $?
fi

copy(){
        for file in $*;do
                if [[ ! -f $src/lesson${file}.mp3 ]];then
                        echo "Can not find \"$src/lesson${file}.mp3\", skipped."
                        continue
                fi
                if [[ -f  $dst/lesson${file}.mp3 ]];then
                        rm  $dst/lesson${file}.mp3
                fi
        # copy each files ten times
                for((i=1;i<=10;i++))do
                        cat $src/lesson${file}.mp3 >> $dst/lesson${file}.mp3
                done
        done
        #echo "Done."
}

usage(){
    echo "$(basename $0) [ -d device ] [ files_to_copy ]"
    exit 0
}

if [[ $1 == '-d' ]]; then
    shift
    dev="$1"
    shift
elif [[ $1 == "-h" ]] || [[ $1 == "--help" ]];then
    usage
fi

# check if it's a block dev
if [[ ! -b $dev ]]; then
    echo "$dev not a block device"
    exit 1
fi

# if not mounted, try to mount
if ! mount | fgrep -q "$dev" ;then
    [[ -d $dst ]] || mkdir $dst
        if      ! mount $dev $dst -o iocharset=utf8; then
        echo "Can not mount $dev --> $dst, aborting ..."
        rmdir $dst
            exit 127
        fi
# mounted, get the mountpoint
else
    dst=$( mount | fgrep "$dev" | awk '{ print $3 }')
fi

rm $dst/lesson* 2> /dev/null

if [[ $1 == '' ]];then
    # ask what to copy
        read -p "lesson[s] to copy: " LESSON
        echo "This will take a little time, please be patient ..."
        copy $LESSON
else
        copy $@
fi

# umount device after copying
if umount $dst 2>/dev/null;then
        echo "Done"
else
    echo "$dst busy now, will be umounted if the device not used any more ..."
    umount -l $dst
fi  
´ÓÌáʾusageÀ´¿´£¬Õâ¸ö½Å±¾ÊÇ3ÖÖ·½Ê½À´¿½±´mp3£¬Í¨¹ý³ÌÐòÖеÄÌõ¼þÓï¾ä£¬ÔÙ¼ÓÉÏÐ©ÌØÊâ±äÁ¿ÓëÑ­»·À´ÊµÏÖ¹¦ÄÜ~ºÜ²»´íµÄ¡£²»¹ý£¬ÎÒ¾ÍÊÇÔÚµÚÒ»²¿·ÖÅжÏÓû§Éí·ÝÖУ¬Ê¹ÓÃsudoÃüÁÄǸöÆðʲô×÷Ó㬲»Ì«Ã÷°×£¬Ò²Ï£Íû£¬Ã÷°×µÄ´ó¸ç£¬´ó½ãÃÇ£¬°ï½â´ð¡£Ð¡µÜQQ£º383088680
лл~

li-jiahuan ·¢±íÓÚ 2007-3-9 00:57

sudo ÊÇʹÓÃrootȨÏÞÀ´Ö´ÐÐÕâ¸ö½Å±¾
Èç¹ûÓû§±»ÔÊÐíµÄ»°

µ±È»£¬²»ÊÇÿ¸ö·¢ÐаæÖж¼»á°²×°²¢ÍƼösudo

looche ·¢±íÓÚ 2007-3-9 12:49

¹À¼ÆÍ·Ð÷»¹²»ÊǺÜÇåÎú°É

michaelzhang ·¢±íÓÚ 2007-3-9 15:01

ȷʵ²»ÖªµÀÒª×öʲô¹þ¹þ

Ò³: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.