Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

Also, why over-usage of setting variables? I read what you want as being in two states: you either provide a variable and want all partitions mounted or you provide arguments and want just those partitions mounted. I see that as a single if then else statement!

I list each mount individually, while this may seem redundant, compacting it even more results in difficult to read code blocks that work perfect in their original form, but nearly impossible to modify to your own usage (in this case, /dev/sdx -> UUID)

I don't mean to detract from what others wrote, but my reasoning is exampled in previous posts

[abc]) sudo mount /dev/sb$x /media/b$x

sudo mount /dev/sb"1ドル" /media/b"1ドル"

You specify wishing to use UUIDS, I personally wouldn't know how to modify the above to accommodate UUIDS.

However, scaled mine would not work well as it requires asking each argument 3 questions. For only 3 though, I believe it's fine.

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount $UUID_A /media/ba
 sudo mount $UUID_B /media/bb
 sudo mount $UUID_C /media/bc
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount $UUID_A /media/ba 
 [ "$i" == b ] && sudo mount $UUID_B /media/bb
 [ "$i" == c ] && sudo mount $UUID_C /media/bc
 done
fi

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

Also, why over-usage of setting variables? I read what you want as being in two states: you either provide a variable and want all partitions mounted or you provide arguments and want just those partitions mounted. I see that as a single if then else statement!

I list each mount individually, while this may seem redundant, compacting it even more results in difficult to read code blocks that work perfect in their original form, but nearly impossible to modify to your own usage (in this case, /dev/sdx -> UUID)

I don't mean to detract from what others wrote, but my reasoning is exampled in previous posts

[abc]) sudo mount /dev/sb$x /media/b$x

sudo mount /dev/sb"1ドル" /media/b"1ドル"

You specify wishing to use UUIDS, I personally wouldn't know how to modify the above to accommodate UUIDS.

However, scaled mine would not work well as it requires asking each argument 3 questions. For only 3 though, I believe it's fine.

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount $UUID_A /media/ba
 sudo mount $UUID_B /media/bb
 sudo mount $UUID_C /media/bc
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount $UUID_A /media/ba 
 [ "$i" == b ] && sudo mount $UUID_B /media/bb
 [ "$i" == c ] && sudo mount $UUID_C /media/bc
 done
fi

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

Also, why over-usage of setting variables? I read what you want as being in two states: you either provide a variable and want all partitions mounted or you provide arguments and want just those partitions mounted. I see that as a single if then else statement!

I list each mount individually, while this may seem redundant, compacting it even more results in difficult to read code blocks that work perfect in their original form, but nearly impossible to modify to your own usage (in this case, /dev/sdx -> UUID)

I don't mean to detract from what others wrote, but my reasoning is exampled in previous posts

[abc]) sudo mount /dev/sb$x /media/b$x

sudo mount /dev/sb"1ドル" /media/b"1ドル"

You specify wishing to use UUIDS, I personally wouldn't know how to modify the above to accommodate UUIDS.

However, scaled mine would not work well as it requires asking each argument 3 questions. For only 3 though, I believe it's fine.

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount $UUID_A /media/ba
 sudo mount $UUID_B /media/bb
 sudo mount $UUID_C /media/bc
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount $UUID_A /media/ba 
 [ "$i" == b ] && sudo mount $UUID_B /media/bb
 [ "$i" == c ] && sudo mount $UUID_C /media/bc
 done
fi
corrected syntax for mount command.
Source Link
Miati
  • 111
  • 2

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

Also, why over-usage of setting variables? I read what you want as being in two states: you either provide a variable and want all partitions mounted or you provide arguments and want just those partitions mounted. I see that as a single if then else statement!

I list each mount individually, while this may seem redundant, compacting it even more results in difficult to read code blocks that work perfect in their original form, but nearly impossible to modify to your own usage (in this case, /dev/sdx -> UUID)

I don't mean to detract from what others wrote, but my reasoning is exampled in previous posts

[abc]) sudo mount /dev/sb$x /media/b$x

sudo mount /dev/sb"1ドル" /media/b"1ドル"

You specify wishing to use UUIDS, I personally wouldn't know how to modify the above to accommodate UUIDS.

However, scaled mine would not work well as it requires asking each argument 3 questions. For only 3 though, I believe it's fine.

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount $UUID_A /devmedia/sba $UUID_Aba
 sudo mount $UUID_B /devmedia/sbb $UUID_Bbb
 sudo mount $UUID_C /devmedia/sbc $UUID_Cbc
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount $UUID_A /devmedia/sbaba $UUID_A
 [ "$i" == b ] && sudo mount $UUID_B /devmedia/sbb $UUID_Bbb
 [ "$i" == c ] && sudo mount $UUID_C /devmedia/sbc $UUID_Cbc
 done
fi

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

Also, why over-usage of setting variables? I read what you want as being in two states: you either provide a variable and want all partitions mounted or you provide arguments and want just those partitions mounted. I see that as a single if then else statement!

I list each mount individually, while this may seem redundant, compacting it even more results in difficult to read code blocks that work perfect in their original form, but nearly impossible to modify to your own usage (in this case, /dev/sdx -> UUID)

I don't mean to detract from what others wrote, but my reasoning is exampled in previous posts

[abc]) sudo mount /dev/sb$x /media/b$x

