我正在尝试将“ -ip”之后的参数保存为bash脚本中的变量:
03-29 19:28:58.838 18481-18677/com.kiit.projectmanager I/OpenGLRenderer: Initialized EGL, version 1.4
03-29 19:28:58.876 18481-18481/com.kiit.projectmanager W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
03-29 19:28:58.956 18481-18677/com.kiit.projectmanager E/HAL: hw_get_module_by_class: module name gralloc
03-29 19:28:58.956 18481-18677/com.kiit.projectmanager E/HAL: hw_get_module_by_class: module name gralloc
03-29 19:28:59.054 18481-18638/com.kiit.projectmanager D/FA: Connected to remote service
03-29 19:28:59.900 18481-18481/com.kiit.projectmanager I/Timeline: Timeline: Activity_launch_request time:50369167
03-29 19:28:59.920 18481-18638/com.kiit.projectmanager D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=1162, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=9078248192392117239}]
03-29 19:29:00.229 18481-18638/com.kiit.projectmanager D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=9078248192392117239, firebase_screen_class(_sc)=login_activity, firebase_screen_id(_si)=9078248192392117240}]
03-29 19:29:02.730 18481-18481/com.kiit.projectmanager I/Choreographer: Skipped 146 frames! The application may be doing too much work on its main thread.
03-29 19:29:04.698 18481-18481/com.kiit.projectmanager I/Choreographer: Skipped 117 frames! The application may be doing too much work on its main thread.
03-29 19:29:04.705 18481-18481/com.kiit.projectmanager I/Timeline: Timeline: Activity_launch_request time:50373972
03-29 19:29:04.724 18481-18638/com.kiit.projectmanager D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=4492, firebase_screen_class(_sc)=login_activity, firebase_screen_id(_si)=9078248192392117240}]
03-29 19:29:04.763 18481-18638/com.kiit.projectmanager D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=login_activity, firebase_previous_id(_pi)=9078248192392117240, firebase_screen_class(_sc)=student_login, firebase_screen_id(_si)=9078248192392117241}]
03-29 19:29:07.105 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:07.105 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:10.300 18481-18638/com.kiit.projectmanager D/FA: Setting user property (FE): _sid, 1553867950
03-29 19:29:10.341 18481-18638/com.kiit.projectmanager D/FA: Logging event (FE): session_start(_s), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=student_login, firebase_screen_id(_si)=9078248192392117241, session_id(_sid)=1553867950}]
03-29 19:29:10.376 18481-18638/com.kiit.projectmanager D/FA: Connected to remote service
03-29 19:29:11.005 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:11.005 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:11.666 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:11.666 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:15.494 18481-18481/com.kiit.projectmanager W/IInputConnectionWrapper: getExtractedText on inactive InputConnection
03-29 19:29:15.497 18481-18481/com.kiit.projectmanager W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
03-29 19:29:15.499 18481-18481/com.kiit.projectmanager W/IInputConnectionWrapper: setComposingRegion on inactive InputConnection
03-29 19:29:19.178 18481-18481/com.kiit.projectmanager W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@8cbf476
03-29 19:29:20.161 18481-18481/com.kiit.projectmanager I/Toast: Show toast from OpPackageName:com.kiit.projectmanager, PackageName:com.kiit.projectmanager
03-29 19:29:24.288 18481-18481/com.kiit.projectmanager W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@8cbf476
03-29 19:29:24.781 18481-18481/com.kiit.projectmanager I/Toast: Show toast from OpPackageName:com.kiit.projectmanager, PackageName:com.kiit.projectmanager
03-29 19:29:29.533 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:29.533 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:30.249 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:30.250 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:30.320 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:30.320 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:32.446 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:32.446 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:32.769 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:32.769 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:36.362 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:36.362 18481-18481/com.kiit.projectmanager E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-29 19:29:42.405 18481-18481/com.kiit.projectmanager W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@8cbf476
03-29 19:29:44.406 18481-18583/com.kiit.projectmanager D/FirebaseAuth: Notifying id token listeners about user ( yBhPtTpYDdQgviffTlUvhLwAOPn1 ).
03-29 19:29:44.420 18481-18481/com.kiit.projectmanager D/FirebaseApp: Notifying auth state listeners.
03-29 19:29:44.420 18481-18481/com.kiit.projectmanager D/FirebaseApp: Notified 0 auth state listeners.
03-29 19:29:44.437 18481-18481/com.kiit.projectmanager I/Timeline: Timeline: Activity_launch_request time:50413704
03-29 19:29:44.475 18481-18638/com.kiit.projectmanager D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=39712, firebase_screen_class(_sc)=student_login, firebase_screen_id(_si)=9078248192392117241}]
03-29 19:29:44.646 18481-19899/com.kiit.projectmanager W/DynamiteModule: Local module descriptor class for providerinstaller not found.
03-29 19:29:44.652 18481-18638/com.kiit.projectmanager D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=student_login, firebase_previous_id(_pi)=9078248192392117241, firebase_screen_class(_sc)=student_activity, firebase_screen_id(_si)=9078248192392117242}]
03-29 19:29:44.655 18481-19899/com.kiit.projectmanager I/DynamiteModule: Considering local module providerinstaller:0 and remote module providerinstaller:0
03-29 19:29:44.655 18481-19899/com.kiit.projectmanager W/ProviderInstaller: Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
03-29 19:29:44.656 18481-19899/com.kiit.projectmanager W/ResourceType: No package identifier when getting name for resource number 0x00000000
03-29 19:29:44.817 18481-18638/com.kiit.projectmanager D/FA: Connected to remote service
03-29 19:29:44.884 18481-19899/com.kiit.projectmanager I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java7ExtendedSSLSession>
03-29 19:29:44.885 18481-19899/com.kiit.projectmanager I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java7ExtendedSSLSession>
03-29 19:29:44.888 18481-19899/com.kiit.projectmanager I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java8ExtendedSSLSession>
03-29 19:29:44.889 18481-19899/com.kiit.projectmanager I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.org.conscrypt.Java8ExtendedSSLSession>
03-29 19:29:44.946 18481-19899/com.kiit.projectmanager I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
03-29 19:29:45.890 18481-18481/com.kiit.projectmanager W/PathParser: Points are too far apart 4.000000596046461
03-29 19:29:48.115 18481-18481/com.kiit.projectmanager E/RecyclerView: No adapter attached; skipping layout
03-29 19:29:48.134 18481-18481/com.kiit.projectmanager W/PathParser: Points are too far apart 4.000000596046461
03-29 19:29:48.467 18481-18481/com.kiit.projectmanager D/AndroidRuntime: Shutting down VM
03-29 19:29:48.468 18481-18481/com.kiit.projectmanager E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kiit.projectmanager, PID: 18481
java.lang.RuntimeException: Found two getters or fields with conflicting case sensitivity for property: roll_number
at com.google.firebase.firestore.util.CustomClassMapper$BeanMapper.addProperty(com.google.firebase:firebase-firestore@@18.1.0:670)
at com.google.firebase.firestore.util.CustomClassMapper$BeanMapper.<init>(com.google.firebase:firebase-firestore@@18.1.0:586)
at com.google.firebase.firestore.util.CustomClassMapper.loadOrCreateBeanMapperForClass(com.google.firebase:firebase-firestore@@18.1.0:348)
at com.google.firebase.firestore.util.CustomClassMapper.convertBean(com.google.firebase:firebase-firestore@@18.1.0:502)
at com.google.firebase.firestore.util.CustomClassMapper.deserializeToClass(com.google.firebase:firebase-firestore@@18.1.0:243)
at com.google.firebase.firestore.util.CustomClassMapper.convertToCustomClass(com.google.firebase:firebase-firestore@@18.1.0:97)
at com.google.firebase.firestore.DocumentSnapshot.toObject(com.google.firebase:firebase-firestore@@18.1.0:203)
at com.google.firebase.firestore.QueryDocumentSnapshot.toObject(com.google.firebase:firebase-firestore@@18.1.0:121)
at com.google.firebase.firestore.DocumentSnapshot.toObject(com.google.firebase:firebase-firestore@@18.1.0:183)
at com.google.firebase.firestore.QueryDocumentSnapshot.toObject(com.google.firebase:firebase-firestore@@18.1.0:101)
at com.kiit.projectmanager.availablestudent_fragment$1.onEvent(availablestudent_fragment.java:59)
at com.kiit.projectmanager.availablestudent_fragment$1.onEvent(availablestudent_fragment.java:48)
at com.google.firebase.firestore.Query.lambda$addSnapshotListenerInternal$2(com.google.firebase:firebase-firestore@@18.1.0:891)
at com.google.firebase.firestore.Query$$Lambda$3.onEvent(com.google.firebase:firebase-firestore@@18.1.0)
at com.google.firebase.firestore.util.ExecutorEventListener.lambda$onEvent$0(com.google.firebase:firebase-firestore@@18.1.0:42)
at com.google.firebase.firestore.util.ExecutorEventListener$$Lambda$1.run(com.google.firebase:firebase-firestore@@18.1.0)
at android.os.Handler.handleCallback(Handler.java:742)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
03-29 19:29:58.480 18481-19899/com.kiit.projectmanager W/Firestore: (18.1.0) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
我从未尝试过在bash中使用“ getopts”,我第一次尝试您可以在上方看到它,但实际上是失败的。
任何帮助将不胜感激,
谢谢
答案 0 :(得分:1)
您可以避免将getopts放在一起,而只需使用正则表达式即可。
myvar=$(echo "$@" | sed 's/.*-ip\s\+\([0-9a-zA-Z\.]\+\)\s*.*/\1/g')
将-ip之后的内容加载到myvar中。如果只需要与IP匹配的内容,则相应地调整正则表达式。