sudo mount /dev/sb"1ドル" /media/b"1ドル"

You specify wishing to use UUIDS, I personally wouldn't know how to modify the above to accommodate UUIDS.

However, scaled mine would not work well as it requires asking each argument 3 questions. For only 3 though, I believe it's fine.

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount /dev/sba $UUID_A
 sudo mount /dev/sbb $UUID_B
 sudo mount /dev/sbc $UUID_C
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount /dev/sba $UUID_A
 [ "$i" == b ] && sudo mount /dev/sbb $UUID_B
 [ "$i" == c ] && sudo mount /dev/sbc $UUID_C
 done
fi

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

Also, why over-usage of setting variables? I read what you want as being in two states: you either provide a variable and want all partitions mounted or you provide arguments and want just those partitions mounted. I see that as a single if then else statement!

I list each mount individually, while this may seem redundant, compacting it even more results in difficult to read code blocks that work perfect in their original form, but nearly impossible to modify to your own usage (in this case, /dev/sdx -> UUID)

I don't mean to detract from what others wrote, but my reasoning is exampled in previous posts

[abc]) sudo mount /dev/sb$x /media/b$x

sudo mount /dev/sb"1ドル" /media/b"1ドル"

You specify wishing to use UUIDS, I personally wouldn't know how to modify the above to accommodate UUIDS.

However, scaled mine would not work well as it requires asking each argument 3 questions. For only 3 though, I believe it's fine.

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount $UUID_A /media/ba
 sudo mount $UUID_B /media/bb
 sudo mount $UUID_C /media/bc
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount $UUID_A /media/ba 
 [ "$i" == b ] && sudo mount $UUID_B /media/bb
 [ "$i" == c ] && sudo mount $UUID_C /media/bc
 done
fi
wasn't aware code only blocks weren't especially helpful - added some of my thoughts to what I changed
Source Link
Miati
  • 111
  • 2

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

This is not quiteAlso, why over-usage of setting variables? I read what you want as advancedbeing in two states: you either provide a variable and want all partitions mounted or you provide arguments and want just those partitions mounted. I see that as the above answers but is mucha single if then else statement!

I list each mount individually, while this may seem redundant, compacting it even more easierresults in difficult to read code blocks that work perfect in their original form, but nearly impossible to modify to your own usage (in this case, /dev/sdx - especially as you mentioned you will be using> UUID!)

I don't mean to detract from what others wrote, but my reasoning is exampled in previous posts

[abc]) sudo mount /dev/sb$x /media/b$x

sudo mount /dev/sb"1ドル" /media/b"1ドル"

You specify wishing to use UUIDS, I personally wouldn't know how to modify the above to accommodate UUIDS.

However, scaled mine would not work well as it requires asking each argument 3 questions. For only 3 though, I believe it's fine.

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount /dev/sba $UUID_A
 sudo mount /dev/sbb $UUID_B
 sudo mount /dev/sbc $UUID_C
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount /dev/sba $UUID_A
 [ "$i" == b ] && sudo mount /dev/sbb $UUID_B
 [ "$i" == c ] && sudo mount /dev/sbc $UUID_C
 done
fi

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

This is not quite as advanced as the above answers but is much more easier to modify - especially as you mentioned you will be using UUID!

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount /dev/sba $UUID_A
 sudo mount /dev/sbb $UUID_B
 sudo mount /dev/sbc $UUID_C
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount /dev/sba $UUID_A
 [ "$i" == b ] && sudo mount /dev/sbb $UUID_B
 [ "$i" == c ] && sudo mount /dev/sbc $UUID_C
 done
fi

I replaced the -v with -z as -v doesn't seem to apply to 1ドル. -z is true when string length is 0.

Also, why over-usage of setting variables? I read what you want as being in two states: you either provide a variable and want all partitions mounted or you provide arguments and want just those partitions mounted. I see that as a single if then else statement!

I list each mount individually, while this may seem redundant, compacting it even more results in difficult to read code blocks that work perfect in their original form, but nearly impossible to modify to your own usage (in this case, /dev/sdx -> UUID)

I don't mean to detract from what others wrote, but my reasoning is exampled in previous posts

[abc]) sudo mount /dev/sb$x /media/b$x

sudo mount /dev/sb"1ドル" /media/b"1ドル"

You specify wishing to use UUIDS, I personally wouldn't know how to modify the above to accommodate UUIDS.

However, scaled mine would not work well as it requires asking each argument 3 questions. For only 3 though, I believe it's fine.

UUID_A=''
UUID_B=''
UUID_C=''
if [ -z "1ドル" ] # If no argument is passed, act on all partitions.
 then
 sudo mount /dev/sba $UUID_A
 sudo mount /dev/sbb $UUID_B
 sudo mount /dev/sbc $UUID_C
 else
 for i in $@;
 do
 [ "$i" == a ] && sudo mount /dev/sba $UUID_A
 [ "$i" == b ] && sudo mount /dev/sbb $UUID_B
 [ "$i" == c ] && sudo mount /dev/sbc $UUID_C
 done
fi
usage of variables.
Source Link
Miati
  • 111
  • 2
Loading
Source Link
Miati
  • 111
  • 2
Loading
lang-bash

AltStyle によって変換されたページ (->オリジナル) /